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

Commits:

1 changed file:

Changes:

  • toolkit/components/securitylevel/SecurityLevel.sys.mjs
    ... ... @@ -79,6 +79,7 @@ const max_caps = [
    79 79
       "object",
    
    80 80
       "other",
    
    81 81
       "script",
    
    82
    +  "wasm",
    
    82 83
       "webgl",
    
    83 84
       "noscript",
    
    84 85
     ];
    
    ... ... @@ -247,7 +248,6 @@ var initializeNoScriptControl = () => {
    247 248
     // for each security setting. Note that 2-m and 3-m are identical,
    
    248 249
     // corresponding to the old 2-medium-high setting. We also separately
    
    249 250
     // bind NoScript settings to the browser.security_level.security_slider
    
    250
    -// (see noscript-control.js).
    
    251 251
     /* eslint-disable */
    
    252 252
     // prettier-ignore
    
    253 253
     const kSecuritySettings = {
    
    ... ... @@ -260,7 +260,9 @@ const kSecuritySettings = {
    260 260
       "gfx.font_rendering.opentype_svg.enabled": [,  false, false, false, true ],
    
    261 261
       "svg.disabled":                            [,  true,  false, false, false],
    
    262 262
       "javascript.options.asmjs":                [,  false, false, false, true ],
    
    263
    -  "javascript.options.wasm":                 [,  false, false, false, true ],
    
    263
    +  // tor-browser#44234, tor-browser#44242: this interferes with the correct
    
    264
    +  // functioning of the browser. So, WASM is also handled by NoScript now.
    
    265
    +  "javascript.options.wasm":                 [,  true,  true,  true,  true ],
    
    264 266
     };
    
    265 267
     /* eslint-enable */
    
    266 268
     
    
    ... ... @@ -327,16 +329,19 @@ var write_setting_to_prefs = function (settingIndex) {
    327 329
     // security settings matches. Otherwise return null.
    
    328 330
     var read_setting_from_prefs = function (prefNames) {
    
    329 331
       prefNames = prefNames || Object.keys(kSecuritySettings);
    
    330
    -  for (let settingIndex of [1, 2, 3, 4]) {
    
    332
    +  for (const settingIndex of [1, 2, 3, 4]) {
    
    331 333
         let possibleSetting = true;
    
    332 334
         // For the given settingIndex, check if all current pref values
    
    333 335
         // match the setting.
    
    334
    -    for (let prefName of prefNames) {
    
    335
    -      if (
    
    336
    -        kSecuritySettings[prefName][settingIndex] !==
    
    337
    -        Services.prefs.getBoolPref(prefName)
    
    338
    -      ) {
    
    336
    +    for (const prefName of prefNames) {
    
    337
    +      const wanted = kSecuritySettings[prefName][settingIndex];
    
    338
    +      const actual = Services.prefs.getBoolPref(prefName);
    
    339
    +      if (wanted !== actual) {
    
    339 340
             possibleSetting = false;
    
    341
    +        logger.info(
    
    342
    +          `${prefName} does not match level ${settingIndex}: ${actual}, should be ${wanted}!`
    
    343
    +        );
    
    344
    +        break;
    
    340 345
           }
    
    341 346
         }
    
    342 347
         if (possibleSetting) {
    
    ... ... @@ -361,7 +366,7 @@ var initializeSecurityPrefs = function () {
    361 366
       if (initializedSecPrefs) {
    
    362 367
         return;
    
    363 368
       }
    
    364
    -  logger.info("Initializing security-prefs.js");
    
    369
    +  logger.info("Initializing security level");
    
    365 370
       initializedSecPrefs = true;
    
    366 371
     
    
    367 372
       const wasCustom = Services.prefs.getBoolPref(kCustomPref, false);
    
    ... ... @@ -369,6 +374,21 @@ var initializeSecurityPrefs = function () {
    369 374
       // and it should not be custom.
    
    370 375
       let desiredIndex = Services.prefs.getIntPref(kSliderPref, 4);
    
    371 376
       desiredIndex = fixupIndex(desiredIndex);
    
    377
    +
    
    378
    +  if (!(wasCustom && desiredIndex == 4)) {
    
    379
    +    // The current level is non-customized Standard, or
    
    380
    +    // Safer / Safest (either customized or not): the global
    
    381
    +    // javascript.options.wasm pref interferes with the correct
    
    382
    +    // functioning of the browser, so instead we rely on NoScript
    
    383
    +    // to disable WebAssembly now (tor-browser#44234, tor-browser#44242).
    
    384
    +    // We skip flipping in customized Standard, because if its value was
    
    385
    +    // found false under such as circumstance, that would suggest
    
    386
    +    // an intentional user choice we don't want to interfere with.
    
    387
    +    // Unlike other javascript.options.* preferences, this one is safe
    
    388
    +    // to flip without a browser restart because it's checked whenever a
    
    389
    +    // context is created.
    
    390
    +    Services.prefs.setBoolPref("javascript.options.wasm", true);
    
    391
    +  }
    
    372 392
       // Make sure the user has a set preference user value.
    
    373 393
       Services.prefs.setIntPref(kSliderPref, desiredIndex);
    
    374 394
       Services.prefs.setBoolPref(kCustomPref, wasCustom);
    
    ... ... @@ -441,7 +461,7 @@ var initializeSecurityPrefs = function () {
    441 461
         });
    
    442 462
       }
    
    443 463
     
    
    444
    -  logger.info("security-prefs.js initialization complete");
    
    464
    +  logger.info("Security level initialization complete");
    
    445 465
     };
    
    446 466
     
    
    447 467
     // tor-browser#41460: we changed preference names in 12.0.