Skip to content
Snippets Groups Projects
Unverified Commit 710d1e60 authored by Matthew Finkel's avatar Matthew Finkel Committed by boklm
Browse files

Add support for new GeckoView interfaces

Bug 40006: Expose Security Level interface

Bug 40019: Expose spoofEnglish pref

Bug 34439: Isolate Icon loader on Android
parent 577061a2
Branches android-components-94.0.12-11.0-1
Tags android-components-94.0.12-11.0-1-build1
1 merge request!75Rebase android-components patches on 94.0.12
......@@ -672,6 +672,22 @@ class GeckoEngine(
override var enterpriseRootsEnabled: Boolean
get() = runtime.settings.enterpriseRootsEnabled
set(value) { runtime.settings.enterpriseRootsEnabled = value }
override var torSecurityLevel: Int
get() = runtime.settings.torSecurityLevel
set(value) {
value.let {
runtime.settings.torSecurityLevel = it
}
}
override var spoofEnglish: Boolean
get() = runtime.settings.spoofEnglish
set(value) {
value.let {
runtime.settings.spoofEnglish = it
localeUpdater.updateValue()
}
}
}.apply {
defaultSettings?.let {
this.javascriptEnabled = it.javascriptEnabled
......@@ -690,6 +706,8 @@ class GeckoEngine(
this.clearColor = it.clearColor
this.loginAutofillEnabled = it.loginAutofillEnabled
this.enterpriseRootsEnabled = it.enterpriseRootsEnabled
this.torSecurityLevel = it.torSecurityLevel
this.spoofEnglish = it.spoofEnglish
}
}
......
......@@ -87,6 +87,7 @@ private fun Request.toWebRequest(): WebRequest = WebRequest.Builder(url)
.addHeadersFrom(this)
.addBodyFrom(this)
.cacheMode(if (useCaches) CACHE_MODE_DEFAULT else CACHE_MODE_RELOAD)
.origin(origin)
.build()
private fun WebRequest.Builder.addHeadersFrom(request: Request): WebRequest.Builder {
......
......@@ -53,7 +53,8 @@ class HttpIconLoader(
readTimeout = Pair(READ_TIMEOUT, TimeUnit.SECONDS),
redirect = Request.Redirect.FOLLOW,
useCaches = true,
private = request.isPrivate
private = request.isPrivate,
origin = request.url
)
return try {
......
......@@ -184,6 +184,13 @@ abstract class Settings {
* Setting to control whether enterprise root certs are enabled.
*/
open var enterpriseRootsEnabled: Boolean by UnsupportedSetting()
/**
* Setting to control the current security level
*/
open var torSecurityLevel: Int by UnsupportedSetting()
open var spoofEnglish: Boolean by UnsupportedSetting()
}
/**
......@@ -220,7 +227,9 @@ data class DefaultSettings(
override var forceUserScalableContent: Boolean = false,
override var loginAutofillEnabled: Boolean = false,
override var clearColor: Int? = null,
override var enterpriseRootsEnabled: Boolean = false
override var enterpriseRootsEnabled: Boolean = false,
override var torSecurityLevel: Int = 4,
override var spoofEnglish: Boolean = false
) : Settings()
class UnsupportedSetting<T> {
......
......@@ -48,7 +48,8 @@ data class Request(
val redirect: Redirect = Redirect.FOLLOW,
val cookiePolicy: CookiePolicy = CookiePolicy.INCLUDE,
val useCaches: Boolean = true,
val private: Boolean = false
val private: Boolean = false,
val origin: String? = null
) {
/**
* A [Body] to be send with the [Request].
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment