Matthew Finkel pushed to branch android-components-57.0.6-10.0-2 at The Tor Project / Applications / android-components
Commits: 25f1f7c1 by Matthew Finkel at 2020-09-30T21:52:48+00:00 Bug 40006: Expose Security Level interface
- - - - - 6f338e43 by Matthew Finkel at 2020-10-01T14:02:33+00:00 Merge branch 'bug_40006_02' into android-components-57.0.6-10.0-2
- - - - -
3 changed files:
- components/browser/engine-gecko-beta/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngine.kt - components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngine.kt - components/concept/engine/src/main/java/mozilla/components/concept/engine/Settings.kt
Changes:
===================================== components/browser/engine-gecko-beta/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngine.kt ===================================== @@ -615,6 +615,14 @@ class GeckoEngine( override var forceUserScalableContent: Boolean get() = runtime.settings.forceUserScalableEnabled set(value) { runtime.settings.forceUserScalableEnabled = value } + + override var torSecurityLevel: Int + get() = runtime.settings.torSecurityLevel + set(value) { + value.let { + runtime.settings.torSecurityLevel = it + } + } }.apply { defaultSettings?.let { this.javascriptEnabled = it.javascriptEnabled @@ -631,6 +639,7 @@ class GeckoEngine( this.fontSizeFactor = it.fontSizeFactor this.forceUserScalableContent = it.forceUserScalableContent this.loginAutofillEnabled = it.loginAutofillEnabled + this.torSecurityLevel = it.torSecurityLevel } }
===================================== components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngine.kt ===================================== @@ -615,6 +615,14 @@ class GeckoEngine( override var forceUserScalableContent: Boolean get() = runtime.settings.forceUserScalableEnabled set(value) { runtime.settings.forceUserScalableEnabled = value } + + override var torSecurityLevel: Int + get() = runtime.settings.torSecurityLevel + set(value) { + value.let { + runtime.settings.torSecurityLevel = it + } + } }.apply { defaultSettings?.let { this.javascriptEnabled = it.javascriptEnabled @@ -631,6 +639,7 @@ class GeckoEngine( this.fontSizeFactor = it.fontSizeFactor this.forceUserScalableContent = it.forceUserScalableContent this.loginAutofillEnabled = it.loginAutofillEnabled + this.torSecurityLevel = it.torSecurityLevel } }
===================================== components/concept/engine/src/main/java/mozilla/components/concept/engine/Settings.kt ===================================== @@ -174,6 +174,11 @@ abstract class Settings { * Setting to force the ability to scale the content */ open var forceUserScalableContent: Boolean by UnsupportedSetting() + + /** + * Setting to control the current security level + */ + open var torSecurityLevel: Int by UnsupportedSetting() }
/** @@ -208,7 +213,8 @@ data class DefaultSettings( override var fontInflationEnabled: Boolean? = null, override var fontSizeFactor: Float? = null, override var forceUserScalableContent: Boolean = false, - override var loginAutofillEnabled: Boolean = false + override var loginAutofillEnabled: Boolean = false, + override var torSecurityLevel: Int = 0 ) : Settings()
class UnsupportedSetting<T> {
View it on GitLab: https://gitlab.torproject.org/tpo/applications/android-components/-/compare/...