Unverified Commit 5853be27 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 d25092c3
......@@ -634,6 +634,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
......@@ -652,6 +668,8 @@ class GeckoEngine(
this.clearColor = it.clearColor
this.loginAutofillEnabled = it.loginAutofillEnabled
this.enterpriseRootsEnabled = it.enterpriseRootsEnabled
this.torSecurityLevel = it.torSecurityLevel
this.spoofEnglish = it.spoofEnglish
}
}
......
......@@ -88,6 +88,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 {
......
......@@ -52,7 +52,8 @@ class HttpIconLoader(
connectTimeout = Pair(CONNECT_TIMEOUT, TimeUnit.SECONDS),
readTimeout = Pair(READ_TIMEOUT, TimeUnit.SECONDS),
redirect = Request.Redirect.FOLLOW,
useCaches = true)
useCaches = true,
origin = request.url)
return try {
val response = httpClient.fetch(downloadRequest)
......
......@@ -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].
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment