diff options
Diffstat (limited to 'devtools/shared/loader')
-rw-r--r-- | devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs | 10 | ||||
-rw-r--r-- | devtools/shared/loader/base-loader.sys.mjs | 15 | ||||
-rw-r--r-- | devtools/shared/loader/builtin-modules.js | 26 | ||||
-rw-r--r-- | devtools/shared/loader/worker-loader.js | 2 |
4 files changed, 31 insertions, 22 deletions
diff --git a/devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs b/devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs index 06c33b8891..ad08951c5c 100644 --- a/devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs +++ b/devtools/shared/loader/DistinctSystemPrincipalLoader.sys.mjs @@ -4,12 +4,10 @@ const { DevToolsLoader } = ChromeUtils.importESModule( "resource://devtools/shared/loader/Loader.sys.mjs", - { - // `loadInDevToolsLoader` will import the loader in a special priviledged - // global created for DevTools, which will be reused as the shared global - // to load additional modules for the "DistinctSystemPrincipalLoader". - loadInDevToolsLoader: true, - } + // `global: "devtools"` will import the loader in a special priviledged + // global created for DevTools, which will be reused as the shared global + // to load additional modules for the "DistinctSystemPrincipalLoader". + { global: "devtools" } ); // When debugging system principal resources (JSMs, chrome documents, ...) diff --git a/devtools/shared/loader/base-loader.sys.mjs b/devtools/shared/loader/base-loader.sys.mjs index b9d625f3e3..ab005b81e2 100644 --- a/devtools/shared/loader/base-loader.sys.mjs +++ b/devtools/shared/loader/base-loader.sys.mjs @@ -20,9 +20,13 @@ XPCOMUtils.defineLazyServiceGetter( "nsIResProtocolHandler" ); -ChromeUtils.defineESModuleGetters(lazy, { - NetUtil: "resource://gre/modules/NetUtil.sys.mjs", -}); +ChromeUtils.defineESModuleGetters( + lazy, + { + NetUtil: "resource://gre/modules/NetUtil.sys.mjs", + }, + { global: "contextual" } +); // Define some shortcuts. function* getOwnIdentifiers(x) { @@ -115,6 +119,7 @@ function Sandbox(options) { "ChromeUtils", "CSS", "CSSRule", + "CustomStateSet", "DOMParser", "Element", "Event", @@ -336,7 +341,9 @@ export function Require(loader, requirer) { module.exports = ChromeUtils.import(uri); } else if (isSYSMJSURI(uri)) { module = modules[uri] = Module(requirement, uri); - module.exports = ChromeUtils.importESModule(uri); + module.exports = ChromeUtils.importESModule(uri, { + global: "contextual", + }); } else if (isJSONURI(uri)) { let data; diff --git a/devtools/shared/loader/builtin-modules.js b/devtools/shared/loader/builtin-modules.js index 7dc04e5e98..ced6978d6f 100644 --- a/devtools/shared/loader/builtin-modules.js +++ b/devtools/shared/loader/builtin-modules.js @@ -125,7 +125,8 @@ defineLazyGetter(exports.modules, "Debugger", () => { return global.Debugger; } const { addDebuggerToGlobal } = ChromeUtils.importESModule( - "resource://gre/modules/jsdebugger.sys.mjs" + "resource://gre/modules/jsdebugger.sys.mjs", + { global: "contextual" } ); addDebuggerToGlobal(global); return global.Debugger; @@ -141,7 +142,8 @@ defineLazyGetter(exports.modules, "ChromeDebugger", () => { }); const { addDebuggerToGlobal } = ChromeUtils.importESModule( - "resource://gre/modules/jsdebugger.sys.mjs" + "resource://gre/modules/jsdebugger.sys.mjs", + { global: "contextual" } ); addDebuggerToGlobal(debuggerSandbox); return debuggerSandbox.Debugger; @@ -183,20 +185,24 @@ function lazyGlobal(name, getter) { // Lazily define a few things so that the corresponding modules are only loaded // when used. lazyGlobal("clearTimeout", () => { - return ChromeUtils.importESModule("resource://gre/modules/Timer.sys.mjs") - .clearTimeout; + return ChromeUtils.importESModule("resource://gre/modules/Timer.sys.mjs", { + global: "contextual", + }).clearTimeout; }); lazyGlobal("setTimeout", () => { - return ChromeUtils.importESModule("resource://gre/modules/Timer.sys.mjs") - .setTimeout; + return ChromeUtils.importESModule("resource://gre/modules/Timer.sys.mjs", { + global: "contextual", + }).setTimeout; }); lazyGlobal("clearInterval", () => { - return ChromeUtils.importESModule("resource://gre/modules/Timer.sys.mjs") - .clearInterval; + return ChromeUtils.importESModule("resource://gre/modules/Timer.sys.mjs", { + global: "contextual", + }).clearInterval; }); lazyGlobal("setInterval", () => { - return ChromeUtils.importESModule("resource://gre/modules/Timer.sys.mjs") - .setInterval; + return ChromeUtils.importESModule("resource://gre/modules/Timer.sys.mjs", { + global: "contextual", + }).setInterval; }); lazyGlobal("WebSocket", () => { return Services.appShell.hiddenDOMWindow.WebSocket; diff --git a/devtools/shared/loader/worker-loader.js b/devtools/shared/loader/worker-loader.js index 4d8ff61bc7..d69ddd9d23 100644 --- a/devtools/shared/loader/worker-loader.js +++ b/devtools/shared/loader/worker-loader.js @@ -528,8 +528,6 @@ this.worker = new WorkerDebuggerLoader({ // ⚠ DISCUSSION ON DEV-DEVELOPER-TOOLS REQUIRED BEFORE MODIFYING ⚠ devtools: "resource://devtools", // ⚠ DISCUSSION ON DEV-DEVELOPER-TOOLS REQUIRED BEFORE MODIFYING ⚠ - promise: "resource://gre/modules/Promise-backend.js", - // ⚠ DISCUSSION ON DEV-DEVELOPER-TOOLS REQUIRED BEFORE MODIFYING ⚠ "xpcshell-test": "resource://test", // ⚠ DISCUSSION ON DEV-DEVELOPER-TOOLS REQUIRED BEFORE MODIFYING ⚠ }, |