mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 18:47:53 +00:00
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
This commit is contained in:
parent
7f9229d43d
commit
573f380baf
@ -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:
|
||||
|
@ -5,7 +5,6 @@
|
||||
"use strict";
|
||||
|
||||
const { Cu } = require("chrome");
|
||||
const ChromeUtils = require("ChromeUtils");
|
||||
|
||||
const {
|
||||
DevToolsShim,
|
||||
|
@ -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");
|
||||
|
@ -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"
|
||||
);
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
const ChromeUtils = require("ChromeUtils");
|
||||
const { RemoteSettings } = ChromeUtils.import(
|
||||
"resource://services-settings/remote-settings.js"
|
||||
);
|
||||
|
@ -5,7 +5,6 @@
|
||||
"use strict";
|
||||
|
||||
const { components, Ci, Cr, Cu, CC } = require("chrome");
|
||||
const ChromeUtils = require("ChromeUtils");
|
||||
|
||||
loader.lazyRequireGetter(
|
||||
this,
|
||||
|
@ -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) {
|
||||
|
@ -26,7 +26,6 @@
|
||||
*/
|
||||
|
||||
const { Cu } = require("chrome");
|
||||
const ChromeUtils = require("ChromeUtils");
|
||||
|
||||
const lazy = {};
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
|
@ -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"
|
||||
);
|
||||
|
@ -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"
|
||||
);
|
||||
|
@ -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");
|
||||
|
||||
/**
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
const ChromeUtils = require("ChromeUtils");
|
||||
const { Cu } = require("chrome");
|
||||
const { dumpn } = require("devtools/shared/DevToolsUtils");
|
||||
|
||||
|
@ -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`,
|
||||
|
@ -11,6 +11,7 @@
|
||||
*/
|
||||
function setMocksInGlobal() {
|
||||
global.Services = require("Services-mock");
|
||||
global.ChromeUtils = require("ChromeUtils-mock");
|
||||
|
||||
global.isWorker = false;
|
||||
|
||||
|
@ -26,7 +26,6 @@ Services.scriptloader.loadSubScript(
|
||||
EventUtils
|
||||
);
|
||||
|
||||
var ChromeUtils = require("ChromeUtils");
|
||||
const { TestUtils } = ChromeUtils.import(
|
||||
"resource://testing-common/TestUtils.jsm"
|
||||
);
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
const ChromeUtils = require("ChromeUtils");
|
||||
const { BrowserLoader } = ChromeUtils.import(
|
||||
"resource://devtools/shared/loader/browser-loader.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": () =>
|
||||
|
@ -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"
|
||||
);
|
||||
|
@ -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,
|
||||
|
@ -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");
|
||||
|
@ -5,7 +5,6 @@
|
||||
"use strict";
|
||||
const { Ci } = require("chrome");
|
||||
|
||||
loader.lazyRequireGetter(this, "ChromeUtils");
|
||||
loader.lazyRequireGetter(
|
||||
this,
|
||||
"isRemoteBrowserElement",
|
||||
|
@ -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");
|
||||
|
||||
/**
|
||||
|
@ -13,7 +13,6 @@
|
||||
const DEBUG_PLATFORM_EVENTS = false;
|
||||
|
||||
const { Cc, Ci } = require("chrome");
|
||||
const ChromeUtils = require("ChromeUtils");
|
||||
|
||||
loader.lazyRequireGetter(
|
||||
this,
|
||||
|
@ -5,7 +5,6 @@
|
||||
"use strict";
|
||||
|
||||
const { Cc, Ci, Cr, components: Components } = require("chrome");
|
||||
const ChromeUtils = require("ChromeUtils");
|
||||
|
||||
loader.lazyRequireGetter(
|
||||
this,
|
||||
|
@ -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",
|
||||
|
@ -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");
|
||||
|
@ -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
|
||||
|
@ -5,7 +5,6 @@
|
||||
"use strict";
|
||||
|
||||
const { Ci, Cu } = require("chrome");
|
||||
const ChromeUtils = require("ChromeUtils");
|
||||
|
||||
const { createStringGrip } = require("devtools/server/actors/object/utils");
|
||||
|
||||
|
@ -60,8 +60,6 @@ loader.lazyRequireGetter(
|
||||
true
|
||||
);
|
||||
|
||||
loader.lazyRequireGetter(this, "ChromeUtils");
|
||||
|
||||
const XHTML_NS = "http://www.w3.org/1999/xhtml";
|
||||
|
||||
const SUPPORTED_RULE_TYPES = [
|
||||
|
@ -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;
|
||||
|
@ -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");
|
||||
|
@ -5,7 +5,6 @@
|
||||
"use strict";
|
||||
|
||||
const { Cc, Ci } = require("chrome");
|
||||
const ChromeUtils = require("ChromeUtils");
|
||||
const {
|
||||
CONSOLE_WORKER_IDS,
|
||||
WebConsoleUtils,
|
||||
|
@ -5,7 +5,6 @@
|
||||
"use strict";
|
||||
|
||||
const { Ci } = require("chrome");
|
||||
const ChromeUtils = require("ChromeUtils");
|
||||
|
||||
/**
|
||||
* A WebProgressListener that listens for file loads.
|
||||
|
@ -5,7 +5,6 @@
|
||||
"use strict";
|
||||
|
||||
const { components } = require("chrome");
|
||||
const ChromeUtils = require("ChromeUtils");
|
||||
|
||||
/**
|
||||
* A ReflowObserver that listens for reflow events from the page.
|
||||
|
@ -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
|
||||
|
@ -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":
|
||||
|
@ -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 {
|
||||
|
@ -21,7 +21,6 @@ loader.lazyRequireGetter(
|
||||
"devtools/server/actors/utils/stack",
|
||||
true
|
||||
);
|
||||
loader.lazyRequireGetter(this, "ChromeUtils");
|
||||
loader.lazyRequireGetter(
|
||||
this,
|
||||
"ParentProcessTargetActor",
|
||||
|
@ -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));
|
||||
|
@ -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"
|
||||
);
|
||||
|
@ -11,7 +11,6 @@ loader.lazyRequireGetter(
|
||||
"DevToolsUtils",
|
||||
"devtools/shared/DevToolsUtils"
|
||||
);
|
||||
loader.lazyRequireGetter(this, "ChromeUtils");
|
||||
loader.lazyRequireGetter(
|
||||
this,
|
||||
"NetUtil",
|
||||
|
@ -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,
|
||||
|
@ -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: {
|
||||
|
@ -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
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
const ChromeUtils = require("ChromeUtils");
|
||||
var { settleAll } = require("devtools/shared/DevToolsUtils");
|
||||
var EventEmitter = require("devtools/shared/event-emitter");
|
||||
|
||||
|
@ -5,7 +5,6 @@
|
||||
"use strict";
|
||||
|
||||
const { Cu } = require("chrome");
|
||||
const ChromeUtils = require("ChromeUtils");
|
||||
var { Front } = require("devtools/shared/protocol/Front");
|
||||
|
||||
/**
|
||||
|
@ -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
|
||||
|
@ -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");
|
||||
|
@ -23,7 +23,6 @@ loader.lazyServiceGetter(
|
||||
"nsIHttpActivityDistributor"
|
||||
);
|
||||
|
||||
const ChromeUtils = require("ChromeUtils");
|
||||
const { setTimeout } = require("resource://gre/modules/Timer.jsm");
|
||||
|
||||
/**
|
||||
|
@ -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");
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
const ChromeUtils = require("ChromeUtils");
|
||||
const { runTest, testSetup, testTeardown } = require("../head");
|
||||
|
||||
const { DevToolsClient } = require("devtools/client/devtools-client");
|
||||
|
Loading…
Reference in New Issue
Block a user