[tbb-commits] [Git][tpo/applications/tor-browser][base-browser-115.9.0esr-13.5-1] fixup! Bug 40925: Implemented the Security Level component

Pier Angelo Vendrame (@pierov) git at gitlab.torproject.org
Wed Mar 27 13:34:24 UTC 2024



Pier Angelo Vendrame pushed to branch base-browser-115.9.0esr-13.5-1 at The Tor Project / Applications / Tor Browser


Commits:
b0ff311a by Pier Angelo Vendrame at 2024-03-27T14:34:08+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",
@@ -263,6 +256,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 ],
@@ -427,7 +421,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() {
@@ -448,7 +442,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/tor-browser/-/commit/b0ff311a84cea3967b5a3c1cac889380f0869f1c

-- 
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/b0ff311a84cea3967b5a3c1cac889380f0869f1c
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/20240327/f3ca4813/attachment-0001.htm>


More information about the tbb-commits mailing list