[tbb-commits] [Git][tpo/applications/tor-browser][tor-browser-115.2.0esr-13.0-1] Bug 42084: Ensure spoofing works even if preferences are set out of order.

ma1 (@ma1) git at gitlab.torproject.org
Tue Sep 12 08:52:07 UTC 2023



ma1 pushed to branch tor-browser-115.2.0esr-13.0-1 at The Tor Project / Applications / Tor Browser


Commits:
8cff1681 by hackademix at 2023-09-12T10:37:14+02:00
Bug 42084: Ensure spoofing works even if preferences are set out of order.

- - - - -


1 changed file:

- toolkit/components/resistfingerprinting/RFPHelper.sys.mjs


Changes:

=====================================
toolkit/components/resistfingerprinting/RFPHelper.sys.mjs
=====================================
@@ -158,6 +158,9 @@ class _RFPHelper {
     // Add RFP and Letterboxing observers if prefs are enabled
     this._handleResistFingerprintingChanged();
     this._handleLetterboxingPrefChanged();
+
+    // Synchronize language preferences if accidentally messed up (tor-browser#42084)
+    this._handleSpoofEnglishChanged();
   }
 
   uninit() {
@@ -211,6 +214,7 @@ class _RFPHelper {
         this._handleResistFingerprintingChanged();
         break;
       case kPrefSpoofEnglish:
+      case "intl.accept_languages":
         this._handleSpoofEnglishChanged();
         break;
       case kPrefLetterboxing:
@@ -259,6 +263,7 @@ class _RFPHelper {
   }
 
   _handleSpoofEnglishChanged() {
+    Services.prefs.removeObserver("intl.accept_languages", this);
     switch (Services.prefs.getIntPref(kPrefSpoofEnglish)) {
       case 0: // will prompt
       // This should only happen when turning privacy.resistFingerprinting off.
@@ -277,6 +282,8 @@ class _RFPHelper {
       case 2: // spoof
         Services.prefs.setCharPref("intl.accept_languages", "en-US, en");
         Services.prefs.setBoolPref("javascript.use_us_english_locale", true);
+        // Ensure spoofing works if preferences are set out of order
+        Services.prefs.addObserver("intl.accept_languages", this);
         break;
       default:
         break;



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

-- 
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/8cff1681b5043289085fa21e1a1927c59e5b4c47
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/20230912/91a52aad/attachment-0001.htm>


More information about the tbb-commits mailing list