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
3 changed files:
- browser/components/preferences/main.inc.xhtml
- browser/components/preferences/main.js
- toolkit/components/resistfingerprinting/RFPHelper.sys.mjs
Changes:
... | ... | @@ -337,6 +337,7 @@ |
337 | 337 | </hbox>
|
338 | 338 | |
339 | 339 | <hbox id="languagesBox" align="center">
|
340 | + <!--
|
|
340 | 341 | <description flex="1" control="chooseLanguage" data-l10n-id="choose-language-description"/>
|
341 | 342 | <button id="chooseLanguage"
|
342 | 343 | is="highlightable-button"
|
... | ... | @@ -351,6 +352,9 @@ |
351 | 352 | languages-customize-select-language.placeholder,
|
352 | 353 | languages-customize-add.label,
|
353 | 354 | " />
|
355 | + -->
|
|
356 | + <checkbox id="spoofEnglish"
|
|
357 | + data-l10n-id="languages-customize-spoof-english"/>
|
|
354 | 358 | </hbox>
|
355 | 359 | |
356 | 360 | <checkbox id="useSystemLocale" hidden="true"
|
... | ... | @@ -438,7 +438,23 @@ var gMainPane = { |
438 | 438 | "command",
|
439 | 439 | makeDisableControllingExtension(PREF_SETTING_TYPE, CONTAINERS_KEY)
|
440 | 440 | );
|
441 | - setEventListener("chooseLanguage", "command", gMainPane.showLanguages);
|
|
441 | + // setEventListener("chooseLanguage", "command", gMainPane.showLanguages);
|
|
442 | + {
|
|
443 | + const spoofEnglish = document.getElementById("spoofEnglish");
|
|
444 | + const kPrefSpoofEnglish = "privacy.spoof_english";
|
|
445 | + const preference = Preferences.add({
|
|
446 | + id: kPrefSpoofEnglish,
|
|
447 | + type: "int",
|
|
448 | + });
|
|
449 | + const spoofEnglishChanged = () => {
|
|
450 | + spoofEnglish.checked = preference.value == 2;
|
|
451 | + };
|
|
452 | + spoofEnglishChanged();
|
|
453 | + preference.on("change", spoofEnglishChanged);
|
|
454 | + setEventListener("spoofEnglish", "command", () => {
|
|
455 | + preference.value = spoofEnglish.checked ? 2 : 1;
|
|
456 | + });
|
|
457 | + }
|
|
442 | 458 | setEventListener(
|
443 | 459 | "translationAttributionImage",
|
444 | 460 | "click",
|
... | ... | @@ -291,9 +291,13 @@ class _RFPHelper { |
291 | 291 | ) {
|
292 | 292 | Services.prefs.clearUserPref("_javascript_.use_us_english_locale");
|
293 | 293 | }
|
294 | - // We don't reset intl.accept_languages. Instead, setting
|
|
295 | - // privacy.spoof_english to 1 allows user to change preferred language
|
|
296 | - // settings through Preferences UI.
|
|
294 | + if (this.rfpEnabled) {
|
|
295 | + // When RFP is enabled, we force intl.accept_languages to be the
|
|
296 | + // default, or en-US, en when spoof English is enabled.
|
|
297 | + // See tor-browser#41930.
|
|
298 | + Services.prefs.clearUserPref("intl.accept_languages");
|
|
299 | + Services.prefs.addObserver("intl.accept_languages", this);
|
|
300 | + }
|
|
297 | 301 | break;
|
298 | 302 | case 2: // spoof
|
299 | 303 | Services.prefs.setCharPref("intl.accept_languages", "en-US, en");
|