зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1791832 - [devtools] Convert devtools/startup JSM to ES Modules. r=jdescottes
Differential Revision: https://phabricator.services.mozilla.com/D157911
This commit is contained in:
Родитель
848e2b334e
Коммит
6781eae59e
|
@ -2465,9 +2465,12 @@ class nsContextMenu {
|
|||
}
|
||||
}
|
||||
|
||||
ChromeUtils.defineESModuleGetters(nsContextMenu, {
|
||||
DevToolsShim: "chrome://devtools-startup/content/DevToolsShim.sys.mjs",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(nsContextMenu, {
|
||||
LoginManagerContextMenu: "resource://gre/modules/LoginManagerContextMenu.jsm",
|
||||
DevToolsShim: "chrome://devtools-startup/content/DevToolsShim.jsm",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyPreferenceGetter(
|
||||
|
|
|
@ -11,11 +11,9 @@
|
|||
* and the implementation of the `devtools_page`.
|
||||
*/
|
||||
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"DevToolsShim",
|
||||
"chrome://devtools-startup/content/DevToolsShim.jsm"
|
||||
);
|
||||
ChromeUtils.defineESModuleGetters(this, {
|
||||
DevToolsShim: "chrome://devtools-startup/content/DevToolsShim.sys.mjs",
|
||||
});
|
||||
|
||||
var { ExtensionParent } = ChromeUtils.import(
|
||||
"resource://gre/modules/ExtensionParent.jsm"
|
||||
|
|
|
@ -21,11 +21,9 @@ XPCOMUtils.defineLazyGetter(this, "gDevTools", () => {
|
|||
return gDevTools;
|
||||
});
|
||||
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"DevToolsShim",
|
||||
"chrome://devtools-startup/content/DevToolsShim.jsm"
|
||||
);
|
||||
ChromeUtils.defineESModuleGetters(this, {
|
||||
DevToolsShim: "chrome://devtools-startup/content/DevToolsShim.sys.mjs",
|
||||
});
|
||||
|
||||
const TOOLBOX_BLANK_PANEL_ID = "testBlankPanel";
|
||||
|
||||
|
|
|
@ -253,10 +253,13 @@ XPCOMUtils.defineLazyServiceGetters(lazy, {
|
|||
gScreenManager: ["@mozilla.org/gfx/screenmanager;1", "nsIScreenManager"],
|
||||
});
|
||||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
DevToolsShim: "chrome://devtools-startup/content/DevToolsShim.sys.mjs",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
AsyncShutdown: "resource://gre/modules/AsyncShutdown.jsm",
|
||||
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||
DevToolsShim: "chrome://devtools-startup/content/DevToolsShim.jsm",
|
||||
E10SUtils: "resource://gre/modules/E10SUtils.jsm",
|
||||
HomePage: "resource:///modules/HomePage.jsm",
|
||||
PrivacyFilter: "resource://gre/modules/sessionstore/PrivacyFilter.jsm",
|
||||
|
|
|
@ -9,6 +9,7 @@ import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
|||
const lazy = {};
|
||||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
DevToolsShim: "chrome://devtools-startup/content/DevToolsShim.sys.mjs",
|
||||
UrlbarPrefs: "resource:///modules/UrlbarPrefs.sys.mjs",
|
||||
UrlbarProviderQuickActions:
|
||||
"resource:///modules/UrlbarProviderQuickActions.sys.mjs",
|
||||
|
@ -22,7 +23,6 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
|
|||
AppUpdater: "resource:///modules/AppUpdater.jsm",
|
||||
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||
ClientEnvironment: "resource://normandy/lib/ClientEnvironment.jsm",
|
||||
DevToolsShim: "chrome://devtools-startup/content/DevToolsShim.jsm",
|
||||
ResetProfile: "resource://gre/modules/ResetProfile.jsm",
|
||||
});
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
requestLongerTimeout(2);
|
||||
|
||||
ChromeUtils.defineESModuleGetters(this, {
|
||||
DevToolsShim: "chrome://devtools-startup/content/DevToolsShim.sys.mjs",
|
||||
|
||||
UrlbarProviderQuickActions:
|
||||
"resource:///modules/UrlbarProviderQuickActions.sys.mjs",
|
||||
});
|
||||
|
@ -17,7 +19,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
|||
AppConstants: "resource://gre/modules/AppConstants.jsm",
|
||||
AppUpdater: "resource:///modules/AppUpdater.jsm",
|
||||
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
|
||||
DevToolsShim: "chrome://devtools-startup/content/DevToolsShim.jsm",
|
||||
});
|
||||
|
||||
const DUMMY_PAGE =
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const {
|
||||
DevToolsShim,
|
||||
} = require("chrome://devtools-startup/content/DevToolsShim.jsm");
|
||||
const { DevToolsShim } = ChromeUtils.importESModule(
|
||||
"chrome://devtools-startup/content/DevToolsShim.sys.mjs"
|
||||
);
|
||||
|
||||
const lazy = {};
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
|
@ -581,7 +581,7 @@ DevTools.prototype = {
|
|||
* arguments description.
|
||||
*
|
||||
* Also used by 3rd party tools (eg wptrunner) and exposed by
|
||||
* DevToolsShim.jsm.
|
||||
* DevToolsShim.sys.mjs.
|
||||
*
|
||||
* @param {XULTab} tab
|
||||
* The tab the toolbox will debug
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { validateProfilerWebChannelUrl } = ChromeUtils.import(
|
||||
"resource:///modules/DevToolsStartup.jsm"
|
||||
const { validateProfilerWebChannelUrl } = ChromeUtils.importESModule(
|
||||
"resource:///modules/DevToolsStartup.sys.mjs"
|
||||
);
|
||||
|
||||
add_task(function test() {
|
||||
|
|
|
@ -2,14 +2,12 @@
|
|||
* 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";
|
||||
|
||||
// Register the about:debugging URL, that allows to debug tabs, extensions, workers on
|
||||
// the current instance of Firefox or on a remote Firefox.
|
||||
|
||||
const { nsIAboutModule } = Ci;
|
||||
|
||||
function AboutDebugging() {}
|
||||
export function AboutDebugging() {}
|
||||
|
||||
AboutDebugging.prototype = {
|
||||
classDescription: "about:debugging",
|
||||
|
@ -37,5 +35,3 @@ AboutDebugging.prototype = {
|
|||
);
|
||||
},
|
||||
};
|
||||
|
||||
var EXPORTED_SYMBOLS = ["AboutDebugging"];
|
|
@ -2,14 +2,12 @@
|
|||
* 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";
|
||||
|
||||
// Register about:devtools-toolbox which allows to open a devtools toolbox
|
||||
// in a Firefox tab or a custom html iframe in browser.html
|
||||
|
||||
const { nsIAboutModule } = Ci;
|
||||
|
||||
function AboutDevtoolsToolbox() {}
|
||||
export function AboutDevtoolsToolbox() {}
|
||||
|
||||
AboutDevtoolsToolbox.prototype = {
|
||||
uri: Services.io.newURI("chrome://devtools/content/framework/toolbox.xhtml"),
|
||||
|
@ -37,5 +35,3 @@ AboutDevtoolsToolbox.prototype = {
|
|||
return this.uri;
|
||||
},
|
||||
};
|
||||
|
||||
var EXPORTED_SYMBOLS = ["AboutDevtoolsToolbox"];
|
|
@ -2,11 +2,8 @@
|
|||
* 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";
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
const lazy = {};
|
||||
XPCOMUtils.defineLazyGetter(lazy, "DevToolsStartup", () => {
|
||||
return Cc["@mozilla.org/devtools/startup-clh;1"].getService(
|
||||
|
@ -28,8 +25,6 @@ XPCOMUtils.defineLazyGetter(lazy, "Telemetry", function() {
|
|||
|
||||
const DEVTOOLS_POLICY_DISABLED_PREF = "devtools.policy.disabled";
|
||||
|
||||
const EXPORTED_SYMBOLS = ["DevToolsShim"];
|
||||
|
||||
function removeItem(array, callback) {
|
||||
const index = array.findIndex(callback);
|
||||
if (index >= 0) {
|
||||
|
@ -45,7 +40,7 @@ function removeItem(array, callback) {
|
|||
* as DevTools are ready, the DevToolsShim will forward all the requests received until
|
||||
* then to the real DevTools instance.
|
||||
*/
|
||||
const DevToolsShim = {
|
||||
export const DevToolsShim = {
|
||||
_gDevTools: null,
|
||||
listeners: [],
|
||||
|
|
@ -20,8 +20,6 @@
|
|||
* and ensure setting up tools.
|
||||
**/
|
||||
|
||||
"use strict";
|
||||
|
||||
const kDebuggerPrefs = [
|
||||
"devtools.debugger.remote-enabled",
|
||||
"devtools.chrome.enabled",
|
||||
|
@ -31,9 +29,8 @@ const DEVTOOLS_F12_DISABLED_PREF = "devtools.experiment.f12.shortcut_disabled";
|
|||
|
||||
const DEVTOOLS_POLICY_DISABLED_PREF = "devtools.policy.disabled";
|
||||
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
|
||||
|
||||
const { AppConstants } = ChromeUtils.import(
|
||||
"resource://gre/modules/AppConstants.jsm"
|
||||
);
|
||||
|
@ -258,7 +255,7 @@ function getProfilerKeyShortcuts() {
|
|||
* @param {string} targetUrl
|
||||
* @returns {string}
|
||||
*/
|
||||
function validateProfilerWebChannelUrl(targetUrl) {
|
||||
export function validateProfilerWebChannelUrl(targetUrl) {
|
||||
const frontEndUrl = "https://profiler.firefox.com";
|
||||
|
||||
if (targetUrl !== frontEndUrl) {
|
||||
|
@ -304,7 +301,7 @@ XPCOMUtils.defineLazyGetter(lazy, "ProfilerPopupBackground", function() {
|
|||
);
|
||||
});
|
||||
|
||||
function DevToolsStartup() {
|
||||
export function DevToolsStartup() {
|
||||
this.onWindowReady = this.onWindowReady.bind(this);
|
||||
this.addDevToolsItemsToSubview = this.addDevToolsItemsToSubview.bind(this);
|
||||
this.onMoreToolsViewShowing = this.onMoreToolsViewShowing.bind(this);
|
||||
|
@ -842,6 +839,7 @@ DevToolsStartup.prototype = {
|
|||
);
|
||||
// Ensure loading main devtools module that hooks up into browser UI
|
||||
// and initialize all devtools machinery.
|
||||
// eslint-disable-next-line import/no-unassigned-import
|
||||
require("devtools/client/framework/devtools-browser");
|
||||
return require;
|
||||
},
|
||||
|
@ -1296,5 +1294,3 @@ const JsonView = {
|
|||
}
|
||||
},
|
||||
};
|
||||
|
||||
var EXPORTED_SYMBOLS = ["DevToolsStartup", "validateProfilerWebChannelUrl"];
|
|
@ -11,20 +11,20 @@ if buildconfig.substs['MOZ_DEVTOOLS'] == 'all':
|
|||
{
|
||||
'cid': '{9e9a9283-0ce9-4e4a-8f1c-ba129a032c32}',
|
||||
'contract_ids': ['@mozilla.org/devtools/startup-clh;1'],
|
||||
'jsm': 'resource:///modules/DevToolsStartup.jsm',
|
||||
'esModule': 'resource:///modules/DevToolsStartup.sys.mjs',
|
||||
'constructor': 'DevToolsStartup',
|
||||
'categories': {'command-line-handler': 'm-devtools'},
|
||||
},
|
||||
{
|
||||
'cid': '{1060afaf-dc9e-43da-8646-23a2faf48493}',
|
||||
'contract_ids': ['@mozilla.org/network/protocol/about;1?what=debugging'],
|
||||
'jsm': 'resource:///modules/AboutDebuggingRegistration.jsm',
|
||||
'esModule': 'resource:///modules/AboutDebuggingRegistration.sys.mjs',
|
||||
'constructor': 'AboutDebugging',
|
||||
},
|
||||
{
|
||||
'cid': '{11342911-3135-45a8-8d71-737a2b0ad469}',
|
||||
'contract_ids': ['@mozilla.org/network/protocol/about;1?what=devtools-toolbox'],
|
||||
'jsm': 'resource:///modules/AboutDevToolsToolboxRegistration.jsm',
|
||||
'esModule': 'resource:///modules/AboutDevToolsToolboxRegistration.sys.mjs',
|
||||
'constructor': 'AboutDevtoolsToolbox',
|
||||
},
|
||||
]
|
||||
|
|
|
@ -5,4 +5,4 @@
|
|||
devtools-startup.jar:
|
||||
% content devtools-startup %content/
|
||||
|
||||
content/DevToolsShim.jsm (DevToolsShim.jsm)
|
||||
content/DevToolsShim.sys.mjs (DevToolsShim.sys.mjs)
|
||||
|
|
|
@ -9,9 +9,9 @@ JAR_MANIFESTS += ["jar.mn"]
|
|||
# Register the startup components only for 'all' builds.
|
||||
if CONFIG["MOZ_DEVTOOLS"] == "all":
|
||||
EXTRA_JS_MODULES += [
|
||||
"AboutDebuggingRegistration.jsm",
|
||||
"AboutDevToolsToolboxRegistration.jsm",
|
||||
"DevToolsStartup.jsm",
|
||||
"AboutDebuggingRegistration.sys.mjs",
|
||||
"AboutDevToolsToolboxRegistration.sys.mjs",
|
||||
"DevToolsStartup.sys.mjs",
|
||||
]
|
||||
|
||||
DIRS += [
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const { DevToolsShim } = ChromeUtils.import(
|
||||
"chrome://devtools-startup/content/DevToolsShim.jsm"
|
||||
const { DevToolsShim } = ChromeUtils.importESModule(
|
||||
"chrome://devtools-startup/content/DevToolsShim.sys.mjs"
|
||||
);
|
||||
|
||||
// Test the DevToolsShim
|
||||
|
|
|
@ -670,6 +670,8 @@ class MarionetteDebugProtocolPart(DebugProtocolPart):
|
|||
|
||||
def load_devtools(self):
|
||||
with self.marionette.using_context(self.marionette.CONTEXT_CHROME):
|
||||
# Once ESR is 107 is released, we can replace the ChromeUtils.import(DevToolsShim.jsm)
|
||||
# with ChromeUtils.importESModule(DevToolsShim.sys.mjs) in this snippet:
|
||||
self.parent.base.execute_script("""
|
||||
const { DevToolsShim } = ChromeUtils.import(
|
||||
"chrome://devtools-startup/content/DevToolsShim.jsm"
|
||||
|
|
|
@ -24,12 +24,15 @@ const { AppConstants } = ChromeUtils.import(
|
|||
|
||||
const lazy = {};
|
||||
|
||||
ChromeUtils.defineESModuleGetters(lazy, {
|
||||
DevToolsShim: "chrome://devtools-startup/content/DevToolsShim.sys.mjs",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(lazy, {
|
||||
AddonManager: "resource://gre/modules/AddonManager.jsm",
|
||||
AsyncShutdown: "resource://gre/modules/AsyncShutdown.jsm",
|
||||
BroadcastConduit: "resource://gre/modules/ConduitsParent.jsm",
|
||||
DeferredTask: "resource://gre/modules/DeferredTask.jsm",
|
||||
DevToolsShim: "chrome://devtools-startup/content/DevToolsShim.jsm",
|
||||
ExtensionData: "resource://gre/modules/Extension.jsm",
|
||||
ExtensionActivityLog: "resource://gre/modules/ExtensionActivityLog.jsm",
|
||||
GeckoViewConnection: "resource://gre/modules/GeckoViewWebExtension.jsm",
|
||||
|
|
|
@ -7,10 +7,14 @@
|
|||
var { ExtensionParent } = ChromeUtils.import(
|
||||
"resource://gre/modules/ExtensionParent.jsm"
|
||||
);
|
||||
|
||||
ChromeUtils.defineESModuleGetters(this, {
|
||||
DevToolsShim: "chrome://devtools-startup/content/DevToolsShim.sys.mjs",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
AddonManager: "resource://gre/modules/AddonManager.jsm",
|
||||
AddonManagerPrivate: "resource://gre/modules/AddonManager.jsm",
|
||||
DevToolsShim: "chrome://devtools-startup/content/DevToolsShim.jsm",
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyPreferenceGetter(
|
||||
|
|
Загрузка…
Ссылка в новой задаче