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

Commits:

1 changed file:

Changes:

  • toolkit/components/resistfingerprinting/RFPHelper.sys.mjs
    ... ... @@ -158,6 +158,9 @@ class _RFPHelper {
    158 158
         // Add RFP and Letterboxing observers if prefs are enabled
    
    159 159
         this._handleResistFingerprintingChanged();
    
    160 160
         this._handleLetterboxingPrefChanged();
    
    161
    +
    
    162
    +    // Synchronize language preferences if accidentally messed up (tor-browser#42084)
    
    163
    +    this._handleSpoofEnglishChanged();
    
    161 164
       }
    
    162 165
     
    
    163 166
       uninit() {
    
    ... ... @@ -211,6 +214,7 @@ class _RFPHelper {
    211 214
             this._handleResistFingerprintingChanged();
    
    212 215
             break;
    
    213 216
           case kPrefSpoofEnglish:
    
    217
    +      case "intl.accept_languages":
    
    214 218
             this._handleSpoofEnglishChanged();
    
    215 219
             break;
    
    216 220
           case kPrefLetterboxing:
    
    ... ... @@ -259,6 +263,7 @@ class _RFPHelper {
    259 263
       }
    
    260 264
     
    
    261 265
       _handleSpoofEnglishChanged() {
    
    266
    +    Services.prefs.removeObserver("intl.accept_languages", this);
    
    262 267
         switch (Services.prefs.getIntPref(kPrefSpoofEnglish)) {
    
    263 268
           case 0: // will prompt
    
    264 269
           // This should only happen when turning privacy.resistFingerprinting off.
    
    ... ... @@ -277,6 +282,8 @@ class _RFPHelper {
    277 282
           case 2: // spoof
    
    278 283
             Services.prefs.setCharPref("intl.accept_languages", "en-US, en");
    
    279 284
             Services.prefs.setBoolPref("javascript.use_us_english_locale", true);
    
    285
    +        // Ensure spoofing works if preferences are set out of order
    
    286
    +        Services.prefs.addObserver("intl.accept_languages", this);
    
    280 287
             break;
    
    281 288
           default:
    
    282 289
             break;