Commit ef4002fe authored by MozLando's avatar MozLando
Browse files

Merge #4513



4513: Add the WebCompat feature to the sample browsers r=pocmo a=denschub

We're shipping it in Fenix, and we need a simple way to test new interventions across products, so it makes sense to include the feature in the sample browsers.



Co-authored-by: default avatarDennis Schubert <dschubert@mozilla.com>
parents 7016533a 014fb85a
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -152,6 +152,8 @@ _Combined components to implement feature-specific use cases._

* 🔴 [**Web Notifications**](components/feature/webnotifications/README.md) - A component for displaying web notifications.

* 🔵 [**WebCompat**](components/feature/webcompat/README.md) - A feature to enable website-hotfixing via the Web Compatibility System-Addon.

## UI

_Generic low-level UI components for building apps._
+1 −0
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ dependencies {
    implementation project(':feature-pwa')
    implementation project(':feature-findinpage')
    implementation project(':feature-sitepermissions')
    implementation project(':feature-webcompat')

    implementation project(':ui-autocomplete')

+4 −1
Original line number Diff line number Diff line
@@ -7,12 +7,15 @@ package org.mozilla.samples.browser
import android.content.Context
import mozilla.components.browser.engine.gecko.GeckoEngine
import mozilla.components.concept.engine.Engine
import mozilla.components.feature.webcompat.WebCompatFeature

/**
 * Helper class for lazily instantiating components needed by the application.
 */
class Components(applicationContext: Context) : DefaultComponents(applicationContext) {
    override val engine: Engine by lazy {
        GeckoEngine(applicationContext, engineSettings)
        GeckoEngine(applicationContext, engineSettings).also {
            WebCompatFeature.install(it)
        }
    }
}
+5 −2
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ package org.mozilla.samples.browser
import android.content.Context
import mozilla.components.browser.engine.gecko.GeckoEngine
import mozilla.components.concept.engine.Engine
import mozilla.components.feature.webcompat.WebCompatFeature
import mozilla.components.support.base.log.Log

/**
@@ -13,10 +14,12 @@ import mozilla.components.support.base.log.Log
 */
class Components(private val applicationContext: Context) : DefaultComponents(applicationContext) {
    override val engine: Engine by lazy {
        GeckoEngine(applicationContext, engineSettings).apply {
            installWebExtension("mozacBorderify", "resource://android/assets/extensions/borderify/") {
        GeckoEngine(applicationContext, engineSettings).also {
            it.installWebExtension("mozacBorderify", "resource://android/assets/extensions/borderify/") {
                ext, throwable -> Log.log(Log.Priority.ERROR, "SampleBrowser", throwable, "Failed to install $ext")
            }

            WebCompatFeature.install(it)
        }
    }
}
+4 −1
Original line number Diff line number Diff line
@@ -6,12 +6,15 @@ package org.mozilla.samples.browser
import android.content.Context
import mozilla.components.browser.engine.gecko.GeckoEngine
import mozilla.components.concept.engine.Engine
import mozilla.components.feature.webcompat.WebCompatFeature

/**
 * Helper class for lazily instantiating components needed by the application.
 */
class Components(private val applicationContext: Context) : DefaultComponents(applicationContext) {
    override val engine: Engine by lazy {
        GeckoEngine(applicationContext, engineSettings)
        GeckoEngine(applicationContext, engineSettings).also {
            WebCompatFeature.install(it)
        }
    }
}