diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:50 +0000 |
commit | def92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch) | |
tree | 2ef34b9ad8bb9a9220e05d60352558b15f513894 /devtools/shared/loader | |
parent | Adding debian version 125.0.3-1. (diff) | |
download | firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.tar.xz firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/shared/loader')
-rw-r--r-- | devtools/shared/loader/base-loader.sys.mjs | 8 | ||||
-rw-r--r-- | devtools/shared/loader/browser-loader.sys.mjs (renamed from devtools/shared/loader/browser-loader.js) | 19 | ||||
-rw-r--r-- | devtools/shared/loader/moz.build | 4 | ||||
-rw-r--r-- | devtools/shared/loader/worker-loader.sys.mjs (renamed from devtools/shared/loader/worker-loader.js) | 43 |
4 files changed, 29 insertions, 45 deletions
diff --git a/devtools/shared/loader/base-loader.sys.mjs b/devtools/shared/loader/base-loader.sys.mjs index ab005b81e2..c777cf3e10 100644 --- a/devtools/shared/loader/base-loader.sys.mjs +++ b/devtools/shared/loader/base-loader.sys.mjs @@ -37,9 +37,6 @@ function* getOwnIdentifiers(x) { function isJSONURI(uri) { return uri.endsWith(".json"); } -function isJSMURI(uri) { - return uri.endsWith(".jsm"); -} function isSYSMJSURI(uri) { return uri.endsWith(".sys.mjs"); } @@ -218,7 +215,7 @@ function load(loader, module) { // Utility function to normalize module `uri`s so they have `.js` extension. function normalizeExt(uri) { - if (isJSURI(uri) || isJSONURI(uri) || isJSMURI(uri) || isSYSMJSURI(uri)) { + if (isJSURI(uri) || isJSONURI(uri) || isSYSMJSURI(uri)) { return uri; } return uri + ".js"; @@ -336,9 +333,6 @@ export function Require(loader, requirer) { // If module is already cached by loader then just use it. if (uri in modules) { module = modules[uri]; - } else if (isJSMURI(uri)) { - module = modules[uri] = Module(requirement, uri); - module.exports = ChromeUtils.import(uri); } else if (isSYSMJSURI(uri)) { module = modules[uri] = Module(requirement, uri); module.exports = ChromeUtils.importESModule(uri, { diff --git a/devtools/shared/loader/browser-loader.js b/devtools/shared/loader/browser-loader.sys.mjs index f42b009e17..3ab213c5a1 100644 --- a/devtools/shared/loader/browser-loader.js +++ b/devtools/shared/loader/browser-loader.sys.mjs @@ -1,14 +1,13 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -"use strict"; -const BaseLoader = ChromeUtils.importESModule( - "resource://devtools/shared/loader/base-loader.sys.mjs" -); -const { require: devtoolsRequire, loader } = ChromeUtils.importESModule( - "resource://devtools/shared/loader/Loader.sys.mjs" -); +import * as BaseLoader from "resource://devtools/shared/loader/base-loader.sys.mjs"; +import { + require as devtoolsRequire, + loader, +} from "resource://devtools/shared/loader/Loader.sys.mjs"; + const flags = devtoolsRequire("devtools/shared/flags"); const { joinURI } = devtoolsRequire("devtools/shared/path"); const { assert } = devtoolsRequire("devtools/shared/DevToolsUtils"); @@ -81,7 +80,7 @@ const browserBasedDirsRegExp = * - loader: the Loader instance * - require: a function to require modules with */ -function BrowserLoader(options) { +export function BrowserLoader(options) { const browserLoaderBuilder = new BrowserLoaderBuilder(options); return { loader: browserLoaderBuilder.loader, @@ -233,7 +232,3 @@ BrowserLoaderBuilder.prototype = { } }, }; - -this.BrowserLoader = BrowserLoader; - -this.EXPORTED_SYMBOLS = ["BrowserLoader"]; diff --git a/devtools/shared/loader/moz.build b/devtools/shared/loader/moz.build index cda2083625..b62588c327 100644 --- a/devtools/shared/loader/moz.build +++ b/devtools/shared/loader/moz.build @@ -8,7 +8,7 @@ if CONFIG["MOZ_DEVTOOLS"] == "all": DevToolsModules( "browser-loader-mocks.js", - "browser-loader.js", + "browser-loader.sys.mjs", ) DevToolsModules( @@ -17,5 +17,5 @@ DevToolsModules( "DistinctSystemPrincipalLoader.sys.mjs", "loader-plugin-raw.sys.mjs", "Loader.sys.mjs", - "worker-loader.js", + "worker-loader.sys.mjs", ) diff --git a/devtools/shared/loader/worker-loader.js b/devtools/shared/loader/worker-loader.sys.mjs index d69ddd9d23..ea2e059a0e 100644 --- a/devtools/shared/loader/worker-loader.js +++ b/devtools/shared/loader/worker-loader.sys.mjs @@ -2,9 +2,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -"use strict"; +/* global DebuggerNotificationObserver */ -/* global worker, DebuggerNotificationObserver */ +// This module does import many attributes from the global object +/* eslint-disable mozilla/reject-global-this */ // A CommonJS module loader that is designed to run inside a worker debugger. // We can't simply use the SDK module loader, because it relies heavily on @@ -22,8 +23,6 @@ // Note: to see dump output when running inside the worker thread, you might // need to enable the browser.dom.window.dump.enabled pref. -this.EXPORTED_SYMBOLS = ["WorkerDebuggerLoader", "worker"]; - // Some notes on module ids and URLs: // // An id is either a relative id or an absolute id. An id is relative if and @@ -173,9 +172,7 @@ function WorkerDebuggerLoader(options) { } // If the url has no extension, use ".js" by default. - // Also allow loading JSMs, but they would need a shim in order to - // be loaded as a CommonJS module. (See SessionDataHelpers.jsm) - return url.endsWith(".js") || url.endsWith(".jsm") ? url : url + ".js"; + return url.endsWith(".js") ? url : url + ".js"; } /** @@ -321,8 +318,6 @@ function WorkerDebuggerLoader(options) { this.require = createRequire(); } -this.WorkerDebuggerLoader = WorkerDebuggerLoader; - var loader = { lazyGetter(object, name, lambda) { Object.defineProperty(object, name, { @@ -440,7 +435,7 @@ addDebuggerToGlobal(globalThis); Debugger, URL, createSandbox, - dump: this.dump, + dump: globalThis.dump, rpc, loadSubScript, setImmediate, @@ -450,7 +445,7 @@ addDebuggerToGlobal(globalThis); // Worker thread const requestors = []; - const scope = this; + const scope = globalThis; const xpcInspector = { get eventLoopNestLevel() { @@ -475,13 +470,13 @@ addDebuggerToGlobal(globalThis); }; return { - Debugger: this.Debugger, - URL: this.URL, - createSandbox: this.createSandbox, - dump: this.dump, - rpc: this.rpc, - loadSubScript: this.loadSubScript, - setImmediate: this.setImmediate, + Debugger: globalThis.Debugger, + URL: globalThis.URL, + createSandbox: globalThis.createSandbox, + dump: globalThis.dump, + rpc: globalThis.rpc, + loadSubScript: globalThis.loadSubScript, + setImmediate: globalThis.setImmediate, xpcInspector, }; }.call(this); @@ -490,7 +485,7 @@ addDebuggerToGlobal(globalThis); // Create the default instance of the worker loader, using the APIs we defined // above. -this.worker = new WorkerDebuggerLoader({ +export const worker = new WorkerDebuggerLoader({ createSandbox, globals: { isWorker: true, @@ -499,12 +494,12 @@ this.worker = new WorkerDebuggerLoader({ rpc, URL, setImmediate, - retrieveConsoleEvents: this.retrieveConsoleEvents, - setConsoleEventHandler: this.setConsoleEventHandler, - clearConsoleEvents: this.clearConsoleEvents, + retrieveConsoleEvents: globalThis.retrieveConsoleEvents, + setConsoleEventHandler: globalThis.setConsoleEventHandler, + clearConsoleEvents: globalThis.clearConsoleEvents, console, - btoa: this.btoa, - atob: this.atob, + btoa: globalThis.btoa, + atob: globalThis.atob, Services: Object.create(null), ChromeUtils, DebuggerNotificationObserver, |