Pier Angelo Vendrame pushed to branch mullvad-browser-115.9.0esr-13.5-1 at The Tor Project / Applications / Mullvad Browser
Commits: a6c43d7e by Pier Angelo Vendrame at 2024-03-27T14:34:53+01:00 fixup! Bug 40925: Implemented the Security Level component
Bug 42481: Modularize SecurityLevel.
- - - - -
5 changed files:
- browser/components/securitylevel/content/securityLevel.js - toolkit/components/search/SearchEngine.sys.mjs - toolkit/components/securitylevel/SecurityLevel.jsm → toolkit/components/securitylevel/SecurityLevel.sys.mjs - toolkit/components/securitylevel/components.conf - toolkit/components/securitylevel/moz.build
Changes:
===================================== browser/components/securitylevel/content/securityLevel.js ===================================== @@ -2,11 +2,9 @@
/* global AppConstants, Services, openPreferences, XPCOMUtils */
-ChromeUtils.defineModuleGetter( - this, - "SecurityLevelPrefs", - "resource://gre/modules/SecurityLevel.jsm" -); +ChromeUtils.defineESModuleGetters(this, { + SecurityLevelPrefs: "resource://gre/modules/SecurityLevel.sys.mjs", +});
/* Security Level Button Code
===================================== toolkit/components/search/SearchEngine.sys.mjs ===================================== @@ -12,14 +12,9 @@ const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { NimbusFeatures: "resource://nimbus/ExperimentAPI.sys.mjs", SearchUtils: "resource://gre/modules/SearchUtils.sys.mjs", + SecurityLevelPrefs: "resource://gre/modules/SecurityLevel.sys.mjs", });
-ChromeUtils.defineModuleGetter( - lazy, - "SecurityLevelPrefs", - "resource://gre/modules/SecurityLevel.jsm" -); - const BinaryInputStream = Components.Constructor( "@mozilla.org/binaryinputstream;1", "nsIBinaryInputStream",
===================================== toolkit/components/securitylevel/SecurityLevel.jsm → toolkit/components/securitylevel/SecurityLevel.sys.mjs ===================================== @@ -1,17 +1,10 @@ -"use strict"; - -var EXPORTED_SYMBOLS = ["SecurityLevel", "SecurityLevelPrefs"]; - -const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"); -const { ConsoleAPI } = ChromeUtils.import("resource://gre/modules/Console.jsm"); +import { ConsoleAPI } from "resource://gre/modules/Console.sys.mjs";
const lazy = {};
-ChromeUtils.defineModuleGetter( - lazy, - "ExtensionParent", - "resource://gre/modules/ExtensionParent.jsm" -); +ChromeUtils.defineESModuleGetters(lazy, { + ExtensionParent: "resource://gre/modules/ExtensionParent.sys.mjs", +});
const logger = new ConsoleAPI({ maxLogLevel: "info", @@ -275,6 +268,7 @@ var initializeNoScriptControl = () => { // bind NoScript settings to the browser.security_level.security_slider // (see noscript-control.js). /* eslint-disable */ +// prettier-ignore const kSecuritySettings = { // Preference name : [0, 1-high 2-m 3-m 4-low] "javascript.options.ion" : [, false, false, false, true ], @@ -439,7 +433,7 @@ function migratePreferences() { }
// This class is used to initialize the security level stuff at the startup -class SecurityLevel { +export class SecurityLevel { QueryInterface = ChromeUtils.generateQI(["nsIObserver"]);
init() { @@ -460,7 +454,7 @@ class SecurityLevel {
Getters and Setters for relevant torbutton prefs */ -const SecurityLevelPrefs = { +export const SecurityLevelPrefs = { SecurityLevels: Object.freeze({ safest: 1, safer: 2,
===================================== toolkit/components/securitylevel/components.conf ===================================== @@ -4,7 +4,7 @@ Classes = [ "contract_ids": [ "@torproject.org/security-level;1", ], - "jsm": "resource://gre/modules/SecurityLevel.jsm", + "esModule": "resource://gre/modules/SecurityLevel.sys.mjs", "constructor": "SecurityLevel", } ]
===================================== toolkit/components/securitylevel/moz.build ===================================== @@ -1,5 +1,5 @@ EXTRA_JS_MODULES += [ - "SecurityLevel.jsm", + "SecurityLevel.sys.mjs", ]
XPCOM_MANIFESTS += [
View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/a6c4...
tbb-commits@lists.torproject.org