From 573f380bafac956ba420ec46fa7e5b7bb388f5dd Mon Sep 17 00:00:00 2001 From: Alexandre Poirot Date: Fri, 9 Sep 2022 07:22:51 +0000 Subject: [PATCH] Bug 1789202 - [devtools] Expose ChromeUtils as a global to all DevTools modules. r=perftest-reviewers,nchevobbe,AlexandruIonescu This will help transition to ES Modules as this symbol is exposed to them. $ sed -ie "/require(.ChromeUtils.)/d" $(git grep -l 'require("ChromeUtils")' devtools/) $ sed -ie "/loader.lazyRequireGetter(this, .ChromeUtils./d" $(git grep -l 'loader.lazyRequireGetter(this, "ChromeUtils"' devtools/) + the edition of builtin-modules.js + eslintrc.js + manual eslint fixes Differential Revision: https://phabricator.services.mozilla.com/D156402 --- devtools/client/framework/devtools-browser.js | 2 -- devtools/client/framework/devtools.js | 1 - devtools/client/framework/toolbox.js | 1 - devtools/client/fronts/node.js | 1 - .../client/inspector/shared/compatibility-user-settings.js | 1 - devtools/client/jsonview/converter-child.js | 1 - devtools/client/memory/panel.js | 1 - devtools/client/menus.js | 1 - devtools/client/performance-new/browser.js | 1 - devtools/client/shared/devices.js | 1 - devtools/client/shared/redux/middleware/performance-marker.js | 1 - devtools/client/shared/remote-debugging/adb/adb-socket.js | 1 - devtools/client/shared/test-helpers/shared-jest.config.js | 2 +- devtools/client/shared/test-helpers/shared-node-helpers.js | 1 + devtools/client/shared/test/highlighter-test-actor.js | 1 - .../shared/widgets/tooltip/css-compatibility-tooltip-helper.js | 1 - devtools/client/webconsole/test/node/mocha-test-setup.js | 3 +-- devtools/client/webconsole/webconsole-ui.js | 1 - devtools/server/actors/addon/webextension-inspected-window.js | 1 - devtools/server/actors/highlighters.js | 1 - devtools/server/actors/inspector/node-picker.js | 1 - devtools/server/actors/network-monitor/channel-event-sink.js | 1 - devtools/server/actors/network-monitor/network-observer.js | 1 - .../server/actors/network-monitor/network-response-listener.js | 1 - devtools/server/actors/object/property-iterator.js | 1 - devtools/server/actors/reflow.js | 1 - .../server/actors/resources/parent-process-document-event.js | 1 - .../actors/resources/utils/nsi-console-listener-watcher.js | 1 - devtools/server/actors/style-rule.js | 2 -- devtools/server/actors/targets/window-global.js | 1 - devtools/server/actors/webconsole.js | 1 - devtools/server/actors/webconsole/listeners/console-api.js | 1 - .../actors/webconsole/listeners/console-file-activity.js | 1 - devtools/server/actors/webconsole/listeners/console-reflow.js | 1 - devtools/server/actors/webconsole/listeners/console-service.js | 1 - devtools/server/actors/webconsole/listeners/document-events.js | 1 - devtools/server/actors/worker/service-worker-registration.js | 1 - devtools/server/performance/memory.js | 1 - devtools/server/tests/browser/setup-in-parent.js | 2 -- devtools/shared/commands/commands-factory.js | 1 - devtools/shared/layout/utils.js | 1 - devtools/shared/loader/builtin-modules.js | 2 +- devtools/shared/loader/worker-loader.js | 2 +- devtools/shared/protocol/Actor.js | 1 - devtools/shared/protocol/Front.js | 1 - devtools/shared/protocol/Front/FrontClassWithSpec.js | 1 - devtools/shared/test-helpers/allocation-tracker.js | 1 - devtools/shared/webconsole/network-helper.js | 1 - devtools/shared/webconsole/throttle.js | 1 - testing/talos/talos/tests/devtools/addon/content/damp.js | 1 - .../devtools/addon/content/tests/toolbox/browser-toolbox.js | 1 - 51 files changed, 5 insertions(+), 54 deletions(-) diff --git a/devtools/client/framework/devtools-browser.js b/devtools/client/framework/devtools-browser.js index 90305e0e5295..750239566af7 100644 --- a/devtools/client/framework/devtools-browser.js +++ b/devtools/client/framework/devtools-browser.js @@ -12,8 +12,6 @@ * browser window is ready (i.e. fired browser-delayed-startup-finished event) **/ -const ChromeUtils = require("ChromeUtils"); - const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { BrowserToolboxLauncher: diff --git a/devtools/client/framework/devtools.js b/devtools/client/framework/devtools.js index b92cd52239d8..3df59f0fa4a5 100644 --- a/devtools/client/framework/devtools.js +++ b/devtools/client/framework/devtools.js @@ -5,7 +5,6 @@ "use strict"; const { Cu } = require("chrome"); -const ChromeUtils = require("ChromeUtils"); const { DevToolsShim, diff --git a/devtools/client/framework/toolbox.js b/devtools/client/framework/toolbox.js index 91c3fb938b54..fbba4fff4925 100644 --- a/devtools/client/framework/toolbox.js +++ b/devtools/client/framework/toolbox.js @@ -27,7 +27,6 @@ var { Ci, Cc } = require("chrome"); const { debounce } = require("devtools/shared/debounce"); const { throttle } = require("devtools/shared/throttle"); const { safeAsyncMethod } = require("devtools/shared/async-utils"); -var ChromeUtils = require("ChromeUtils"); var { gDevTools } = require("devtools/client/framework/devtools"); var EventEmitter = require("devtools/shared/event-emitter"); const Selection = require("devtools/client/framework/selection"); diff --git a/devtools/client/fronts/node.js b/devtools/client/fronts/node.js index 2c87691c7f85..c2cd013fc9da 100644 --- a/devtools/client/fronts/node.js +++ b/devtools/client/fronts/node.js @@ -18,7 +18,6 @@ loader.lazyRequireGetter( "devtools/shared/dom-node-constants" ); -const ChromeUtils = require("ChromeUtils"); const { XPCOMUtils } = ChromeUtils.importESModule( "resource://gre/modules/XPCOMUtils.sys.mjs" ); diff --git a/devtools/client/inspector/shared/compatibility-user-settings.js b/devtools/client/inspector/shared/compatibility-user-settings.js index b99e7fafdec4..c1e41dda9b9e 100644 --- a/devtools/client/inspector/shared/compatibility-user-settings.js +++ b/devtools/client/inspector/shared/compatibility-user-settings.js @@ -4,7 +4,6 @@ "use strict"; -const ChromeUtils = require("ChromeUtils"); const { RemoteSettings } = ChromeUtils.import( "resource://services-settings/remote-settings.js" ); diff --git a/devtools/client/jsonview/converter-child.js b/devtools/client/jsonview/converter-child.js index f54d12753733..632ea49d95b1 100644 --- a/devtools/client/jsonview/converter-child.js +++ b/devtools/client/jsonview/converter-child.js @@ -5,7 +5,6 @@ "use strict"; const { components, Ci, Cr, Cu, CC } = require("chrome"); -const ChromeUtils = require("ChromeUtils"); loader.lazyRequireGetter( this, diff --git a/devtools/client/memory/panel.js b/devtools/client/memory/panel.js index 89dd3c7ddd26..1c4d1655639b 100644 --- a/devtools/client/memory/panel.js +++ b/devtools/client/memory/panel.js @@ -5,7 +5,6 @@ "use strict"; const EventEmitter = require("devtools/shared/event-emitter"); -const ChromeUtils = require("ChromeUtils"); const HeapAnalysesClient = require("devtools/shared/heapsnapshot/HeapAnalysesClient"); function MemoryPanel(iframeWindow, toolbox, commands) { diff --git a/devtools/client/menus.js b/devtools/client/menus.js index ab31526e8c14..5e2f4801cdcf 100644 --- a/devtools/client/menus.js +++ b/devtools/client/menus.js @@ -26,7 +26,6 @@ */ const { Cu } = require("chrome"); -const ChromeUtils = require("ChromeUtils"); const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { diff --git a/devtools/client/performance-new/browser.js b/devtools/client/performance-new/browser.js index 3b1c36e81b7d..42078876662a 100644 --- a/devtools/client/performance-new/browser.js +++ b/devtools/client/performance-new/browser.js @@ -21,7 +21,6 @@ * * @typedef {import("./@types/perf").ProfilerViewMode} ProfilerViewMode */ -const ChromeUtils = require("ChromeUtils"); const { createLazyLoaders } = ChromeUtils.import( "resource://devtools/client/performance-new/typescript-lazy-load.jsm.js" ); diff --git a/devtools/client/shared/devices.js b/devtools/client/shared/devices.js index 609104d3785c..f0ce19755fd4 100644 --- a/devtools/client/shared/devices.js +++ b/devtools/client/shared/devices.js @@ -9,7 +9,6 @@ const L10N = new LocalizationHelper( "devtools/client/locales/device.properties" ); -const ChromeUtils = require("ChromeUtils"); const { RemoteSettings } = ChromeUtils.import( "resource://services-settings/remote-settings.js" ); diff --git a/devtools/client/shared/redux/middleware/performance-marker.js b/devtools/client/shared/redux/middleware/performance-marker.js index 855205f5cc4e..0ddeb6fdd4bc 100644 --- a/devtools/client/shared/redux/middleware/performance-marker.js +++ b/devtools/client/shared/redux/middleware/performance-marker.js @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; -const ChromeUtils = require("ChromeUtils"); const { Cu } = require("chrome"); /** diff --git a/devtools/client/shared/remote-debugging/adb/adb-socket.js b/devtools/client/shared/remote-debugging/adb/adb-socket.js index 5080dfaf08f3..b31b89abb2ba 100644 --- a/devtools/client/shared/remote-debugging/adb/adb-socket.js +++ b/devtools/client/shared/remote-debugging/adb/adb-socket.js @@ -4,7 +4,6 @@ "use strict"; -const ChromeUtils = require("ChromeUtils"); const { Cu } = require("chrome"); const { dumpn } = require("devtools/shared/DevToolsUtils"); diff --git a/devtools/client/shared/test-helpers/shared-jest.config.js b/devtools/client/shared/test-helpers/shared-jest.config.js index e98ee2d504a9..7e3a0090c384 100644 --- a/devtools/client/shared/test-helpers/shared-jest.config.js +++ b/devtools/client/shared/test-helpers/shared-jest.config.js @@ -15,10 +15,10 @@ module.exports = { "^devtools/shared/DevToolsUtils": `${fixturesDir}/devtools-utils`, // This is needed for the Debugger, for some reason "shared/DevToolsUtils$": `${fixturesDir}/devtools-utils`, - "^ChromeUtils": `${fixturesDir}/ChromeUtils`, // Mocks only used by node tests. "Services-mock": `${fixturesDir}/Services`, + "ChromeUtils-mock": `${fixturesDir}/ChromeUtils`, "^promise": `${fixturesDir}/promise`, "^chrome": `${fixturesDir}/Chrome`, diff --git a/devtools/client/shared/test-helpers/shared-node-helpers.js b/devtools/client/shared/test-helpers/shared-node-helpers.js index 52c7301514f1..114bdb720e15 100644 --- a/devtools/client/shared/test-helpers/shared-node-helpers.js +++ b/devtools/client/shared/test-helpers/shared-node-helpers.js @@ -11,6 +11,7 @@ */ function setMocksInGlobal() { global.Services = require("Services-mock"); + global.ChromeUtils = require("ChromeUtils-mock"); global.isWorker = false; diff --git a/devtools/client/shared/test/highlighter-test-actor.js b/devtools/client/shared/test/highlighter-test-actor.js index ee3d3df8b75f..11d451ce9034 100644 --- a/devtools/client/shared/test/highlighter-test-actor.js +++ b/devtools/client/shared/test/highlighter-test-actor.js @@ -26,7 +26,6 @@ Services.scriptloader.loadSubScript( EventUtils ); -var ChromeUtils = require("ChromeUtils"); const { TestUtils } = ChromeUtils.import( "resource://testing-common/TestUtils.jsm" ); diff --git a/devtools/client/shared/widgets/tooltip/css-compatibility-tooltip-helper.js b/devtools/client/shared/widgets/tooltip/css-compatibility-tooltip-helper.js index 92d9475886f9..4d2c609abb79 100644 --- a/devtools/client/shared/widgets/tooltip/css-compatibility-tooltip-helper.js +++ b/devtools/client/shared/widgets/tooltip/css-compatibility-tooltip-helper.js @@ -4,7 +4,6 @@ "use strict"; -const ChromeUtils = require("ChromeUtils"); const { BrowserLoader } = ChromeUtils.import( "resource://devtools/shared/loader/browser-loader.js" ); diff --git a/devtools/client/webconsole/test/node/mocha-test-setup.js b/devtools/client/webconsole/test/node/mocha-test-setup.js index edb238553807..cfca116fb463 100644 --- a/devtools/client/webconsole/test/node/mocha-test-setup.js +++ b/devtools/client/webconsole/test/node/mocha-test-setup.js @@ -106,6 +106,7 @@ global.Services = require(mcRoot + global.ChromeUtils = { import: () => {}, defineModuleGetter: () => {}, + addProfilerMarker: () => {}, }; global.Cu = { isInAutomation: true }; @@ -139,8 +140,6 @@ requireHacker.global_hook("default", (path, module) => { chrome: () => `module.exports = { Cc: {}, Ci: {}, Cu: { now: () => {}}, components: {stack: {caller: ""}} }`, - ChromeUtils: () => - `module.exports = { addProfilerMarker: () => {}, import: () => ({}) }`, // Some modules depend on Chrome APIs which don't work in mocha. When such a module // is required, replace it with a mock version. "devtools/server/devtools-server": () => diff --git a/devtools/client/webconsole/webconsole-ui.js b/devtools/client/webconsole/webconsole-ui.js index b5de62c1792d..16cf23a5bcb3 100644 --- a/devtools/client/webconsole/webconsole-ui.js +++ b/devtools/client/webconsole/webconsole-ui.js @@ -8,7 +8,6 @@ const EventEmitter = require("devtools/shared/event-emitter"); const KeyShortcuts = require("devtools/client/shared/key-shortcuts"); const { l10n } = require("devtools/client/webconsole/utils/messages"); -var ChromeUtils = require("ChromeUtils"); const { BrowserLoader } = ChromeUtils.import( "resource://devtools/shared/loader/browser-loader.js" ); diff --git a/devtools/server/actors/addon/webextension-inspected-window.js b/devtools/server/actors/addon/webextension-inspected-window.js index 5aa0a2cdb0f2..343abaafb484 100644 --- a/devtools/server/actors/addon/webextension-inspected-window.js +++ b/devtools/server/actors/addon/webextension-inspected-window.js @@ -9,7 +9,6 @@ const protocol = require("devtools/shared/protocol"); const { Cc, Ci, Cu, Cr } = require("chrome"); const { DevToolsServer } = require("devtools/server/devtools-server"); -const ChromeUtils = require("ChromeUtils"); loader.lazyGetter( this, diff --git a/devtools/server/actors/highlighters.js b/devtools/server/actors/highlighters.js index d6509e2b6ec1..6e48a76350b3 100644 --- a/devtools/server/actors/highlighters.js +++ b/devtools/server/actors/highlighters.js @@ -6,7 +6,6 @@ const { Ci, Cu } = require("chrome"); -const ChromeUtils = require("ChromeUtils"); const EventEmitter = require("devtools/shared/event-emitter"); const protocol = require("devtools/shared/protocol"); const { customHighlighterSpec } = require("devtools/shared/specs/highlighters"); diff --git a/devtools/server/actors/inspector/node-picker.js b/devtools/server/actors/inspector/node-picker.js index 849c22ed3ed4..778f7097a94f 100644 --- a/devtools/server/actors/inspector/node-picker.js +++ b/devtools/server/actors/inspector/node-picker.js @@ -5,7 +5,6 @@ "use strict"; const { Ci } = require("chrome"); -loader.lazyRequireGetter(this, "ChromeUtils"); loader.lazyRequireGetter( this, "isRemoteBrowserElement", diff --git a/devtools/server/actors/network-monitor/channel-event-sink.js b/devtools/server/actors/network-monitor/channel-event-sink.js index 29ac70103606..ea700f2a493b 100644 --- a/devtools/server/actors/network-monitor/channel-event-sink.js +++ b/devtools/server/actors/network-monitor/channel-event-sink.js @@ -5,7 +5,6 @@ "use strict"; const { Cc, Ci, Cm, Cr, components } = require("chrome"); -const ChromeUtils = require("ChromeUtils"); const { ComponentUtils } = require("resource://gre/modules/ComponentUtils.jsm"); /** diff --git a/devtools/server/actors/network-monitor/network-observer.js b/devtools/server/actors/network-monitor/network-observer.js index 7053f244e06e..aa73b7f9afb0 100644 --- a/devtools/server/actors/network-monitor/network-observer.js +++ b/devtools/server/actors/network-monitor/network-observer.js @@ -13,7 +13,6 @@ const DEBUG_PLATFORM_EVENTS = false; const { Cc, Ci } = require("chrome"); -const ChromeUtils = require("ChromeUtils"); loader.lazyRequireGetter( this, diff --git a/devtools/server/actors/network-monitor/network-response-listener.js b/devtools/server/actors/network-monitor/network-response-listener.js index 48bca12ffa81..aa8683b62986 100644 --- a/devtools/server/actors/network-monitor/network-response-listener.js +++ b/devtools/server/actors/network-monitor/network-response-listener.js @@ -5,7 +5,6 @@ "use strict"; const { Cc, Ci, Cr, components: Components } = require("chrome"); -const ChromeUtils = require("ChromeUtils"); loader.lazyRequireGetter( this, diff --git a/devtools/server/actors/object/property-iterator.js b/devtools/server/actors/object/property-iterator.js index c78c20a62485..e45775520472 100644 --- a/devtools/server/actors/object/property-iterator.js +++ b/devtools/server/actors/object/property-iterator.js @@ -10,7 +10,6 @@ const protocol = require("devtools/shared/protocol"); const { propertyIteratorSpec, } = require("devtools/shared/specs/property-iterator"); -loader.lazyRequireGetter(this, "ChromeUtils"); loader.lazyRequireGetter( this, "ObjectUtils", diff --git a/devtools/server/actors/reflow.js b/devtools/server/actors/reflow.js index 7a1089debec5..4eb790ed63b6 100644 --- a/devtools/server/actors/reflow.js +++ b/devtools/server/actors/reflow.js @@ -24,7 +24,6 @@ * These dedicated classes are used by the LayoutChangesObserver. */ -const ChromeUtils = require("ChromeUtils"); const protocol = require("devtools/shared/protocol"); const EventEmitter = require("devtools/shared/event-emitter"); const { reflowSpec } = require("devtools/shared/specs/reflow"); diff --git a/devtools/server/actors/resources/parent-process-document-event.js b/devtools/server/actors/resources/parent-process-document-event.js index aad99149d655..82a26fca4ad5 100644 --- a/devtools/server/actors/resources/parent-process-document-event.js +++ b/devtools/server/actors/resources/parent-process-document-event.js @@ -8,7 +8,6 @@ const { TYPES: { DOCUMENT_EVENT }, } = require("devtools/server/actors/resources/index"); const { Ci } = require("chrome"); -const ChromeUtils = require("ChromeUtils"); const isEveryFrameTargetEnabled = Services.prefs.getBoolPref( "devtools.every-frame-target.enabled", false diff --git a/devtools/server/actors/resources/utils/nsi-console-listener-watcher.js b/devtools/server/actors/resources/utils/nsi-console-listener-watcher.js index b3e6e73417ca..187091b91992 100644 --- a/devtools/server/actors/resources/utils/nsi-console-listener-watcher.js +++ b/devtools/server/actors/resources/utils/nsi-console-listener-watcher.js @@ -5,7 +5,6 @@ "use strict"; const { Ci, Cu } = require("chrome"); -const ChromeUtils = require("ChromeUtils"); const { createStringGrip } = require("devtools/server/actors/object/utils"); diff --git a/devtools/server/actors/style-rule.js b/devtools/server/actors/style-rule.js index f64819431df6..675890abc804 100644 --- a/devtools/server/actors/style-rule.js +++ b/devtools/server/actors/style-rule.js @@ -60,8 +60,6 @@ loader.lazyRequireGetter( true ); -loader.lazyRequireGetter(this, "ChromeUtils"); - const XHTML_NS = "http://www.w3.org/1999/xhtml"; const SUPPORTED_RULE_TYPES = [ diff --git a/devtools/server/actors/targets/window-global.js b/devtools/server/actors/targets/window-global.js index a09f064050b6..cf662d03eb56 100644 --- a/devtools/server/actors/targets/window-global.js +++ b/devtools/server/actors/targets/window-global.js @@ -22,7 +22,6 @@ */ var { Ci, Cu, Cr, Cc } = require("chrome"); -const ChromeUtils = require("ChromeUtils"); var { ActorRegistry } = require("devtools/server/actors/utils/actor-registry"); var DevToolsUtils = require("devtools/shared/DevToolsUtils"); var { assert } = DevToolsUtils; diff --git a/devtools/server/actors/webconsole.js b/devtools/server/actors/webconsole.js index 22a69965a38f..7275c98bf4b0 100644 --- a/devtools/server/actors/webconsole.js +++ b/devtools/server/actors/webconsole.js @@ -10,7 +10,6 @@ const { ActorClassWithSpec, Actor } = require("devtools/shared/protocol"); const { webconsoleSpec } = require("devtools/shared/specs/webconsole"); const { Cc, Ci, Cu } = require("chrome"); -const ChromeUtils = require("ChromeUtils"); const { DevToolsServer } = require("devtools/server/devtools-server"); const { ThreadActor } = require("devtools/server/actors/thread"); const { ObjectActor } = require("devtools/server/actors/object"); diff --git a/devtools/server/actors/webconsole/listeners/console-api.js b/devtools/server/actors/webconsole/listeners/console-api.js index f7ef0920ce1d..6744032a6d2d 100644 --- a/devtools/server/actors/webconsole/listeners/console-api.js +++ b/devtools/server/actors/webconsole/listeners/console-api.js @@ -5,7 +5,6 @@ "use strict"; const { Cc, Ci } = require("chrome"); -const ChromeUtils = require("ChromeUtils"); const { CONSOLE_WORKER_IDS, WebConsoleUtils, diff --git a/devtools/server/actors/webconsole/listeners/console-file-activity.js b/devtools/server/actors/webconsole/listeners/console-file-activity.js index f9b456a4a34d..4e6e4d07b8ea 100644 --- a/devtools/server/actors/webconsole/listeners/console-file-activity.js +++ b/devtools/server/actors/webconsole/listeners/console-file-activity.js @@ -5,7 +5,6 @@ "use strict"; const { Ci } = require("chrome"); -const ChromeUtils = require("ChromeUtils"); /** * A WebProgressListener that listens for file loads. diff --git a/devtools/server/actors/webconsole/listeners/console-reflow.js b/devtools/server/actors/webconsole/listeners/console-reflow.js index 31aae0ed9687..d1aaa14a6f78 100644 --- a/devtools/server/actors/webconsole/listeners/console-reflow.js +++ b/devtools/server/actors/webconsole/listeners/console-reflow.js @@ -5,7 +5,6 @@ "use strict"; const { components } = require("chrome"); -const ChromeUtils = require("ChromeUtils"); /** * A ReflowObserver that listens for reflow events from the page. diff --git a/devtools/server/actors/webconsole/listeners/console-service.js b/devtools/server/actors/webconsole/listeners/console-service.js index 969760adb3a6..d477b3ca02c3 100644 --- a/devtools/server/actors/webconsole/listeners/console-service.js +++ b/devtools/server/actors/webconsole/listeners/console-service.js @@ -6,7 +6,6 @@ const { Ci } = require("chrome"); const { isWindowIncluded } = require("devtools/shared/layout/utils"); -const ChromeUtils = require("ChromeUtils"); const { WebConsoleUtils } = require("devtools/server/actors/webconsole/utils"); // The page errors listener diff --git a/devtools/server/actors/webconsole/listeners/document-events.js b/devtools/server/actors/webconsole/listeners/document-events.js index 3065d108fba1..a408793f43f3 100644 --- a/devtools/server/actors/webconsole/listeners/document-events.js +++ b/devtools/server/actors/webconsole/listeners/document-events.js @@ -8,7 +8,6 @@ const EventEmitter = require("devtools/shared/event-emitter"); const { Ci } = require("chrome"); -const ChromeUtils = require("ChromeUtils"); /** * About "navigationStart - ${WILL_NAVIGATE_TIME_SHIFT}ms": diff --git a/devtools/server/actors/worker/service-worker-registration.js b/devtools/server/actors/worker/service-worker-registration.js index 3c640834bb17..9691e4ea9b72 100644 --- a/devtools/server/actors/worker/service-worker-registration.js +++ b/devtools/server/actors/worker/service-worker-registration.js @@ -4,7 +4,6 @@ "use strict"; -const ChromeUtils = require("ChromeUtils"); const { XPCOMUtils } = require("resource://gre/modules/XPCOMUtils.sys.mjs"); const protocol = require("devtools/shared/protocol"); const { diff --git a/devtools/server/performance/memory.js b/devtools/server/performance/memory.js index 62c6c90a7f22..17279494bd9c 100644 --- a/devtools/server/performance/memory.js +++ b/devtools/server/performance/memory.js @@ -21,7 +21,6 @@ loader.lazyRequireGetter( "devtools/server/actors/utils/stack", true ); -loader.lazyRequireGetter(this, "ChromeUtils"); loader.lazyRequireGetter( this, "ParentProcessTargetActor", diff --git a/devtools/server/tests/browser/setup-in-parent.js b/devtools/server/tests/browser/setup-in-parent.js index 30108212a4f1..742ff951d6c6 100644 --- a/devtools/server/tests/browser/setup-in-parent.js +++ b/devtools/server/tests/browser/setup-in-parent.js @@ -1,7 +1,5 @@ "use strict"; -var ChromeUtils = require("ChromeUtils"); - exports.setupParent = function({ mm, prefix }) { const args = [ChromeUtils.getClassName(mm) == "ChromeMessageSender", prefix]; Services.obs.notifyObservers(null, "test:setupParent", JSON.stringify(args)); diff --git a/devtools/shared/commands/commands-factory.js b/devtools/shared/commands/commands-factory.js index 061c6c1478f8..cd5d590fe44d 100644 --- a/devtools/shared/commands/commands-factory.js +++ b/devtools/shared/commands/commands-factory.js @@ -5,7 +5,6 @@ "use strict"; const { createCommandsDictionary } = require("devtools/shared/commands/index"); -const ChromeUtils = require("ChromeUtils"); const { DevToolsLoader } = ChromeUtils.import( "resource://devtools/shared/loader/Loader.jsm" ); diff --git a/devtools/shared/layout/utils.js b/devtools/shared/layout/utils.js index 4b994c60b318..0877ea3917f2 100644 --- a/devtools/shared/layout/utils.js +++ b/devtools/shared/layout/utils.js @@ -11,7 +11,6 @@ loader.lazyRequireGetter( "DevToolsUtils", "devtools/shared/DevToolsUtils" ); -loader.lazyRequireGetter(this, "ChromeUtils"); loader.lazyRequireGetter( this, "NetUtil", diff --git a/devtools/shared/loader/builtin-modules.js b/devtools/shared/loader/builtin-modules.js index 5d3b281fdf50..54991281bb3a 100644 --- a/devtools/shared/loader/builtin-modules.js +++ b/devtools/shared/loader/builtin-modules.js @@ -217,7 +217,6 @@ function lazyRequireGetter(obj, properties, module, destructure) { // List of pseudo modules exposed to all devtools modules. exports.modules = { - ChromeUtils, DebuggerNotificationObserver, HeapSnapshot, InspectorUtils, @@ -261,6 +260,7 @@ exports.globals = { Blob, btoa, CanonicalBrowsingContext, + ChromeUtils, BrowsingContext, WebExtensionPolicy, WindowGlobalParent, diff --git a/devtools/shared/loader/worker-loader.js b/devtools/shared/loader/worker-loader.js index 0aa5a5975b24..9722d508178a 100644 --- a/devtools/shared/loader/worker-loader.js +++ b/devtools/shared/loader/worker-loader.js @@ -528,13 +528,13 @@ this.worker = new WorkerDebuggerLoader({ btoa: this.btoa, atob: this.atob, Services: Object.create(null), + ChromeUtils, }, loadSubScript, modules: { Debugger, chrome, xpcInspector, - ChromeUtils, DebuggerNotificationObserver, }, paths: { diff --git a/devtools/shared/protocol/Actor.js b/devtools/shared/protocol/Actor.js index 1f95331940ab..8ab952d0e5b2 100644 --- a/devtools/shared/protocol/Actor.js +++ b/devtools/shared/protocol/Actor.js @@ -7,7 +7,6 @@ const { extend } = require("devtools/shared/extend"); var { Pool } = require("devtools/shared/protocol/Pool"); const { Cu } = require("chrome"); -const ChromeUtils = require("ChromeUtils"); /** * Keep track of which actorSpecs have been created. If a replica of a spec diff --git a/devtools/shared/protocol/Front.js b/devtools/shared/protocol/Front.js index 4e3044c40ef2..0d8aeaa56810 100644 --- a/devtools/shared/protocol/Front.js +++ b/devtools/shared/protocol/Front.js @@ -4,7 +4,6 @@ "use strict"; -const ChromeUtils = require("ChromeUtils"); var { settleAll } = require("devtools/shared/DevToolsUtils"); var EventEmitter = require("devtools/shared/event-emitter"); diff --git a/devtools/shared/protocol/Front/FrontClassWithSpec.js b/devtools/shared/protocol/Front/FrontClassWithSpec.js index e01941aec1d7..dc9aa005b16a 100644 --- a/devtools/shared/protocol/Front/FrontClassWithSpec.js +++ b/devtools/shared/protocol/Front/FrontClassWithSpec.js @@ -5,7 +5,6 @@ "use strict"; const { Cu } = require("chrome"); -const ChromeUtils = require("ChromeUtils"); var { Front } = require("devtools/shared/protocol/Front"); /** diff --git a/devtools/shared/test-helpers/allocation-tracker.js b/devtools/shared/test-helpers/allocation-tracker.js index 2ed7415b21a1..e6ed642b7d5b 100644 --- a/devtools/shared/test-helpers/allocation-tracker.js +++ b/devtools/shared/test-helpers/allocation-tracker.js @@ -36,7 +36,6 @@ "use strict"; const { Cu, Cc, Ci } = require("chrome"); -const ChromeUtils = require("ChromeUtils"); const MemoryReporter = Cc["@mozilla.org/memory-reporter-manager;1"].getService( Ci.nsIMemoryReporterManager diff --git a/devtools/shared/webconsole/network-helper.js b/devtools/shared/webconsole/network-helper.js index 99ea33615307..d21ea82b7628 100644 --- a/devtools/shared/webconsole/network-helper.js +++ b/devtools/shared/webconsole/network-helper.js @@ -62,7 +62,6 @@ "use strict"; -const ChromeUtils = require("ChromeUtils"); const { components, Cc, Ci } = require("chrome"); loader.lazyImporter(this, "NetUtil", "resource://gre/modules/NetUtil.jsm"); const DevToolsUtils = require("devtools/shared/DevToolsUtils"); diff --git a/devtools/shared/webconsole/throttle.js b/devtools/shared/webconsole/throttle.js index f866b8f9f17c..b60fe1c31f49 100644 --- a/devtools/shared/webconsole/throttle.js +++ b/devtools/shared/webconsole/throttle.js @@ -23,7 +23,6 @@ loader.lazyServiceGetter( "nsIHttpActivityDistributor" ); -const ChromeUtils = require("ChromeUtils"); const { setTimeout } = require("resource://gre/modules/Timer.jsm"); /** diff --git a/testing/talos/talos/tests/devtools/addon/content/damp.js b/testing/talos/talos/tests/devtools/addon/content/damp.js index f66f7c2cd7b9..11949c1b48b5 100644 --- a/testing/talos/talos/tests/devtools/addon/content/damp.js +++ b/testing/talos/talos/tests/devtools/addon/content/damp.js @@ -9,7 +9,6 @@ const { Ci, Cc, Cu } = require("chrome"); const { gBrowser, MozillaFileLogger, requestIdleCallback } = dampWindow; -const ChromeUtils = require("ChromeUtils"); const { AddonManager } = require("resource://gre/modules/AddonManager.jsm"); const DampLoadParentModule = require("damp-test/actors/DampLoadParent.jsm"); diff --git a/testing/talos/talos/tests/devtools/addon/content/tests/toolbox/browser-toolbox.js b/testing/talos/talos/tests/devtools/addon/content/tests/toolbox/browser-toolbox.js index 704cfcee0b54..933750449728 100644 --- a/testing/talos/talos/tests/devtools/addon/content/tests/toolbox/browser-toolbox.js +++ b/testing/talos/talos/tests/devtools/addon/content/tests/toolbox/browser-toolbox.js @@ -4,7 +4,6 @@ "use strict"; -const ChromeUtils = require("ChromeUtils"); const { runTest, testSetup, testTeardown } = require("../head"); const { DevToolsClient } = require("devtools/client/devtools-client");