[tbb-commits] [Git][tpo/applications/tor-browser][base-browser-115.11.0esr-13.5-1] Bug 41930: Remove the UI to customize accept_languages.

Pier Angelo Vendrame (@pierov) git at gitlab.torproject.org
Tue May 7 16:38:36 UTC 2024



Pier Angelo Vendrame pushed to branch base-browser-115.11.0esr-13.5-1 at The Tor Project / Applications / Tor Browser


Commits:
220844d2 by Pier Angelo Vendrame at 2024-05-07T18:38:25+02:00
Bug 41930: Remove the UI to customize accept_languages.

- - - - -


3 changed files:

- browser/components/preferences/main.inc.xhtml
- browser/components/preferences/main.js
- toolkit/components/resistfingerprinting/RFPHelper.sys.mjs


Changes:

=====================================
browser/components/preferences/main.inc.xhtml
=====================================
@@ -337,6 +337,7 @@
   </hbox>
 
   <hbox id="languagesBox" align="center">
+    <!--
     <description flex="1" control="chooseLanguage" data-l10n-id="choose-language-description"/>
     <button id="chooseLanguage"
             is="highlightable-button"
@@ -351,6 +352,9 @@
               languages-customize-select-language.placeholder,
               languages-customize-add.label,
             " />
+    -->
+    <checkbox id="spoofEnglish"
+              data-l10n-id="languages-customize-spoof-english"/>
   </hbox>
 
   <checkbox id="useSystemLocale" hidden="true"


=====================================
browser/components/preferences/main.js
=====================================
@@ -438,7 +438,23 @@ var gMainPane = {
       "command",
       makeDisableControllingExtension(PREF_SETTING_TYPE, CONTAINERS_KEY)
     );
-    setEventListener("chooseLanguage", "command", gMainPane.showLanguages);
+    // setEventListener("chooseLanguage", "command", gMainPane.showLanguages);
+    {
+      const spoofEnglish = document.getElementById("spoofEnglish");
+      const kPrefSpoofEnglish = "privacy.spoof_english";
+      const preference = Preferences.add({
+        id: kPrefSpoofEnglish,
+        type: "int",
+      });
+      const spoofEnglishChanged = () => {
+        spoofEnglish.checked = preference.value == 2;
+      };
+      spoofEnglishChanged();
+      preference.on("change", spoofEnglishChanged);
+      setEventListener("spoofEnglish", "command", () => {
+        preference.value = spoofEnglish.checked ? 2 : 1;
+      });
+    }
     setEventListener(
       "translationAttributionImage",
       "click",


=====================================
toolkit/components/resistfingerprinting/RFPHelper.sys.mjs
=====================================
@@ -291,9 +291,13 @@ class _RFPHelper {
         ) {
           Services.prefs.clearUserPref("javascript.use_us_english_locale");
         }
-        // We don't reset intl.accept_languages. Instead, setting
-        // privacy.spoof_english to 1 allows user to change preferred language
-        // settings through Preferences UI.
+        if (this.rfpEnabled) {
+          // When RFP is enabled, we force intl.accept_languages to be the
+          // default, or en-US, en when spoof English is enabled.
+          // See tor-browser#41930.
+          Services.prefs.clearUserPref("intl.accept_languages");
+          Services.prefs.addObserver("intl.accept_languages", this);
+        }
         break;
       case 2: // spoof
         Services.prefs.setCharPref("intl.accept_languages", "en-US, en");



View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/220844d256f76d7b47becccd306228fed4f37e97

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/220844d256f76d7b47becccd306228fed4f37e97
You're receiving this email because of your account on gitlab.torproject.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tbb-commits/attachments/20240507/dbe5adba/attachment-0001.htm>


More information about the tbb-commits mailing list