Pier Angelo Vendrame pushed to branch mullvad-browser-115.11.0esr-13.5-1 at The Tor Project / Applications / Mullvad Browser
Commits: f5bb3351 by Pier Angelo Vendrame at 2024-05-07T18:37:07+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/mullvad-browser/-/commit/f5bb...
tor-commits@lists.torproject.org