... |
... |
@@ -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
|
];
|
... |
... |
@@ -259,7 +260,6 @@ var initializeNoScriptControl = () => { |
259
|
260
|
// for each security setting. Note that 2-m and 3-m are identical,
|
260
|
261
|
// corresponding to the old 2-medium-high setting. We also separately
|
261
|
262
|
// bind NoScript settings to the browser.security_level.security_slider
|
262
|
|
-// (see noscript-control.js).
|
263
|
263
|
/* eslint-disable */
|
264
|
264
|
// prettier-ignore
|
265
|
265
|
const kSecuritySettings = {
|
... |
... |
@@ -272,7 +272,9 @@ const kSecuritySettings = { |
272
|
272
|
"gfx.font_rendering.opentype_svg.enabled": [, false, false, false, true ],
|
273
|
273
|
"svg.disabled": [, true, false, false, false],
|
274
|
274
|
"javascript.options.asmjs": [, false, false, false, true ],
|
275
|
|
- "javascript.options.wasm": [, false, false, false, true ],
|
|
275
|
+ // tor-browser#44234, tor-browser#44242: this interferes with the correct
|
|
276
|
+ // functioning of the browser. So, WASM is also handled by NoScript now.
|
|
277
|
+ "javascript.options.wasm": [, true, true, true, true ],
|
276
|
278
|
};
|
277
|
279
|
/* eslint-enable */
|
278
|
280
|
|
... |
... |
@@ -339,16 +341,19 @@ var write_setting_to_prefs = function (settingIndex) { |
339
|
341
|
// security settings matches. Otherwise return null.
|
340
|
342
|
var read_setting_from_prefs = function (prefNames) {
|
341
|
343
|
prefNames = prefNames || Object.keys(kSecuritySettings);
|
342
|
|
- for (let settingIndex of [1, 2, 3, 4]) {
|
|
344
|
+ for (const settingIndex of [1, 2, 3, 4]) {
|
343
|
345
|
let possibleSetting = true;
|
344
|
346
|
// For the given settingIndex, check if all current pref values
|
345
|
347
|
// match the setting.
|
346
|
|
- for (let prefName of prefNames) {
|
347
|
|
- if (
|
348
|
|
- kSecuritySettings[prefName][settingIndex] !==
|
349
|
|
- Services.prefs.getBoolPref(prefName)
|
350
|
|
- ) {
|
|
348
|
+ for (const prefName of prefNames) {
|
|
349
|
+ const wanted = kSecuritySettings[prefName][settingIndex];
|
|
350
|
+ const actual = Services.prefs.getBoolPref(prefName);
|
|
351
|
+ if (wanted !== actual) {
|
351
|
352
|
possibleSetting = false;
|
|
353
|
+ logger.info(
|
|
354
|
+ `${prefName} does not match level ${settingIndex}: ${actual}, should be ${wanted}!`
|
|
355
|
+ );
|
|
356
|
+ break;
|
352
|
357
|
}
|
353
|
358
|
}
|
354
|
359
|
if (possibleSetting) {
|
... |
... |
@@ -373,7 +378,7 @@ var initializeSecurityPrefs = function () { |
373
|
378
|
if (initializedSecPrefs) {
|
374
|
379
|
return;
|
375
|
380
|
}
|
376
|
|
- logger.info("Initializing security-prefs.js");
|
|
381
|
+ logger.info("Initializing security level");
|
377
|
382
|
initializedSecPrefs = true;
|
378
|
383
|
|
379
|
384
|
const wasCustom = Services.prefs.getBoolPref(kCustomPref, false);
|
... |
... |
@@ -381,6 +386,21 @@ var initializeSecurityPrefs = function () { |
381
|
386
|
// and it should not be custom.
|
382
|
387
|
let desiredIndex = Services.prefs.getIntPref(kSliderPref, 4);
|
383
|
388
|
desiredIndex = fixupIndex(desiredIndex);
|
|
389
|
+
|
|
390
|
+ if (!(wasCustom && desiredIndex == 4)) {
|
|
391
|
+ // The current level is non-customized Standard, or
|
|
392
|
+ // Safer / Safest (either customized or not): the global
|
|
393
|
+ // javascript.options.wasm pref interferes with the correct
|
|
394
|
+ // functioning of the browser, so instead we rely on NoScript
|
|
395
|
+ // to disable WebAssembly now (tor-browser#44234, tor-browser#44242).
|
|
396
|
+ // We skip flipping in customized Standard, because if its value was
|
|
397
|
+ // found false under such as circumstance, that would suggest
|
|
398
|
+ // an intentional user choice we don't want to interfere with.
|
|
399
|
+ // Unlike other javascript.options.* preferences, this one is safe
|
|
400
|
+ // to flip without a browser restart because it's checked whenever a
|
|
401
|
+ // context is created.
|
|
402
|
+ Services.prefs.setBoolPref("javascript.options.wasm", true);
|
|
403
|
+ }
|
384
|
404
|
// Make sure the user has a set preference user value.
|
385
|
405
|
Services.prefs.setIntPref(kSliderPref, desiredIndex);
|
386
|
406
|
Services.prefs.setBoolPref(kCustomPref, wasCustom);
|
... |
... |
@@ -453,7 +473,7 @@ var initializeSecurityPrefs = function () { |
453
|
473
|
});
|
454
|
474
|
}
|
455
|
475
|
|
456
|
|
- logger.info("security-prefs.js initialization complete");
|
|
476
|
+ logger.info("Security level initialization complete");
|
457
|
477
|
};
|
458
|
478
|
|
459
|
479
|
// tor-browser#41460: we changed preference names in 12.0.
|