|
|
@ -15,10 +15,15 @@ import org.mozilla.fenix.Config
|
|
|
|
import org.mozilla.fenix.ext.components
|
|
|
|
import org.mozilla.fenix.ext.components
|
|
|
|
import org.mozilla.geckoview.GeckoRuntime
|
|
|
|
import org.mozilla.geckoview.GeckoRuntime
|
|
|
|
import org.mozilla.geckoview.GeckoRuntimeSettings
|
|
|
|
import org.mozilla.geckoview.GeckoRuntimeSettings
|
|
|
|
|
|
|
|
import org.mozilla.geckoview.ContentBlocking.SafeBrowsingProvider
|
|
|
|
|
|
|
|
|
|
|
|
object GeckoProvider {
|
|
|
|
object GeckoProvider {
|
|
|
|
var testConfig: Bundle? = null
|
|
|
|
var testConfig: Bundle? = null
|
|
|
|
private var runtime: GeckoRuntime? = null
|
|
|
|
private var runtime: GeckoRuntime? = null
|
|
|
|
|
|
|
|
const val CN_UPDATE_URL =
|
|
|
|
|
|
|
|
"https://sb.firefox.com.cn/downloads?client=SAFEBROWSING_ID&appver=%MAJOR_VERSION%&pver=2.2"
|
|
|
|
|
|
|
|
const val CN_GET_HASH_URL =
|
|
|
|
|
|
|
|
"https://sb.firefox.com.cn/gethash?client=SAFEBROWSING_ID&appver=%MAJOR_VERSION%&pver=2.2"
|
|
|
|
|
|
|
|
|
|
|
|
@Synchronized
|
|
|
|
@Synchronized
|
|
|
|
fun getOrCreateRuntime(
|
|
|
|
fun getOrCreateRuntime(
|
|
|
@ -63,6 +68,28 @@ object GeckoProvider {
|
|
|
|
runtimeSettings.fontSizeFactor = fontSize
|
|
|
|
runtimeSettings.fontSizeFactor = fontSize
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add safebrowsing providers for China
|
|
|
|
|
|
|
|
if (Config.channel.isMozillaOnline) {
|
|
|
|
|
|
|
|
val mozcn = SafeBrowsingProvider
|
|
|
|
|
|
|
|
.withName("mozcn")
|
|
|
|
|
|
|
|
.version("2.2")
|
|
|
|
|
|
|
|
.lists("m6eb-phish-shavar", "m6ib-phish-shavar")
|
|
|
|
|
|
|
|
.updateUrl(CN_UPDATE_URL)
|
|
|
|
|
|
|
|
.getHashUrl(CN_GET_HASH_URL)
|
|
|
|
|
|
|
|
.build()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
runtimeSettings.contentBlocking.setSafeBrowsingProviders(mozcn,
|
|
|
|
|
|
|
|
// Keep the existing configuration
|
|
|
|
|
|
|
|
ContentBlocking.GOOGLE_SAFE_BROWSING_PROVIDER,
|
|
|
|
|
|
|
|
ContentBlocking.GOOGLE_LEGACY_SAFE_BROWSING_PROVIDER)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
runtimeSettings.contentBlocking.setSafeBrowsingPhishingTable(
|
|
|
|
|
|
|
|
"m6eb-phish-shavar",
|
|
|
|
|
|
|
|
"m6ib-phish-shavar",
|
|
|
|
|
|
|
|
// Existing configuration
|
|
|
|
|
|
|
|
"goog-phish-proto")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
val geckoRuntime = GeckoRuntime.create(context, runtimeSettings)
|
|
|
|
val geckoRuntime = GeckoRuntime.create(context, runtimeSettings)
|
|
|
|
val loginStorageDelegate = GeckoLoginStorageDelegate(storage)
|
|
|
|
val loginStorageDelegate = GeckoLoginStorageDelegate(storage)
|
|
|
|
geckoRuntime.loginStorageDelegate = GeckoLoginDelegateWrapper(loginStorageDelegate)
|
|
|
|
geckoRuntime.loginStorageDelegate = GeckoLoginDelegateWrapper(loginStorageDelegate)
|
|
|
|