lists.torproject.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

tbb-commits

Thread Start a new thread
Download
Threads by month
  • ----- 2025 -----
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2021 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2020 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2019 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2018 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2017 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2016 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2015 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2014 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
tbb-commits@lists.torproject.org

October 2020

  • 3 participants
  • 412 discussions
[Git][tpo/applications/android-components][android-components-60.0.3-10.0-1] 2 commits: Bug 40019: Expose spoofEnglish pref
by Matthew Finkel 23 Oct '20

23 Oct '20
Matthew Finkel pushed to branch android-components-60.0.3-10.0-1 at The Tor Project / Applications / android-components Commits: 5c662aa1 by Alex Catarineu at 2020-10-19T21:06:49+02:00 Bug 40019: Expose spoofEnglish pref - - - - - f57c6c10 by Matthew Finkel at 2020-10-23T18:08:18+00:00 Merge remote-tracking branch &#39;acatgl/40019+1&#39; into android-components-60.0.3-10.0-1 - - - - - 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 ===================================== @@ -608,6 +608,14 @@ class GeckoEngine( 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 @@ -625,6 +633,7 @@ class GeckoEngine( this.forceUserScalableContent = it.forceUserScalableContent this.loginAutofillEnabled = it.loginAutofillEnabled this.torSecurityLevel = it.torSecurityLevel + this.spoofEnglish = it.spoofEnglish } } ===================================== components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/GeckoEngine.kt ===================================== @@ -608,6 +608,14 @@ class GeckoEngine( 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 @@ -625,6 +633,7 @@ class GeckoEngine( this.forceUserScalableContent = it.forceUserScalableContent this.loginAutofillEnabled = it.loginAutofillEnabled this.torSecurityLevel = it.torSecurityLevel + this.spoofEnglish = it.spoofEnglish } } ===================================== components/concept/engine/src/main/java/mozilla/components/concept/engine/Settings.kt ===================================== @@ -179,6 +179,8 @@ abstract class Settings { * Setting to control the current security level */ open var torSecurityLevel: Int by UnsupportedSetting() + + open var spoofEnglish: Boolean by UnsupportedSetting() } /** @@ -214,7 +216,8 @@ data class DefaultSettings( override var fontSizeFactor: Float? = null, override var forceUserScalableContent: Boolean = false, override var loginAutofillEnabled: Boolean = false, - override var torSecurityLevel: Int = 4 + override var torSecurityLevel: Int = 4, + override var spoofEnglish: Boolean = false ) : Settings() class UnsupportedSetting<T> { View it on GitLab: https://gitlab.torproject.org/tpo/applications/android-components/-/compare… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/android-components/-/compare… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[tor-browser/tor-browser-82.0-10.0-1] Bug 40198: Expose privacy.spoof_english pref in GeckoView
by sysrqb@torproject.org 23 Oct '20

23 Oct '20
commit f053018860f048866a390bacca7be1d381c5726b Author: Alex Catarineu <acat(a)torproject.org> Date: Sun Oct 18 17:06:04 2020 +0200 Bug 40198: Expose privacy.spoof_english pref in GeckoView --- mobile/android/geckoview/api.txt | 3 ++ .../mozilla/geckoview/GeckoRuntimeSettings.java | 33 ++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/mobile/android/geckoview/api.txt b/mobile/android/geckoview/api.txt index 9f15c8be0138..5e64688b7e47 100644 --- a/mobile/android/geckoview/api.txt +++ b/mobile/android/geckoview/api.txt @@ -577,6 +577,7 @@ package org.mozilla.geckoview { method public boolean getRemoteDebuggingEnabled(); method @Nullable public GeckoRuntime getRuntime(); method @Nullable public Rect getScreenSizeOverride(); + method public boolean getSpoofEnglish(); method @Nullable public RuntimeTelemetry.Delegate getTelemetryDelegate(); method public int getTorSecurityLevel(); method public boolean getUseMaxScreenDepth(); @@ -597,6 +598,7 @@ package org.mozilla.geckoview { method @NonNull public GeckoRuntimeSettings setLoginAutofillEnabled(boolean); method @NonNull public GeckoRuntimeSettings setPreferredColorScheme(int); method @NonNull public GeckoRuntimeSettings setRemoteDebuggingEnabled(boolean); + method @NonNull public GeckoRuntimeSettings setSpoofEnglish(boolean); method @NonNull public GeckoRuntimeSettings setTorSecurityLevel(int); method @NonNull public GeckoRuntimeSettings setWebFontsEnabled(boolean); method @NonNull public GeckoRuntimeSettings setWebManifestEnabled(boolean); @@ -632,6 +634,7 @@ package org.mozilla.geckoview { method @NonNull public GeckoRuntimeSettings.Builder preferredColorScheme(int); method @NonNull public GeckoRuntimeSettings.Builder remoteDebuggingEnabled(boolean); method @NonNull public GeckoRuntimeSettings.Builder screenSizeOverride(int, int); + method @NonNull public GeckoRuntimeSettings.Builder spoofEnglish(boolean); method @NonNull public GeckoRuntimeSettings.Builder telemetryDelegate(@NonNull RuntimeTelemetry.Delegate); method @NonNull public GeckoRuntimeSettings.Builder torSecurityLevel(int); method @NonNull public GeckoRuntimeSettings.Builder useMaxScreenDepth(boolean); diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java index b7c080557470..5bad77d4f880 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java @@ -468,6 +468,17 @@ public final class GeckoRuntimeSettings extends RuntimeSettings { getSettings().mTorSecurityLevel.set(level); return this; } + + /** + * Sets whether we should spoof locale to English for webpages. + * + * @param flag True if we should spoof locale to English for webpages, false otherwise. + * @return This Builder instance. + */ + public @NonNull Builder spoofEnglish(final boolean flag) { + getSettings().mSpoofEnglish.set(flag ? 2 : 1); + return this; + } } private GeckoRuntime mRuntime; @@ -520,6 +531,8 @@ public final class GeckoRuntimeSettings extends RuntimeSettings { "signon.autofillForms", true); /* package */ final Pref<Integer> mTorSecurityLevel = new Pref<>( "extensions.torbutton.security_slider", 4); + /* package */ final Pref<Integer> mSpoofEnglish = new Pref<>( + "privacy.spoof_english", 0); /* package */ int mPreferredColorScheme = COLOR_SCHEME_SYSTEM; @@ -1196,6 +1209,26 @@ public final class GeckoRuntimeSettings extends RuntimeSettings { return this; } + /** + * Get whether we should spoof locale to English for webpages. + * + * @return Whether we should spoof locale to English for webpages. + */ + public boolean getSpoofEnglish() { + return mSpoofEnglish.get() == 2; + } + + /** + * Set whether we should spoof locale to English for webpages. + * + * @param flag A flag determining whether we should locale to English for webpages. + * @return This GeckoRuntimeSettings instance. + */ + public @NonNull GeckoRuntimeSettings setSpoofEnglish(final boolean flag) { + mSpoofEnglish.commit(flag ? 2 : 1); + return this; + } + @Override // Parcelable public void writeToParcel(final Parcel out, final int flags) { super.writeToParcel(out, flags);
1 0
0 0
[tor-browser/tor-browser-82.0-10.0-1] Bug 30605: Honor privacy.spoof_english in Android
by sysrqb@torproject.org 23 Oct '20

23 Oct '20
commit 0094bc69860877bb8f49c73751e8b98975eea50c Author: Alex Catarineu <acat(a)torproject.org> Date: Fri Oct 16 10:45:17 2020 +0200 Bug 30605: Honor privacy.spoof_english in Android This checks `privacy.spoof_english` whenever `setLocales` is called from Fenix side and sets `intl.accept_languages` accordingly. --- mobile/android/components/geckoview/GeckoViewStartup.jsm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mobile/android/components/geckoview/GeckoViewStartup.jsm b/mobile/android/components/geckoview/GeckoViewStartup.jsm index a6cbb442e862..ca746f7428a7 100644 --- a/mobile/android/components/geckoview/GeckoViewStartup.jsm +++ b/mobile/android/components/geckoview/GeckoViewStartup.jsm @@ -18,6 +18,7 @@ XPCOMUtils.defineLazyModuleGetters(this, { Preferences: "resource://gre/modules/Preferences.jsm", SafeBrowsing: "resource://gre/modules/SafeBrowsing.jsm", Services: "resource://gre/modules/Services.jsm", + RFPHelper: "resource://gre/modules/RFPHelper.jsm", }); const { debug, warn } = GeckoViewUtils.initLogging("Startup"); @@ -246,6 +247,10 @@ class GeckoViewStartup { if (aData.requestedLocales) { Services.locale.requestedLocales = aData.requestedLocales; } + RFPHelper._handleSpoofEnglishChanged(); + if (Services.prefs.getIntPref("privacy.spoof_english", 0) === 2) { + break; + } const pls = Cc["@mozilla.org/pref-localizedstring;1"].createInstance( Ci.nsIPrefLocalizedString );
1 0
0 0
[tor-browser/tor-browser-82.0-10.0-1] Bug 40199: Avoid using system locale for intl.accept_languages in GeckoView
by sysrqb@torproject.org 23 Oct '20

23 Oct '20
commit de1e216305d3d86ad9a5d925a668115e331685a2 Author: Alex Catarineu <acat(a)torproject.org> Date: Tue Oct 20 17:44:36 2020 +0200 Bug 40199: Avoid using system locale for intl.accept_languages in GeckoView --- .../mozilla/geckoview/GeckoRuntimeSettings.java | 26 +++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java index 85517821b59a..b7c080557470 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java @@ -783,19 +783,25 @@ public final class GeckoRuntimeSettings extends RuntimeSettings { private String computeAcceptLanguages() { ArrayList<String> locales = new ArrayList<String>(); - // Explicitly-set app prefs come first: - if (mRequestedLocales != null) { - for (String locale : mRequestedLocales) { - locales.add(locale.toLowerCase()); - } - } - // OS prefs come second: - for (String locale : getDefaultLocales()) { - locale = locale.toLowerCase(); - if (!locales.contains(locale)) { + // In Desktop, these are defined in the `intl.accept_languages` localized property. + // At some point we should probably use the same values here, but for now we use a simple + // strategy which will hopefully result in reasonable acceptLanguage values. + if (mRequestedLocales != null && mRequestedLocales.length > 0) { + String locale = mRequestedLocales[0].toLowerCase(); + // No need to include `en-us` twice. + if (!locale.equals("en-us")) { locales.add(locale); + if (locale.contains("-")) { + String lang = locale.split("-")[0]; + // No need to include `en` twice. + if (!lang.equals("en")) { + locales.add(lang); + } + } } } + locales.add("en-us"); + locales.add("en"); return TextUtils.join(",", locales); }
1 0
0 0
[tor-browser/tor-browser-82.0b7-10.0-1] Bug 30605: Honor privacy.spoof_english in Android
by sysrqb@torproject.org 23 Oct '20

23 Oct '20
commit ff917f5073bae12a0dd7ad1ad7c93d2236be6247 Author: Alex Catarineu <acat(a)torproject.org> Date: Fri Oct 16 10:45:17 2020 +0200 Bug 30605: Honor privacy.spoof_english in Android This checks `privacy.spoof_english` whenever `setLocales` is called from Fenix side and sets `intl.accept_languages` accordingly. --- mobile/android/components/geckoview/GeckoViewStartup.jsm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mobile/android/components/geckoview/GeckoViewStartup.jsm b/mobile/android/components/geckoview/GeckoViewStartup.jsm index a6cbb442e862..ca746f7428a7 100644 --- a/mobile/android/components/geckoview/GeckoViewStartup.jsm +++ b/mobile/android/components/geckoview/GeckoViewStartup.jsm @@ -18,6 +18,7 @@ XPCOMUtils.defineLazyModuleGetters(this, { Preferences: "resource://gre/modules/Preferences.jsm", SafeBrowsing: "resource://gre/modules/SafeBrowsing.jsm", Services: "resource://gre/modules/Services.jsm", + RFPHelper: "resource://gre/modules/RFPHelper.jsm", }); const { debug, warn } = GeckoViewUtils.initLogging("Startup"); @@ -246,6 +247,10 @@ class GeckoViewStartup { if (aData.requestedLocales) { Services.locale.requestedLocales = aData.requestedLocales; } + RFPHelper._handleSpoofEnglishChanged(); + if (Services.prefs.getIntPref("privacy.spoof_english", 0) === 2) { + break; + } const pls = Cc["@mozilla.org/pref-localizedstring;1"].createInstance( Ci.nsIPrefLocalizedString );
1 0
0 0
[tor-browser/tor-browser-82.0b7-10.0-1] Bug 40199: Avoid using system locale for intl.accept_languages in GeckoView
by sysrqb@torproject.org 23 Oct '20

23 Oct '20
commit 00d90dd2a581fb897f035d0c5620b4a3424221ec Author: Alex Catarineu <acat(a)torproject.org> Date: Tue Oct 20 17:44:36 2020 +0200 Bug 40199: Avoid using system locale for intl.accept_languages in GeckoView --- .../mozilla/geckoview/GeckoRuntimeSettings.java | 26 +++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java index 85517821b59a..b7c080557470 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java @@ -783,19 +783,25 @@ public final class GeckoRuntimeSettings extends RuntimeSettings { private String computeAcceptLanguages() { ArrayList<String> locales = new ArrayList<String>(); - // Explicitly-set app prefs come first: - if (mRequestedLocales != null) { - for (String locale : mRequestedLocales) { - locales.add(locale.toLowerCase()); - } - } - // OS prefs come second: - for (String locale : getDefaultLocales()) { - locale = locale.toLowerCase(); - if (!locales.contains(locale)) { + // In Desktop, these are defined in the `intl.accept_languages` localized property. + // At some point we should probably use the same values here, but for now we use a simple + // strategy which will hopefully result in reasonable acceptLanguage values. + if (mRequestedLocales != null && mRequestedLocales.length > 0) { + String locale = mRequestedLocales[0].toLowerCase(); + // No need to include `en-us` twice. + if (!locale.equals("en-us")) { locales.add(locale); + if (locale.contains("-")) { + String lang = locale.split("-")[0]; + // No need to include `en` twice. + if (!lang.equals("en")) { + locales.add(lang); + } + } } } + locales.add("en-us"); + locales.add("en"); return TextUtils.join(",", locales); }
1 0
0 0
[tor-browser/tor-browser-82.0b7-10.0-1] Bug 40198: Expose privacy.spoof_english pref in GeckoView
by sysrqb@torproject.org 23 Oct '20

23 Oct '20
commit fd2a780a04f59224176507e34c6f3194acb20e03 Author: Alex Catarineu <acat(a)torproject.org> Date: Sun Oct 18 17:06:04 2020 +0200 Bug 40198: Expose privacy.spoof_english pref in GeckoView --- mobile/android/geckoview/api.txt | 3 ++ .../mozilla/geckoview/GeckoRuntimeSettings.java | 33 ++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/mobile/android/geckoview/api.txt b/mobile/android/geckoview/api.txt index 9f15c8be0138..5e64688b7e47 100644 --- a/mobile/android/geckoview/api.txt +++ b/mobile/android/geckoview/api.txt @@ -577,6 +577,7 @@ package org.mozilla.geckoview { method public boolean getRemoteDebuggingEnabled(); method @Nullable public GeckoRuntime getRuntime(); method @Nullable public Rect getScreenSizeOverride(); + method public boolean getSpoofEnglish(); method @Nullable public RuntimeTelemetry.Delegate getTelemetryDelegate(); method public int getTorSecurityLevel(); method public boolean getUseMaxScreenDepth(); @@ -597,6 +598,7 @@ package org.mozilla.geckoview { method @NonNull public GeckoRuntimeSettings setLoginAutofillEnabled(boolean); method @NonNull public GeckoRuntimeSettings setPreferredColorScheme(int); method @NonNull public GeckoRuntimeSettings setRemoteDebuggingEnabled(boolean); + method @NonNull public GeckoRuntimeSettings setSpoofEnglish(boolean); method @NonNull public GeckoRuntimeSettings setTorSecurityLevel(int); method @NonNull public GeckoRuntimeSettings setWebFontsEnabled(boolean); method @NonNull public GeckoRuntimeSettings setWebManifestEnabled(boolean); @@ -632,6 +634,7 @@ package org.mozilla.geckoview { method @NonNull public GeckoRuntimeSettings.Builder preferredColorScheme(int); method @NonNull public GeckoRuntimeSettings.Builder remoteDebuggingEnabled(boolean); method @NonNull public GeckoRuntimeSettings.Builder screenSizeOverride(int, int); + method @NonNull public GeckoRuntimeSettings.Builder spoofEnglish(boolean); method @NonNull public GeckoRuntimeSettings.Builder telemetryDelegate(@NonNull RuntimeTelemetry.Delegate); method @NonNull public GeckoRuntimeSettings.Builder torSecurityLevel(int); method @NonNull public GeckoRuntimeSettings.Builder useMaxScreenDepth(boolean); diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java index 85517821b59a..e5092936bea9 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java @@ -468,6 +468,17 @@ public final class GeckoRuntimeSettings extends RuntimeSettings { getSettings().mTorSecurityLevel.set(level); return this; } + + /** + * Sets whether we should spoof locale to English for webpages. + * + * @param flag True if we should spoof locale to English for webpages, false otherwise. + * @return This Builder instance. + */ + public @NonNull Builder spoofEnglish(final boolean flag) { + getSettings().mSpoofEnglish.set(flag ? 2 : 1); + return this; + } } private GeckoRuntime mRuntime; @@ -520,6 +531,8 @@ public final class GeckoRuntimeSettings extends RuntimeSettings { "signon.autofillForms", true); /* package */ final Pref<Integer> mTorSecurityLevel = new Pref<>( "extensions.torbutton.security_slider", 4); + /* package */ final Pref<Integer> mSpoofEnglish = new Pref<>( + "privacy.spoof_english", 0); /* package */ int mPreferredColorScheme = COLOR_SCHEME_SYSTEM; @@ -1190,6 +1203,26 @@ public final class GeckoRuntimeSettings extends RuntimeSettings { return this; } + /** + * Get whether we should spoof locale to English for webpages. + * + * @return Whether we should spoof locale to English for webpages. + */ + public boolean getSpoofEnglish() { + return mSpoofEnglish.get() == 2; + } + + /** + * Set whether we should spoof locale to English for webpages. + * + * @param flag A flag determining whether we should locale to English for webpages. + * @return This GeckoRuntimeSettings instance. + */ + public @NonNull GeckoRuntimeSettings setSpoofEnglish(final boolean flag) { + mSpoofEnglish.commit(flag ? 2 : 1); + return this; + } + @Override // Parcelable public void writeToParcel(final Parcel out, final int flags) { super.writeToParcel(out, flags);
1 0
0 0
[tor-browser/tor-browser-82.0b7-10.0-1] Merge remote-tracking branch 'acatgl/40199' into tor-browser-82.0b7-10.0-1
by sysrqb@torproject.org 23 Oct '20

23 Oct '20
commit 0ab249ad7cc37ce4024a753e03dd9dc86fb03253 Merge: ff917f5073ba 00d90dd2a581 Author: Matthew Finkel <sysrqb(a)torproject.org> Date: Fri Oct 23 18:03:08 2020 +0000 Merge remote-tracking branch 'acatgl/40199' into tor-browser-82.0b7-10.0-1 .../mozilla/geckoview/GeckoRuntimeSettings.java | 26 +++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-)
1 0
0 0
[tor-browser/tor-browser-82.0b7-10.0-1] Merge remote-tracking branch 'acatgl/40198+1' into tor-browser-82.0b7-10.0-1
by sysrqb@torproject.org 23 Oct '20

23 Oct '20
commit 56077640f8acf22ba6591ded019492237d48e910 Merge: 0ab249ad7cc3 fd2a780a04f5 Author: Matthew Finkel <sysrqb(a)torproject.org> Date: Fri Oct 23 18:04:19 2020 +0000 Merge remote-tracking branch 'acatgl/40198+1' into tor-browser-82.0b7-10.0-1 mobile/android/geckoview/api.txt | 3 ++ .../mozilla/geckoview/GeckoRuntimeSettings.java | 33 ++++++++++++++++++++++ 2 files changed, 36 insertions(+)
1 0
0 0
[Git][tpo/applications/fenix][tor-browser-82.1.1-10.0-1] Bug 40087: Implement a switch for english locale spoofing
by Matthew Finkel 23 Oct '20

23 Oct '20
Matthew Finkel pushed to branch tor-browser-82.1.1-10.0-1 at The Tor Project / Applications / fenix Commits: 54f42ec4 by Alex Catarineu at 2020-10-23T17:58:56+00:00 Bug 40087: Implement a switch for english locale spoofing - - - - - 7 changed files: - app/src/main/java/org/mozilla/fenix/components/Core.kt - app/src/main/java/org/mozilla/fenix/settings/advanced/DefaultLocaleSettingsController.kt - app/src/main/java/org/mozilla/fenix/settings/advanced/LocaleSettingsFragment.kt - app/src/main/java/org/mozilla/fenix/utils/Settings.kt - app/src/main/res/layout/fragment_locale_settings.xml - app/src/main/res/values/preference_keys.xml - app/src/main/res/values/torbrowser_strings.xml Changes: ===================================== app/src/main/java/org/mozilla/fenix/components/Core.kt ===================================== @@ -93,7 +93,8 @@ class Core(private val context: Context, private val crashReporter: CrashReporti suspendMediaWhenInactive = false, forceUserScalableContent = context.settings().forceEnableZoom, loginAutofillEnabled = context.settings().shouldAutofillLogins, - torSecurityLevel = context.settings().torSecurityLevel().intRepresentation + torSecurityLevel = context.settings().torSecurityLevel().intRepresentation, + spoofEnglish = context.settings().spoofEnglish ) GeckoEngine( ===================================== app/src/main/java/org/mozilla/fenix/settings/advanced/DefaultLocaleSettingsController.kt ===================================== @@ -7,6 +7,7 @@ package org.mozilla.fenix.settings.advanced import android.app.Activity import android.content.Context import mozilla.components.support.locale.LocaleManager +import org.mozilla.fenix.ext.components import java.util.Locale interface LocaleSettingsController { @@ -55,5 +56,9 @@ class DefaultLocaleSettingsController( config.setLocale(locale) config.setLayoutDirection(locale) resources.updateConfiguration(config, resources.displayMetrics) + // A slightly hacky way of triggering a `runtime.settings.locales` update, + // so that the locales are updated in GeckoView. + val spoofEnglish = context.components.core.engine.settings.spoofEnglish + context.components.core.engine.settings.spoofEnglish = spoofEnglish } } ===================================== app/src/main/java/org/mozilla/fenix/settings/advanced/LocaleSettingsFragment.kt ===================================== @@ -20,6 +20,8 @@ import mozilla.components.support.ktx.android.view.hideKeyboard import mozilla.components.support.locale.LocaleManager import org.mozilla.fenix.R import org.mozilla.fenix.components.StoreProvider +import org.mozilla.fenix.ext.requireComponents +import org.mozilla.fenix.ext.settings import org.mozilla.fenix.ext.showToolbar class LocaleSettingsFragment : Fragment() { @@ -38,7 +40,9 @@ class LocaleSettingsFragment : Fragment() { container: ViewGroup?, savedInstanceState: Bundle? ): View? { - val view = inflater.inflate(R.layout.fragment_locale_settings, container, false) + val view = inflater.inflate(R.layout.fragment_locale_settings, container, false).also { + bindEnableSwitch(it) + } store = getStore() interactor = LocaleSettingsInteractor( @@ -51,6 +55,16 @@ class LocaleSettingsFragment : Fragment() { return view } + @SuppressWarnings("LongMethod") + private fun bindEnableSwitch(view: View) { + val switch = view.enable_switch + switch.isChecked = requireComponents.core.engine.settings.spoofEnglish + switch.setOnCheckedChangeListener { _, isChecked -> + context?.settings()?.spoofEnglish = isChecked + requireComponents.core.engine.settings.spoofEnglish = isChecked + } + } + override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { inflater.inflate(R.menu.languages_list, menu) val searchItem = menu.findItem(R.id.search) ===================================== app/src/main/java/org/mozilla/fenix/utils/Settings.kt ===================================== @@ -204,6 +204,11 @@ class Settings(private val appContext: Context) : PreferencesHolder { else -> SecurityLevel.STANDARD } + var spoofEnglish by booleanPreference( + appContext.getPreferenceKey(R.string.pref_key_spoof_english), + default = false + ) + // If any of the prefs have been modified, quit displaying the fenix moved tip fun shouldDisplayFenixMovingTip(): Boolean = preferences.getBoolean( ===================================== app/src/main/res/layout/fragment_locale_settings.xml ===================================== @@ -7,13 +7,30 @@ android:layout_width="match_parent" android:layout_height="match_parent"> + <com.google.android.material.switchmaterial.SwitchMaterial + android:id="@+id/enable_switch" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical|end" + android:background="?android:attr/selectableItemBackground" + android:checked="true" + android:clickable="true" + android:focusable="true" + android:layout_marginStart="54dp" + android:padding="16dp" + android:text="@string/tor_spoof_english" + android:textColor="?primaryText" + android:textSize="16sp" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> <FrameLayout android:id="@+id/locale_container" android:layout_width="match_parent" - android:layout_height="match_parent" + android:layout_height="0dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintTop_toBottomOf="@id/enable_switch" /> -</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file +</androidx.constraintlayout.widget.ConstraintLayout> ===================================== app/src/main/res/values/preference_keys.xml ===================================== @@ -253,4 +253,6 @@ <string name="pref_key_tor_network_settings_tor_ready">pref_key_tor_network_settings_tor_ready</string> <string name="pref_key_tor_network_settings_state">pref_key_tor_network_settings_state</string> <string name="pref_key_tor_network_settings_bridges_enabled">pref_key_tor_network_settings_bridges_enabled</string> + + <string name="pref_key_spoof_english" translatable="false">pref_key_spoof_english</string> </resources> ===================================== app/src/main/res/values/torbrowser_strings.xml ===================================== @@ -70,4 +70,6 @@ <string name="tor_security_level_safest_option">Safest</string> <string name="tor_security_level_safest_description">Only allow website features required for static sites and basic services. These changes affect images, media, and scripts.</string> + <!-- Spoof locale to English --> + <string name="tor_spoof_english">Request English versions of web pages for enhanced privacy</string> </resources> View it on GitLab: https://gitlab.torproject.org/tpo/applications/fenix/-/commit/54f42ec477b78… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/fenix/-/commit/54f42ec477b78… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • ...
  • 42
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.