diff --git a/.eslintignore b/.eslintignore index 7bf7a3ca0cf5..5819f278fdf9 100644 --- a/.eslintignore +++ b/.eslintignore @@ -164,7 +164,7 @@ modules/libpref/test/unit/*data/ python/ # These are (mainly) imported code that we don't want to lint to make imports easier. -remote/cdp/Protocol.jsm +remote/cdp/Protocol.sys.mjs remote/cdp/test/browser/chrome-remote-interface.js remote/marionette/atom.sys.mjs diff --git a/remote/cdp/CDP.jsm b/remote/cdp/CDP.sys.mjs similarity index 92% rename from remote/cdp/CDP.jsm rename to remote/cdp/CDP.sys.mjs index 1e3483d46b8c..14f0155301d5 100644 --- a/remote/cdp/CDP.jsm +++ b/remote/cdp/CDP.sys.mjs @@ -2,25 +2,16 @@ * 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"; - -var EXPORTED_SYMBOLS = ["CDP"]; - -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); +import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { + JSONHandler: "chrome://remote/content/cdp/JSONHandler.sys.mjs", Log: "chrome://remote/content/shared/Log.sys.mjs", RecommendedPreferences: "chrome://remote/content/shared/RecommendedPreferences.sys.mjs", -}); - -XPCOMUtils.defineLazyModuleGetters(lazy, { - JSONHandler: "chrome://remote/content/cdp/JSONHandler.jsm", - TargetList: "chrome://remote/content/cdp/targets/TargetList.jsm", + TargetList: "chrome://remote/content/cdp/targets/TargetList.sys.mjs", }); XPCOMUtils.defineLazyGetter(lazy, "logger", () => @@ -49,7 +40,7 @@ const RECOMMENDED_PREFS = new Map([ * * @see https://chromedevtools.github.io/devtools-protocol */ -class CDP { +export class CDP { /** * Creates a new instance of the CDP class. * diff --git a/remote/cdp/CDPConnection.jsm b/remote/cdp/CDPConnection.sys.mjs similarity index 94% rename from remote/cdp/CDPConnection.jsm rename to remote/cdp/CDPConnection.sys.mjs index c9d8d099301e..627bb57c3f43 100644 --- a/remote/cdp/CDPConnection.jsm +++ b/remote/cdp/CDPConnection.sys.mjs @@ -2,33 +2,22 @@ * 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"; -var EXPORTED_SYMBOLS = ["CDPConnection", "splitMethod"]; - -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); - -const { WebSocketConnection } = ChromeUtils.importESModule( - "chrome://remote/content/shared/WebSocketConnection.sys.mjs" -); +import { WebSocketConnection } from "chrome://remote/content/shared/WebSocketConnection.sys.mjs"; const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { Log: "chrome://remote/content/shared/Log.sys.mjs", -}); - -XPCOMUtils.defineLazyModuleGetters(lazy, { - UnknownMethodError: "chrome://remote/content/cdp/Error.jsm", + UnknownMethodError: "chrome://remote/content/cdp/Error.sys.mjs", }); XPCOMUtils.defineLazyGetter(lazy, "logger", () => lazy.Log.get(lazy.Log.TYPES.CDP) ); -class CDPConnection extends WebSocketConnection { +export class CDPConnection extends WebSocketConnection { /** * @param {WebSocket} webSocket * The WebSocket server connection to wrap. @@ -270,7 +259,7 @@ class CDPConnection extends WebSocketConnection { * Object with the domain ("Browser") and command ("getVersion") * as properties. */ -function splitMethod(method) { +export function splitMethod(method) { const parts = method.split("."); if (parts.length != 2 || !parts[0].length || !parts[1].length) { diff --git a/remote/cdp/Error.jsm b/remote/cdp/Error.sys.mjs similarity index 88% rename from remote/cdp/Error.jsm rename to remote/cdp/Error.sys.mjs index 74bfef125ed7..afaf93f938b3 100644 --- a/remote/cdp/Error.jsm +++ b/remote/cdp/Error.sys.mjs @@ -2,18 +2,7 @@ * 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"; - -var EXPORTED_SYMBOLS = [ - "FatalError", - "RemoteAgentError", - "UnknownMethodError", - "UnsupportedError", -]; - -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); +import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; const lazy = {}; @@ -25,7 +14,7 @@ XPCOMUtils.defineLazyGetter(lazy, "logger", () => lazy.Log.get(lazy.Log.TYPES.CDP) ); -class RemoteAgentError extends Error { +export class RemoteAgentError extends Error { constructor(message = "", cause = undefined) { cause = cause || message; super(cause); @@ -89,7 +78,7 @@ class RemoteAgentError extends Error { * * Constructing this error will force the application to quit. */ -class FatalError extends RemoteAgentError { +export class FatalError extends RemoteAgentError { constructor(...args) { super(...args); this.quit(); @@ -105,10 +94,10 @@ class FatalError extends RemoteAgentError { } /** When an operation is not yet implemented. */ -class UnsupportedError extends RemoteAgentError {} +export class UnsupportedError extends RemoteAgentError {} /** The requested remote method does not exist. */ -class UnknownMethodError extends RemoteAgentError { +export class UnknownMethodError extends RemoteAgentError { constructor(domain, command = null) { if (command) { super(`${domain}.${command}`); diff --git a/remote/cdp/JSONHandler.jsm b/remote/cdp/JSONHandler.sys.mjs similarity index 87% rename from remote/cdp/JSONHandler.jsm rename to remote/cdp/JSONHandler.sys.mjs index bcf175940429..e3f08e3038c9 100644 --- a/remote/cdp/JSONHandler.jsm +++ b/remote/cdp/JSONHandler.sys.mjs @@ -2,28 +2,22 @@ * 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"; - -var EXPORTED_SYMBOLS = ["JSONHandler"]; - -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); +import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { Log: "chrome://remote/content/shared/Log.sys.mjs", + Protocol: "chrome://remote/content/cdp/Protocol.sys.mjs", + RemoteAgentError: "chrome://remote/content/cdp/Error.sys.mjs", }); XPCOMUtils.defineLazyModuleGetters(lazy, { HTTP_404: "chrome://remote/content/server/HTTPD.jsm", HTTP_505: "chrome://remote/content/server/HTTPD.jsm", - Protocol: "chrome://remote/content/cdp/Protocol.jsm", - RemoteAgentError: "chrome://remote/content/cdp/Error.jsm", }); -class JSONHandler { +export class JSONHandler { constructor(cdp) { this.cdp = cdp; this.routes = { diff --git a/remote/cdp/Protocol.jsm b/remote/cdp/Protocol.sys.mjs similarity index 99% rename from remote/cdp/Protocol.jsm rename to remote/cdp/Protocol.sys.mjs index ef6c65f6f4ca..f239c82b4280 100644 --- a/remote/cdp/Protocol.jsm +++ b/remote/cdp/Protocol.sys.mjs @@ -2,10 +2,6 @@ * 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"; - -var EXPORTED_SYMBOLS = ["Protocol"]; - // The `Description` below is imported from Chromium Code. // TODO(ato): We send back a description of the protocol @@ -17359,4 +17355,4 @@ const Description = { } }; -const Protocol = {Description}; +export const Protocol = { Description }; diff --git a/remote/cdp/StreamRegistry.jsm b/remote/cdp/StreamRegistry.sys.mjs similarity index 91% rename from remote/cdp/StreamRegistry.jsm rename to remote/cdp/StreamRegistry.sys.mjs index eb7d373a472f..a43e23cc8183 100644 --- a/remote/cdp/StreamRegistry.jsm +++ b/remote/cdp/StreamRegistry.sys.mjs @@ -2,24 +2,20 @@ * 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"; - -var EXPORTED_SYMBOLS = ["StreamRegistry"]; - -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); +import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; const lazy = {}; +ChromeUtils.defineESModuleGetters(lazy, { + UnsupportedError: "chrome://remote/content/cdp/Error.sys.mjs", +}); + XPCOMUtils.defineLazyModuleGetters(lazy, { AsyncShutdown: "resource://gre/modules/AsyncShutdown.jsm", OS: "resource://gre/modules/osfile.jsm", - - UnsupportedError: "chrome://remote/content/cdp/Error.jsm", }); -class StreamRegistry { +export class StreamRegistry { constructor() { // handle => stream this.streams = new Map(); diff --git a/remote/cdp/domains/ContentProcessDomain.jsm b/remote/cdp/domains/ContentProcessDomain.sys.mjs similarity index 69% rename from remote/cdp/domains/ContentProcessDomain.jsm rename to remote/cdp/domains/ContentProcessDomain.sys.mjs index 5ef72a8c07df..fefe6aece536 100644 --- a/remote/cdp/domains/ContentProcessDomain.jsm +++ b/remote/cdp/domains/ContentProcessDomain.sys.mjs @@ -2,15 +2,9 @@ * 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 { Domain } from "chrome://remote/content/cdp/domains/Domain.sys.mjs"; -var EXPORTED_SYMBOLS = ["ContentProcessDomain"]; - -const { Domain } = ChromeUtils.import( - "chrome://remote/content/cdp/domains/Domain.jsm" -); - -class ContentProcessDomain extends Domain { +export class ContentProcessDomain extends Domain { destructor() { super.destructor(); } diff --git a/remote/cdp/domains/ContentProcessDomains.jsm b/remote/cdp/domains/ContentProcessDomains.jsm deleted file mode 100644 index e446478c8ff2..000000000000 --- a/remote/cdp/domains/ContentProcessDomains.jsm +++ /dev/null @@ -1,25 +0,0 @@ -/* 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"; - -var EXPORTED_SYMBOLS = ["ContentProcessDomains"]; - -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); - -const ContentProcessDomains = {}; - -XPCOMUtils.defineLazyModuleGetters(ContentProcessDomains, { - DOM: "chrome://remote/content/cdp/domains/content/DOM.jsm", - Emulation: "chrome://remote/content/cdp/domains/content/Emulation.jsm", - Input: "chrome://remote/content/cdp/domains/content/Input.jsm", - Log: "chrome://remote/content/cdp/domains/content/Log.jsm", - Network: "chrome://remote/content/cdp/domains/content/Network.jsm", - Page: "chrome://remote/content/cdp/domains/content/Page.jsm", - Performance: "chrome://remote/content/cdp/domains/content/Performance.jsm", - Runtime: "chrome://remote/content/cdp/domains/content/Runtime.jsm", - Security: "chrome://remote/content/cdp/domains/content/Security.jsm", -}); diff --git a/remote/cdp/domains/ContentProcessDomains.sys.mjs b/remote/cdp/domains/ContentProcessDomains.sys.mjs new file mode 100644 index 000000000000..a434dc006783 --- /dev/null +++ b/remote/cdp/domains/ContentProcessDomains.sys.mjs @@ -0,0 +1,19 @@ +/* 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/. */ + +export const ContentProcessDomains = {}; + +// eslint-disable-next-line mozilla/lazy-getter-object-name +ChromeUtils.defineESModuleGetters(ContentProcessDomains, { + DOM: "chrome://remote/content/cdp/domains/content/DOM.sys.mjs", + Emulation: "chrome://remote/content/cdp/domains/content/Emulation.sys.mjs", + Input: "chrome://remote/content/cdp/domains/content/Input.sys.mjs", + Log: "chrome://remote/content/cdp/domains/content/Log.sys.mjs", + Network: "chrome://remote/content/cdp/domains/content/Network.sys.mjs", + Page: "chrome://remote/content/cdp/domains/content/Page.sys.mjs", + Performance: + "chrome://remote/content/cdp/domains/content/Performance.sys.mjs", + Runtime: "chrome://remote/content/cdp/domains/content/Runtime.sys.mjs", + Security: "chrome://remote/content/cdp/domains/content/Security.sys.mjs", +}); diff --git a/remote/cdp/domains/Domain.jsm b/remote/cdp/domains/Domain.sys.mjs similarity index 96% rename from remote/cdp/domains/Domain.jsm rename to remote/cdp/domains/Domain.sys.mjs index 4887d4dc7486..9a35cd23b9c5 100644 --- a/remote/cdp/domains/Domain.jsm +++ b/remote/cdp/domains/Domain.sys.mjs @@ -2,11 +2,7 @@ * 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"; - -var EXPORTED_SYMBOLS = ["Domain"]; - -class Domain { +export class Domain { constructor(session) { this.session = session; this.name = this.constructor.name; diff --git a/remote/cdp/domains/DomainCache.jsm b/remote/cdp/domains/DomainCache.sys.mjs similarity index 89% rename from remote/cdp/domains/DomainCache.jsm rename to remote/cdp/domains/DomainCache.sys.mjs index 1399368ddb91..b4651cbe681b 100644 --- a/remote/cdp/domains/DomainCache.jsm +++ b/remote/cdp/domains/DomainCache.sys.mjs @@ -2,19 +2,11 @@ * 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"; - -var EXPORTED_SYMBOLS = ["DomainCache"]; - -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); - const lazy = {}; -XPCOMUtils.defineLazyModuleGetters(lazy, { - Domain: "chrome://remote/content/cdp/domains/Domain.jsm", - UnknownMethodError: "chrome://remote/content/cdp/Error.jsm", +ChromeUtils.defineESModuleGetters(lazy, { + Domain: "chrome://remote/content/cdp/domains/Domain.sys.mjs", + UnknownMethodError: "chrome://remote/content/cdp/Error.sys.mjs", }); /** @@ -32,7 +24,7 @@ XPCOMUtils.defineLazyModuleGetters(lazy, { * This should be a mapping between domain name * and JS module path passed to ChromeUtils.import. */ -class DomainCache { +export class DomainCache { constructor(session, modules) { this.session = session; this.modules = modules; diff --git a/remote/cdp/domains/ParentProcessDomains.jsm b/remote/cdp/domains/ParentProcessDomains.jsm deleted file mode 100644 index 404cafa2a1bd..000000000000 --- a/remote/cdp/domains/ParentProcessDomains.jsm +++ /dev/null @@ -1,25 +0,0 @@ -/* 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"; - -var EXPORTED_SYMBOLS = ["ParentProcessDomains"]; - -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); - -const ParentProcessDomains = {}; - -XPCOMUtils.defineLazyModuleGetters(ParentProcessDomains, { - Browser: "chrome://remote/content/cdp/domains/parent/Browser.jsm", - Emulation: "chrome://remote/content/cdp/domains/parent/Emulation.jsm", - Fetch: "chrome://remote/content/cdp/domains/parent/Fetch.jsm", - Input: "chrome://remote/content/cdp/domains/parent/Input.jsm", - IO: "chrome://remote/content/cdp/domains/parent/IO.jsm", - Network: "chrome://remote/content/cdp/domains/parent/Network.jsm", - Page: "chrome://remote/content/cdp/domains/parent/Page.jsm", - Security: "chrome://remote/content/cdp/domains/parent/Security.jsm", - Target: "chrome://remote/content/cdp/domains/parent/Target.jsm", -}); diff --git a/remote/cdp/domains/ParentProcessDomains.sys.mjs b/remote/cdp/domains/ParentProcessDomains.sys.mjs new file mode 100644 index 000000000000..48121980c177 --- /dev/null +++ b/remote/cdp/domains/ParentProcessDomains.sys.mjs @@ -0,0 +1,18 @@ +/* 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/. */ + +export const ParentProcessDomains = {}; + +// eslint-disable-next-line mozilla/lazy-getter-object-name +ChromeUtils.defineESModuleGetters(ParentProcessDomains, { + Browser: "chrome://remote/content/cdp/domains/parent/Browser.sys.mjs", + Emulation: "chrome://remote/content/cdp/domains/parent/Emulation.sys.mjs", + Fetch: "chrome://remote/content/cdp/domains/parent/Fetch.sys.mjs", + Input: "chrome://remote/content/cdp/domains/parent/Input.sys.mjs", + IO: "chrome://remote/content/cdp/domains/parent/IO.sys.mjs", + Network: "chrome://remote/content/cdp/domains/parent/Network.sys.mjs", + Page: "chrome://remote/content/cdp/domains/parent/Page.sys.mjs", + Security: "chrome://remote/content/cdp/domains/parent/Security.sys.mjs", + Target: "chrome://remote/content/cdp/domains/parent/Target.sys.mjs", +}); diff --git a/remote/cdp/domains/content/DOM.jsm b/remote/cdp/domains/content/DOM.sys.mjs similarity index 97% rename from remote/cdp/domains/content/DOM.jsm rename to remote/cdp/domains/content/DOM.sys.mjs index c618fdc393cc..8f920756e6cc 100644 --- a/remote/cdp/domains/content/DOM.jsm +++ b/remote/cdp/domains/content/DOM.sys.mjs @@ -2,15 +2,9 @@ * 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 { ContentProcessDomain } from "chrome://remote/content/cdp/domains/ContentProcessDomain.sys.mjs"; -var EXPORTED_SYMBOLS = ["DOM"]; - -const { ContentProcessDomain } = ChromeUtils.import( - "chrome://remote/content/cdp/domains/ContentProcessDomain.jsm" -); - -class DOM extends ContentProcessDomain { +export class DOM extends ContentProcessDomain { constructor(session) { super(session); this.enabled = false; diff --git a/remote/cdp/domains/content/Emulation.jsm b/remote/cdp/domains/content/Emulation.sys.mjs similarity index 85% rename from remote/cdp/domains/content/Emulation.jsm rename to remote/cdp/domains/content/Emulation.sys.mjs index d6f5af1b88bb..41bb0c76ea22 100644 --- a/remote/cdp/domains/content/Emulation.jsm +++ b/remote/cdp/domains/content/Emulation.sys.mjs @@ -2,13 +2,7 @@ * 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"; - -var EXPORTED_SYMBOLS = ["Emulation"]; - -const { ContentProcessDomain } = ChromeUtils.import( - "chrome://remote/content/cdp/domains/ContentProcessDomain.jsm" -); +import { ContentProcessDomain } from "chrome://remote/content/cdp/domains/ContentProcessDomain.sys.mjs"; const lazy = {}; @@ -16,7 +10,7 @@ ChromeUtils.defineESModuleGetters(lazy, { AnimationFramePromise: "chrome://remote/content/shared/Sync.sys.mjs", }); -class Emulation extends ContentProcessDomain { +export class Emulation extends ContentProcessDomain { // commands /** diff --git a/remote/cdp/domains/content/Input.jsm b/remote/cdp/domains/content/Input.sys.mjs similarity index 88% rename from remote/cdp/domains/content/Input.jsm rename to remote/cdp/domains/content/Input.sys.mjs index 39c545145011..e7a6ffc709ed 100644 --- a/remote/cdp/domains/content/Input.jsm +++ b/remote/cdp/domains/content/Input.sys.mjs @@ -2,15 +2,9 @@ * 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 { ContentProcessDomain } from "chrome://remote/content/cdp/domains/ContentProcessDomain.sys.mjs"; -var EXPORTED_SYMBOLS = ["Input"]; - -const { ContentProcessDomain } = ChromeUtils.import( - "chrome://remote/content/cdp/domains/ContentProcessDomain.jsm" -); - -class Input extends ContentProcessDomain { +export class Input extends ContentProcessDomain { constructor(session) { super(session); diff --git a/remote/cdp/domains/content/Log.jsm b/remote/cdp/domains/content/Log.sys.mjs similarity index 90% rename from remote/cdp/domains/content/Log.jsm rename to remote/cdp/domains/content/Log.sys.mjs index aeb69697faab..f8c561d42976 100644 --- a/remote/cdp/domains/content/Log.jsm +++ b/remote/cdp/domains/content/Log.sys.mjs @@ -2,13 +2,7 @@ * 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"; - -var EXPORTED_SYMBOLS = ["Log"]; - -const { ContentProcessDomain } = ChromeUtils.import( - "chrome://remote/content/cdp/domains/ContentProcessDomain.jsm" -); +import { ContentProcessDomain } from "chrome://remote/content/cdp/domains/ContentProcessDomain.sys.mjs"; const CONSOLE_MESSAGE_LEVEL_MAP = { [Ci.nsIConsoleMessage.debug]: "verbose", @@ -17,7 +11,7 @@ const CONSOLE_MESSAGE_LEVEL_MAP = { [Ci.nsIConsoleMessage.error]: "error", }; -class Log extends ContentProcessDomain { +export class Log extends ContentProcessDomain { constructor(session) { super(session); this.enabled = false; diff --git a/remote/cdp/domains/content/Network.jsm b/remote/cdp/domains/content/Network.sys.mjs similarity index 64% rename from remote/cdp/domains/content/Network.jsm rename to remote/cdp/domains/content/Network.sys.mjs index f2c07cbbe56d..91dc44cf46f1 100644 --- a/remote/cdp/domains/content/Network.jsm +++ b/remote/cdp/domains/content/Network.sys.mjs @@ -2,15 +2,9 @@ * 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 { ContentProcessDomain } from "chrome://remote/content/cdp/domains/ContentProcessDomain.sys.mjs"; -var EXPORTED_SYMBOLS = ["Network"]; - -const { ContentProcessDomain } = ChromeUtils.import( - "chrome://remote/content/cdp/domains/ContentProcessDomain.jsm" -); - -class Network extends ContentProcessDomain { +export class Network extends ContentProcessDomain { // commands /** diff --git a/remote/cdp/domains/content/Page.jsm b/remote/cdp/domains/content/Page.sys.mjs similarity index 98% rename from remote/cdp/domains/content/Page.jsm rename to remote/cdp/domains/content/Page.sys.mjs index 49ce3bcd9e15..5f833a910225 100644 --- a/remote/cdp/domains/content/Page.jsm +++ b/remote/cdp/domains/content/Page.sys.mjs @@ -2,13 +2,7 @@ * 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"; - -var EXPORTED_SYMBOLS = ["Page"]; - -const { ContentProcessDomain } = ChromeUtils.import( - "chrome://remote/content/cdp/domains/ContentProcessDomain.jsm" -); +import { ContentProcessDomain } from "chrome://remote/content/cdp/domains/ContentProcessDomain.sys.mjs"; const { LOAD_FLAGS_BYPASS_CACHE, @@ -16,7 +10,7 @@ const { LOAD_FLAGS_NONE, } = Ci.nsIWebNavigation; -class Page extends ContentProcessDomain { +export class Page extends ContentProcessDomain { constructor(session) { super(session); diff --git a/remote/cdp/domains/content/Security.jsm b/remote/cdp/domains/content/Performance.sys.mjs similarity index 70% rename from remote/cdp/domains/content/Security.jsm rename to remote/cdp/domains/content/Performance.sys.mjs index 957220caf8a4..e5726725b5c8 100644 --- a/remote/cdp/domains/content/Security.jsm +++ b/remote/cdp/domains/content/Performance.sys.mjs @@ -2,15 +2,9 @@ * 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 { ContentProcessDomain } from "chrome://remote/content/cdp/domains/ContentProcessDomain.sys.mjs"; -var EXPORTED_SYMBOLS = ["Security"]; - -const { ContentProcessDomain } = ChromeUtils.import( - "chrome://remote/content/cdp/domains/ContentProcessDomain.jsm" -); - -class Security extends ContentProcessDomain { +export class Performance extends ContentProcessDomain { constructor(session) { super(session); this.enabled = false; diff --git a/remote/cdp/domains/content/Runtime.jsm b/remote/cdp/domains/content/Runtime.sys.mjs similarity index 97% rename from remote/cdp/domains/content/Runtime.jsm rename to remote/cdp/domains/content/Runtime.sys.mjs index 63b93afa6e37..b8790f5a95d5 100644 --- a/remote/cdp/domains/content/Runtime.jsm +++ b/remote/cdp/domains/content/Runtime.sys.mjs @@ -2,30 +2,20 @@ * 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"; - -var EXPORTED_SYMBOLS = ["Runtime"]; - -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); +import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; const { addDebuggerToGlobal } = ChromeUtils.import( "resource://gre/modules/jsdebugger.jsm" ); -const { ContentProcessDomain } = ChromeUtils.import( - "chrome://remote/content/cdp/domains/ContentProcessDomain.jsm" -); + +import { ContentProcessDomain } from "chrome://remote/content/cdp/domains/ContentProcessDomain.sys.mjs"; const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { executeSoon: "chrome://remote/content/shared/Sync.sys.mjs", -}); - -XPCOMUtils.defineLazyModuleGetters(lazy, { ExecutionContext: - "chrome://remote/content/cdp/domains/content/runtime/ExecutionContext.jsm", + "chrome://remote/content/cdp/domains/content/runtime/ExecutionContext.sys.mjs", }); XPCOMUtils.defineLazyGetter(lazy, "ConsoleAPIStorage", () => { @@ -68,7 +58,7 @@ class SetMap extends Map { } } -class Runtime extends ContentProcessDomain { +export class Runtime extends ContentProcessDomain { constructor(session) { super(session); this.enabled = false; diff --git a/remote/cdp/domains/content/Performance.jsm b/remote/cdp/domains/content/Security.sys.mjs similarity index 69% rename from remote/cdp/domains/content/Performance.jsm rename to remote/cdp/domains/content/Security.sys.mjs index 865fa5a3daf5..7d21d386b4fe 100644 --- a/remote/cdp/domains/content/Performance.jsm +++ b/remote/cdp/domains/content/Security.sys.mjs @@ -2,15 +2,9 @@ * 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 { ContentProcessDomain } from "chrome://remote/content/cdp/domains/ContentProcessDomain.sys.mjs"; -var EXPORTED_SYMBOLS = ["Performance"]; - -const { ContentProcessDomain } = ChromeUtils.import( - "chrome://remote/content/cdp/domains/ContentProcessDomain.jsm" -); - -class Performance extends ContentProcessDomain { +export class Security extends ContentProcessDomain { constructor(session) { super(session); this.enabled = false; diff --git a/remote/cdp/domains/content/runtime/ExecutionContext.jsm b/remote/cdp/domains/content/runtime/ExecutionContext.sys.mjs similarity index 99% rename from remote/cdp/domains/content/runtime/ExecutionContext.jsm rename to remote/cdp/domains/content/runtime/ExecutionContext.sys.mjs index 0e3bdbd75777..8e5a49677087 100644 --- a/remote/cdp/domains/content/runtime/ExecutionContext.jsm +++ b/remote/cdp/domains/content/runtime/ExecutionContext.sys.mjs @@ -2,10 +2,6 @@ * 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"; - -var EXPORTED_SYMBOLS = ["ExecutionContext"]; - const TYPED_ARRAY_CLASSES = [ "Uint8Array", "Uint8ClampedArray", @@ -36,7 +32,7 @@ function uuid() { * The debuggable context's global object. This is typically the document window * object. But it can also be any global object, like a worker global scope object. */ -class ExecutionContext { +export class ExecutionContext { constructor(dbg, debuggee, id, isDefault) { this._debugger = dbg; this._debuggee = this._debugger.addDebuggee(debuggee); diff --git a/remote/cdp/domains/parent/Browser.jsm b/remote/cdp/domains/parent/Browser.sys.mjs similarity index 87% rename from remote/cdp/domains/parent/Browser.jsm rename to remote/cdp/domains/parent/Browser.sys.mjs index 63635498f65d..2e292c9febb6 100644 --- a/remote/cdp/domains/parent/Browser.jsm +++ b/remote/cdp/domains/parent/Browser.sys.mjs @@ -2,15 +2,9 @@ * 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 { Domain } from "chrome://remote/content/cdp/domains/Domain.sys.mjs"; -var EXPORTED_SYMBOLS = ["Browser"]; - -const { Domain } = ChromeUtils.import( - "chrome://remote/content/cdp/domains/Domain.jsm" -); - -class Browser extends Domain { +export class Browser extends Domain { getVersion() { const { isHeadless } = Cc["@mozilla.org/gfx/info;1"].getService( Ci.nsIGfxInfo diff --git a/remote/cdp/domains/parent/Emulation.jsm b/remote/cdp/domains/parent/Emulation.sys.mjs similarity index 94% rename from remote/cdp/domains/parent/Emulation.jsm rename to remote/cdp/domains/parent/Emulation.sys.mjs index efe361eb171a..f5ce827f0eb9 100644 --- a/remote/cdp/domains/parent/Emulation.jsm +++ b/remote/cdp/domains/parent/Emulation.sys.mjs @@ -2,17 +2,9 @@ * 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"; -var EXPORTED_SYMBOLS = ["Emulation"]; - -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); - -const { Domain } = ChromeUtils.import( - "chrome://remote/content/cdp/domains/Domain.jsm" -); +import { Domain } from "chrome://remote/content/cdp/domains/Domain.sys.mjs"; const lazy = {}; @@ -22,7 +14,7 @@ XPCOMUtils.defineLazyModuleGetters(lazy, { const MAX_WINDOW_SIZE = 10000000; -class Emulation extends Domain { +export class Emulation extends Domain { destructor() { this.setUserAgentOverride({ userAgent: "", platform: "" }); diff --git a/remote/cdp/domains/parent/Fetch.jsm b/remote/cdp/domains/parent/Fetch.sys.mjs similarity index 77% rename from remote/cdp/domains/parent/Fetch.jsm rename to remote/cdp/domains/parent/Fetch.sys.mjs index e4f26e2b1fb4..39e6965ccd9e 100644 --- a/remote/cdp/domains/parent/Fetch.jsm +++ b/remote/cdp/domains/parent/Fetch.sys.mjs @@ -2,18 +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"; - -var EXPORTED_SYMBOLS = ["Fetch"]; - -const { Domain } = ChromeUtils.import( - "chrome://remote/content/cdp/domains/Domain.jsm" -); +import { Domain } from "chrome://remote/content/cdp/domains/Domain.sys.mjs"; // Note: For now this domain has only been added so that clients using CDP // (like Selenium) don't break when trying to disable Fetch events. -class Fetch extends Domain { +export class Fetch extends Domain { constructor(session) { super(session); diff --git a/remote/cdp/domains/parent/IO.jsm b/remote/cdp/domains/parent/IO.sys.mjs similarity index 88% rename from remote/cdp/domains/parent/IO.jsm rename to remote/cdp/domains/parent/IO.sys.mjs index e7a3a113f188..f0877d017f32 100644 --- a/remote/cdp/domains/parent/IO.jsm +++ b/remote/cdp/domains/parent/IO.sys.mjs @@ -2,20 +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"; +import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; -var EXPORTED_SYMBOLS = ["IO", "streamRegistry"]; - -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); - -const { Domain } = ChromeUtils.import( - "chrome://remote/content/cdp/domains/Domain.jsm" -); -const { StreamRegistry } = ChromeUtils.import( - "chrome://remote/content/cdp/StreamRegistry.jsm" -); +import { Domain } from "chrome://remote/content/cdp/domains/Domain.sys.mjs"; +import { StreamRegistry } from "chrome://remote/content/cdp/StreamRegistry.sys.mjs"; const lazy = {}; @@ -26,9 +16,9 @@ XPCOMUtils.defineLazyModuleGetters(lazy, { const DEFAULT_CHUNK_SIZE = 10 * 1024 * 1024; // Global singleton for managing open streams -const streamRegistry = new StreamRegistry(); +export const streamRegistry = new StreamRegistry(); -class IO extends Domain { +export class IO extends Domain { // commands /** diff --git a/remote/cdp/domains/parent/Input.jsm b/remote/cdp/domains/parent/Input.sys.mjs similarity index 96% rename from remote/cdp/domains/parent/Input.jsm rename to remote/cdp/domains/parent/Input.sys.mjs index 1bd89bd2f3d3..b3b7fd253bb5 100644 --- a/remote/cdp/domains/parent/Input.jsm +++ b/remote/cdp/domains/parent/Input.sys.mjs @@ -2,15 +2,9 @@ * 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 { Domain } from "chrome://remote/content/cdp/domains/Domain.sys.mjs"; -var EXPORTED_SYMBOLS = ["Input"]; - -const { Domain } = ChromeUtils.import( - "chrome://remote/content/cdp/domains/Domain.jsm" -); - -class Input extends Domain { +export class Input extends Domain { // commands /** diff --git a/remote/cdp/domains/parent/Network.jsm b/remote/cdp/domains/parent/Network.sys.mjs similarity index 98% rename from remote/cdp/domains/parent/Network.jsm rename to remote/cdp/domains/parent/Network.sys.mjs index c0c169f4acb9..e100ce8cc7e5 100644 --- a/remote/cdp/domains/parent/Network.jsm +++ b/remote/cdp/domains/parent/Network.sys.mjs @@ -2,13 +2,7 @@ * 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"; - -var EXPORTED_SYMBOLS = ["Network"]; - -const { Domain } = ChromeUtils.import( - "chrome://remote/content/cdp/domains/Domain.jsm" -); +import { Domain } from "chrome://remote/content/cdp/domains/Domain.sys.mjs"; const MAX_COOKIE_EXPIRY = Number.MAX_SAFE_INTEGER; @@ -36,7 +30,7 @@ const LOAD_CAUSE_STRINGS = { [Ci.nsIContentPolicy.TYPE_WEB_MANIFEST]: "WebManifest", }; -class Network extends Domain { +export class Network extends Domain { constructor(session) { super(session); this.enabled = false; diff --git a/remote/cdp/domains/parent/Page.jsm b/remote/cdp/domains/parent/Page.sys.mjs similarity index 98% rename from remote/cdp/domains/parent/Page.jsm rename to remote/cdp/domains/parent/Page.sys.mjs index c96d87f7cc28..1e3028719625 100644 --- a/remote/cdp/domains/parent/Page.jsm +++ b/remote/cdp/domains/parent/Page.sys.mjs @@ -2,23 +2,19 @@ * 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"; -var EXPORTED_SYMBOLS = ["Page"]; - -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); - -const { Domain } = ChromeUtils.import( - "chrome://remote/content/cdp/domains/Domain.jsm" -); +import { Domain } from "chrome://remote/content/cdp/domains/Domain.sys.mjs"; const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { + DialogHandler: + "chrome://remote/content/cdp/domains/parent/page/DialogHandler.sys.mjs", PollPromise: "chrome://remote/content/shared/Sync.sys.mjs", + streamRegistry: "chrome://remote/content/cdp/domains/parent/IO.sys.mjs", TabManager: "chrome://remote/content/shared/TabManager.sys.mjs", + UnsupportedError: "chrome://remote/content/cdp/Error.sys.mjs", windowManager: "chrome://remote/content/shared/WindowManager.sys.mjs", }); @@ -27,11 +23,6 @@ XPCOMUtils.defineLazyModuleGetters(lazy, { OS: "resource://gre/modules/osfile.jsm", SessionStore: "resource:///modules/sessionstore/SessionStore.jsm", setInterval: "resource://gre/modules/Timer.jsm", - - DialogHandler: - "chrome://remote/content/cdp/domains/parent/page/DialogHandler.jsm", - streamRegistry: "chrome://remote/content/cdp/domains/parent/IO.jsm", - UnsupportedError: "chrome://remote/content/cdp/Error.jsm", }); const MAX_CANVAS_DIMENSION = 32767; @@ -47,7 +38,7 @@ const PDF_TRANSFER_MODES = { const TIMEOUT_SET_HISTORY_INDEX = 1000; -class Page extends Domain { +export class Page extends Domain { constructor(session) { super(session); diff --git a/remote/cdp/domains/parent/Security.jsm b/remote/cdp/domains/parent/Security.sys.mjs similarity index 85% rename from remote/cdp/domains/parent/Security.jsm rename to remote/cdp/domains/parent/Security.sys.mjs index 217578bd7736..1b4954751c84 100644 --- a/remote/cdp/domains/parent/Security.jsm +++ b/remote/cdp/domains/parent/Security.sys.mjs @@ -2,17 +2,9 @@ * 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"; -var EXPORTED_SYMBOLS = ["Security"]; - -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); - -const { Domain } = ChromeUtils.import( - "chrome://remote/content/cdp/domains/Domain.jsm" -); +import { Domain } from "chrome://remote/content/cdp/domains/Domain.sys.mjs"; const lazy = {}; @@ -31,7 +23,7 @@ XPCOMUtils.defineLazyServiceGetters(lazy, { const CERT_PINNING_ENFORCEMENT_PREF = "security.cert_pinning.enforcement_level"; const HSTS_PRELOAD_LIST_PREF = "network.stricttransportsecurity.preloadlist"; -class Security extends Domain { +export class Security extends Domain { destructor() { this.setIgnoreCertificateErrors({ ignore: false }); } diff --git a/remote/cdp/domains/parent/Target.jsm b/remote/cdp/domains/parent/Target.sys.mjs similarity index 92% rename from remote/cdp/domains/parent/Target.jsm rename to remote/cdp/domains/parent/Target.sys.mjs index f8369c0e348b..035e8d14021d 100644 --- a/remote/cdp/domains/parent/Target.jsm +++ b/remote/cdp/domains/parent/Target.sys.mjs @@ -2,37 +2,28 @@ * 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"; -var EXPORTED_SYMBOLS = ["Target"]; - -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); - -const { Domain } = ChromeUtils.import( - "chrome://remote/content/cdp/domains/Domain.jsm" -); +import { Domain } from "chrome://remote/content/cdp/domains/Domain.sys.mjs"; const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { + MainProcessTarget: + "chrome://remote/content/cdp/targets/MainProcessTarget.sys.mjs", TabManager: "chrome://remote/content/shared/TabManager.sys.mjs", + TabSession: "chrome://remote/content/cdp/sessions/TabSession.sys.mjs", windowManager: "chrome://remote/content/shared/WindowManager.sys.mjs", }); XPCOMUtils.defineLazyModuleGetters(lazy, { ContextualIdentityService: "resource://gre/modules/ContextualIdentityService.jsm", - - MainProcessTarget: - "chrome://remote/content/cdp/targets/MainProcessTarget.jsm", - TabSession: "chrome://remote/content/cdp/sessions/TabSession.jsm", }); let browserContextIds = 1; -class Target extends Domain { +export class Target extends Domain { constructor(session) { super(session); diff --git a/remote/cdp/domains/parent/page/DialogHandler.jsm b/remote/cdp/domains/parent/page/DialogHandler.sys.mjs similarity index 95% rename from remote/cdp/domains/parent/page/DialogHandler.jsm rename to remote/cdp/domains/parent/page/DialogHandler.sys.mjs index a31480628d72..ba809d439f44 100644 --- a/remote/cdp/domains/parent/page/DialogHandler.jsm +++ b/remote/cdp/domains/parent/page/DialogHandler.sys.mjs @@ -2,13 +2,7 @@ * 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"; - -var EXPORTED_SYMBOLS = ["DialogHandler"]; - -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); +import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; const lazy = {}; @@ -33,7 +27,7 @@ const DIALOG_TYPES = { * * @param {BrowserElement} browser */ -class DialogHandler { +export class DialogHandler { constructor(browser) { lazy.EventEmitter.decorate(this); this._dialog = null; diff --git a/remote/cdp/jar.mn b/remote/cdp/jar.mn index 10df08e8901e..83ff86fdbc97 100644 --- a/remote/cdp/jar.mn +++ b/remote/cdp/jar.mn @@ -4,51 +4,51 @@ remote.jar: % content remote %content/ - content/cdp/CDP.jsm (CDP.jsm) - content/cdp/CDPConnection.jsm (CDPConnection.jsm) - content/cdp/Error.jsm (Error.jsm) - content/cdp/JSONHandler.jsm (JSONHandler.jsm) - content/cdp/Protocol.jsm (Protocol.jsm) - content/cdp/StreamRegistry.jsm (StreamRegistry.jsm) + content/cdp/CDP.sys.mjs (CDP.sys.mjs) + content/cdp/CDPConnection.sys.mjs (CDPConnection.sys.mjs) + content/cdp/Error.sys.mjs (Error.sys.mjs) + content/cdp/JSONHandler.sys.mjs (JSONHandler.sys.mjs) + content/cdp/Protocol.sys.mjs (Protocol.sys.mjs) + content/cdp/StreamRegistry.sys.mjs (StreamRegistry.sys.mjs) # domains - content/cdp/domains/ContentProcessDomain.jsm (domains/ContentProcessDomain.jsm) - content/cdp/domains/ContentProcessDomains.jsm (domains/ContentProcessDomains.jsm) - content/cdp/domains/Domain.jsm (domains/Domain.jsm) - content/cdp/domains/DomainCache.jsm (domains/DomainCache.jsm) - content/cdp/domains/ParentProcessDomains.jsm (domains/ParentProcessDomains.jsm) - content/cdp/domains/content/DOM.jsm (domains/content/DOM.jsm) - content/cdp/domains/content/Emulation.jsm (domains/content/Emulation.jsm) - content/cdp/domains/content/Input.jsm (domains/content/Input.jsm) - content/cdp/domains/content/Log.jsm (domains/content/Log.jsm) - content/cdp/domains/content/Network.jsm (domains/content/Network.jsm) - content/cdp/domains/content/Page.jsm (domains/content/Page.jsm) - content/cdp/domains/content/Performance.jsm (domains/content/Performance.jsm) - content/cdp/domains/content/Runtime.jsm (domains/content/Runtime.jsm) - content/cdp/domains/content/runtime/ExecutionContext.jsm (domains/content/runtime/ExecutionContext.jsm) - content/cdp/domains/content/Security.jsm (domains/content/Security.jsm) - content/cdp/domains/parent/Browser.jsm (domains/parent/Browser.jsm) - content/cdp/domains/parent/Emulation.jsm (domains/parent/Emulation.jsm) - content/cdp/domains/parent/Fetch.jsm (domains/parent/Fetch.jsm) - content/cdp/domains/parent/Input.jsm (domains/parent/Input.jsm) - content/cdp/domains/parent/IO.jsm (domains/parent/IO.jsm) - content/cdp/domains/parent/Network.jsm (domains/parent/Network.jsm) - content/cdp/domains/parent/Page.jsm (domains/parent/Page.jsm) - content/cdp/domains/parent/page/DialogHandler.jsm (domains/parent/page/DialogHandler.jsm) - content/cdp/domains/parent/Security.jsm (domains/parent/Security.jsm) - content/cdp/domains/parent/Target.jsm (domains/parent/Target.jsm) + content/cdp/domains/ContentProcessDomain.sys.mjs (domains/ContentProcessDomain.sys.mjs) + content/cdp/domains/ContentProcessDomains.sys.mjs (domains/ContentProcessDomains.sys.mjs) + content/cdp/domains/Domain.sys.mjs (domains/Domain.sys.mjs) + content/cdp/domains/DomainCache.sys.mjs (domains/DomainCache.sys.mjs) + content/cdp/domains/ParentProcessDomains.sys.mjs (domains/ParentProcessDomains.sys.mjs) + content/cdp/domains/content/DOM.sys.mjs (domains/content/DOM.sys.mjs) + content/cdp/domains/content/Emulation.sys.mjs (domains/content/Emulation.sys.mjs) + content/cdp/domains/content/Input.sys.mjs (domains/content/Input.sys.mjs) + content/cdp/domains/content/Log.sys.mjs (domains/content/Log.sys.mjs) + content/cdp/domains/content/Network.sys.mjs (domains/content/Network.sys.mjs) + content/cdp/domains/content/Page.sys.mjs (domains/content/Page.sys.mjs) + content/cdp/domains/content/Performance.sys.mjs (domains/content/Performance.sys.mjs) + content/cdp/domains/content/Runtime.sys.mjs (domains/content/Runtime.sys.mjs) + content/cdp/domains/content/runtime/ExecutionContext.sys.mjs (domains/content/runtime/ExecutionContext.sys.mjs) + content/cdp/domains/content/Security.sys.mjs (domains/content/Security.sys.mjs) + content/cdp/domains/parent/Browser.sys.mjs (domains/parent/Browser.sys.mjs) + content/cdp/domains/parent/Emulation.sys.mjs (domains/parent/Emulation.sys.mjs) + content/cdp/domains/parent/Fetch.sys.mjs (domains/parent/Fetch.sys.mjs) + content/cdp/domains/parent/Input.sys.mjs (domains/parent/Input.sys.mjs) + content/cdp/domains/parent/IO.sys.mjs (domains/parent/IO.sys.mjs) + content/cdp/domains/parent/Network.sys.mjs (domains/parent/Network.sys.mjs) + content/cdp/domains/parent/Page.sys.mjs (domains/parent/Page.sys.mjs) + content/cdp/domains/parent/page/DialogHandler.sys.mjs (domains/parent/page/DialogHandler.sys.mjs) + content/cdp/domains/parent/Security.sys.mjs (domains/parent/Security.sys.mjs) + content/cdp/domains/parent/Target.sys.mjs (domains/parent/Target.sys.mjs) # observers - content/cdp/observers/ChannelEventSink.jsm (observers/ChannelEventSink.jsm) - content/cdp/observers/ContextObserver.jsm (observers/ContextObserver.jsm) - content/cdp/observers/NetworkObserver.jsm (observers/NetworkObserver.jsm) - content/cdp/observers/TargetObserver.jsm (observers/TargetObserver.jsm) + content/cdp/observers/ChannelEventSink.sys.mjs (observers/ChannelEventSink.sys.mjs) + content/cdp/observers/ContextObserver.sys.mjs (observers/ContextObserver.sys.mjs) + content/cdp/observers/NetworkObserver.sys.mjs (observers/NetworkObserver.sys.mjs) + content/cdp/observers/TargetObserver.sys.mjs (observers/TargetObserver.sys.mjs) # sessions content/cdp/sessions/frame-script.js (sessions/frame-script.js) - content/cdp/sessions/ContentProcessSession.jsm (sessions/ContentProcessSession.jsm) - content/cdp/sessions/MainProcessSession.jsm (sessions/MainProcessSession.jsm) - content/cdp/sessions/Session.jsm (sessions/Session.jsm) - content/cdp/sessions/TabSession.jsm (sessions/TabSession.jsm) + content/cdp/sessions/ContentProcessSession.sys.mjs (sessions/ContentProcessSession.sys.mjs) + content/cdp/sessions/MainProcessSession.sys.mjs (sessions/MainProcessSession.sys.mjs) + content/cdp/sessions/Session.sys.mjs (sessions/Session.sys.mjs) + content/cdp/sessions/TabSession.sys.mjs (sessions/TabSession.sys.mjs) # targets - content/cdp/targets/MainProcessTarget.jsm (targets/MainProcessTarget.jsm) - content/cdp/targets/TabTarget.jsm (targets/TabTarget.jsm) - content/cdp/targets/Target.jsm (targets/Target.jsm) - content/cdp/targets/TargetList.jsm (targets/TargetList.jsm) + content/cdp/targets/MainProcessTarget.sys.mjs (targets/MainProcessTarget.sys.mjs) + content/cdp/targets/TabTarget.sys.mjs (targets/TabTarget.sys.mjs) + content/cdp/targets/Target.sys.mjs (targets/Target.sys.mjs) + content/cdp/targets/TargetList.sys.mjs (targets/TargetList.sys.mjs) diff --git a/remote/cdp/observers/ChannelEventSink.jsm b/remote/cdp/observers/ChannelEventSink.sys.mjs similarity index 95% rename from remote/cdp/observers/ChannelEventSink.jsm rename to remote/cdp/observers/ChannelEventSink.sys.mjs index 8874672faabd..a8b4eb69a7e1 100644 --- a/remote/cdp/observers/ChannelEventSink.jsm +++ b/remote/cdp/observers/ChannelEventSink.sys.mjs @@ -2,10 +2,6 @@ * 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"; - -var EXPORTED_SYMBOLS = ["ChannelEventSinkFactory"]; - const { ComponentUtils } = ChromeUtils.import( "resource://gre/modules/ComponentUtils.jsm" ); @@ -61,7 +57,7 @@ ChannelEventSink.prototype = { }, }; -const ChannelEventSinkFactory = ComponentUtils.generateSingletonFactory( +export const ChannelEventSinkFactory = ComponentUtils.generateSingletonFactory( ChannelEventSink ); diff --git a/remote/cdp/observers/ContextObserver.jsm b/remote/cdp/observers/ContextObserver.sys.mjs similarity index 97% rename from remote/cdp/observers/ContextObserver.jsm rename to remote/cdp/observers/ContextObserver.sys.mjs index 4da62652f832..68e27cfcc0e0 100644 --- a/remote/cdp/observers/ContextObserver.jsm +++ b/remote/cdp/observers/ContextObserver.sys.mjs @@ -2,8 +2,6 @@ * 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"; - /** * Helper class to coordinate Runtime and Page events. * Events have to be sent in the following order: @@ -23,11 +21,7 @@ * being destroyed and the document navigated. */ -var EXPORTED_SYMBOLS = ["ContextObserver"]; - -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); +import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; const lazy = {}; @@ -39,7 +33,7 @@ XPCOMUtils.defineLazyModuleGetters(lazy, { EventEmitter: "resource://gre/modules/EventEmitter.jsm", }); -class ContextObserver { +export class ContextObserver { constructor(chromeEventHandler) { this.chromeEventHandler = chromeEventHandler; lazy.EventEmitter.decorate(this); diff --git a/remote/cdp/observers/NetworkObserver.jsm b/remote/cdp/observers/NetworkObserver.sys.mjs similarity index 98% rename from remote/cdp/observers/NetworkObserver.jsm rename to remote/cdp/observers/NetworkObserver.sys.mjs index e9fab08ff784..05ce98b4d6ff 100644 --- a/remote/cdp/observers/NetworkObserver.jsm +++ b/remote/cdp/observers/NetworkObserver.sys.mjs @@ -2,21 +2,19 @@ * 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 { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); +import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; const lazy = {}; +ChromeUtils.defineESModuleGetters(lazy, { + ChannelEventSinkFactory: + "chrome://remote/content/cdp/observers/ChannelEventSink.sys.mjs", +}); + XPCOMUtils.defineLazyModuleGetters(lazy, { CommonUtils: "resource://services-common/utils.js", EventEmitter: "resource://gre/modules/EventEmitter.jsm", NetUtil: "resource://gre/modules/NetUtil.jsm", - - ChannelEventSinkFactory: - "chrome://remote/content/cdp/observers/ChannelEventSink.jsm", }); XPCOMUtils.defineLazyServiceGetter( @@ -51,7 +49,7 @@ XPCOMUtils.defineLazyGetter(lazy, "StorageStream", () => { // Cap response storage with 100Mb per tracked tab. const MAX_RESPONSE_STORAGE_SIZE = 100 * 1024 * 1024; -class NetworkObserver { +export class NetworkObserver { constructor() { lazy.EventEmitter.decorate(this); this._browserSessionCount = new Map(); @@ -632,5 +630,3 @@ function getNetworkErrorStatusText(status) { } return ""; } - -var EXPORTED_SYMBOLS = ["NetworkObserver"]; diff --git a/remote/cdp/observers/TargetObserver.jsm b/remote/cdp/observers/TargetObserver.sys.mjs similarity index 95% rename from remote/cdp/observers/TargetObserver.jsm rename to remote/cdp/observers/TargetObserver.sys.mjs index 30f1a3f92df7..25594e0c76b3 100644 --- a/remote/cdp/observers/TargetObserver.jsm +++ b/remote/cdp/observers/TargetObserver.sys.mjs @@ -2,13 +2,7 @@ * 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"; - -var EXPORTED_SYMBOLS = ["TabObserver"]; - -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); +import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; const lazy = {}; @@ -34,7 +28,7 @@ XPCOMUtils.defineLazyModuleGetters(lazy, { * "open" fires when a tab opens. * "close" fires when a tab closes. */ -class TabObserver { +export class TabObserver { /** * @param {boolean?} [false] registerExisting * Events will be fired for ChromeWIndows and their respective tabs diff --git a/remote/cdp/sessions/ContentProcessSession.jsm b/remote/cdp/sessions/ContentProcessSession.sys.mjs similarity index 88% rename from remote/cdp/sessions/ContentProcessSession.jsm rename to remote/cdp/sessions/ContentProcessSession.sys.mjs index a72a12eea892..d7aa3de57b59 100644 --- a/remote/cdp/sessions/ContentProcessSession.jsm +++ b/remote/cdp/sessions/ContentProcessSession.sys.mjs @@ -2,24 +2,17 @@ * 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"; - -var EXPORTED_SYMBOLS = ["ContentProcessSession"]; - -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); - const lazy = {}; -XPCOMUtils.defineLazyModuleGetters(lazy, { +ChromeUtils.defineESModuleGetters(lazy, { ContentProcessDomains: - "chrome://remote/content/cdp/domains/ContentProcessDomains.jsm", - ContextObserver: "chrome://remote/content/cdp/observers/ContextObserver.jsm", - DomainCache: "chrome://remote/content/cdp/domains/DomainCache.jsm", + "chrome://remote/content/cdp/domains/ContentProcessDomains.sys.mjs", + ContextObserver: + "chrome://remote/content/cdp/observers/ContextObserver.sys.mjs", + DomainCache: "chrome://remote/content/cdp/domains/DomainCache.sys.mjs", }); -class ContentProcessSession { +export class ContentProcessSession { constructor(messageManager, browsingContext, content, docShell) { this.messageManager = messageManager; this.browsingContext = browsingContext; diff --git a/remote/cdp/sessions/MainProcessSession.jsm b/remote/cdp/sessions/MainProcessSession.sys.mjs similarity index 65% rename from remote/cdp/sessions/MainProcessSession.jsm rename to remote/cdp/sessions/MainProcessSession.sys.mjs index e9cbd299e5f1..259e1312accf 100644 --- a/remote/cdp/sessions/MainProcessSession.jsm +++ b/remote/cdp/sessions/MainProcessSession.sys.mjs @@ -2,17 +2,11 @@ * 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"; - -var EXPORTED_SYMBOLS = ["MainProcessSession"]; - -const { Session } = ChromeUtils.import( - "chrome://remote/content/cdp/sessions/Session.jsm" -); +import { Session } from "chrome://remote/content/cdp/sessions/Session.sys.mjs"; /** * A session, dedicated to the main process target. * For some reason, it doesn't need any specific code and can share the base Session class * aside TabSession. */ -class MainProcessSession extends Session {} +export class MainProcessSession extends Session {} diff --git a/remote/cdp/sessions/Session.jsm b/remote/cdp/sessions/Session.sys.mjs similarity index 87% rename from remote/cdp/sessions/Session.jsm rename to remote/cdp/sessions/Session.sys.mjs index 40b530bd8912..f1d066ce7730 100644 --- a/remote/cdp/sessions/Session.jsm +++ b/remote/cdp/sessions/Session.sys.mjs @@ -2,21 +2,14 @@ * 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"; - -var EXPORTED_SYMBOLS = ["Session"]; - -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); - const lazy = {}; -XPCOMUtils.defineLazyModuleGetters(lazy, { - DomainCache: "chrome://remote/content/cdp/domains/DomainCache.jsm", - NetworkObserver: "chrome://remote/content/cdp/observers/NetworkObserver.jsm", +ChromeUtils.defineESModuleGetters(lazy, { + DomainCache: "chrome://remote/content/cdp/domains/DomainCache.sys.mjs", + NetworkObserver: + "chrome://remote/content/cdp/observers/NetworkObserver.sys.mjs", ParentProcessDomains: - "chrome://remote/content/cdp/domains/ParentProcessDomains.jsm", + "chrome://remote/content/cdp/domains/ParentProcessDomains.sys.mjs", }); /** @@ -32,7 +25,7 @@ XPCOMUtils.defineLazyModuleGetters(lazy, { * will have a `sessionId` attribute in order to filter the packets * by session both on client and server side. */ -class Session { +export class Session { /** * @param Connection connection * The connection used to communicate with the server. diff --git a/remote/cdp/sessions/TabSession.jsm b/remote/cdp/sessions/TabSession.sys.mjs similarity index 95% rename from remote/cdp/sessions/TabSession.jsm rename to remote/cdp/sessions/TabSession.sys.mjs index 20ac4516588a..a6b9fbf83a9d 100644 --- a/remote/cdp/sessions/TabSession.jsm +++ b/remote/cdp/sessions/TabSession.sys.mjs @@ -2,18 +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"; - -var EXPORTED_SYMBOLS = ["TabSession"]; - -const { Session } = ChromeUtils.import( - "chrome://remote/content/cdp/sessions/Session.jsm" -); +import { Session } from "chrome://remote/content/cdp/sessions/Session.sys.mjs"; /** * A session to communicate with a given tab */ -class TabSession extends Session { +export class TabSession extends Session { /** * @param Connection connection * The connection used to communicate with the server. diff --git a/remote/cdp/sessions/frame-script.js b/remote/cdp/sessions/frame-script.js index 864d1859fca5..88071086cb17 100644 --- a/remote/cdp/sessions/frame-script.js +++ b/remote/cdp/sessions/frame-script.js @@ -6,8 +6,8 @@ "use strict"; -const { ContentProcessSession } = ChromeUtils.import( - "chrome://remote/content/cdp/sessions/ContentProcessSession.jsm" +const { ContentProcessSession } = ChromeUtils.importESModule( + "chrome://remote/content/cdp/sessions/ContentProcessSession.sys.mjs" ); new ContentProcessSession(this, docShell.browsingContext, content, docShell); diff --git a/remote/cdp/targets/MainProcessTarget.jsm b/remote/cdp/targets/MainProcessTarget.sys.mjs similarity index 76% rename from remote/cdp/targets/MainProcessTarget.jsm rename to remote/cdp/targets/MainProcessTarget.sys.mjs index e9be9c4c4ede..1f32b5bde592 100644 --- a/remote/cdp/targets/MainProcessTarget.jsm +++ b/remote/cdp/targets/MainProcessTarget.sys.mjs @@ -2,27 +2,14 @@ * 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"; - -var EXPORTED_SYMBOLS = ["MainProcessTarget"]; - -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); - -const { Target } = ChromeUtils.import( - "chrome://remote/content/cdp/targets/Target.jsm" -); +import { Target } from "chrome://remote/content/cdp/targets/Target.sys.mjs"; const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { - RemoteAgent: "chrome://remote/content/components/RemoteAgent.sys.mjs", -}); - -XPCOMUtils.defineLazyModuleGetters(lazy, { MainProcessSession: - "chrome://remote/content/cdp/sessions/MainProcessSession.jsm", + "chrome://remote/content/cdp/sessions/MainProcessSession.sys.mjs", + RemoteAgent: "chrome://remote/content/components/RemoteAgent.sys.mjs", }); /** @@ -31,7 +18,7 @@ XPCOMUtils.defineLazyModuleGetters(lazy, { * Matches BrowserDevToolsAgentHost from chromium, and only support a couple of Domains: * https://cs.chromium.org/chromium/src/content/browser/devtools/browser_devtools_agent_host.cc?dr=CSs&g=0&l=80-91 */ -class MainProcessTarget extends Target { +export class MainProcessTarget extends Target { /* * @param TargetList targetList */ diff --git a/remote/cdp/targets/TabTarget.jsm b/remote/cdp/targets/TabTarget.sys.mjs similarity index 90% rename from remote/cdp/targets/TabTarget.jsm rename to remote/cdp/targets/TabTarget.sys.mjs index 2f4a95e4856a..a3db99c0dd0a 100644 --- a/remote/cdp/targets/TabTarget.jsm +++ b/remote/cdp/targets/TabTarget.sys.mjs @@ -2,27 +2,16 @@ * 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"; -var EXPORTED_SYMBOLS = ["TabTarget"]; - -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); - -const { Target } = ChromeUtils.import( - "chrome://remote/content/cdp/targets/Target.jsm" -); +import { Target } from "chrome://remote/content/cdp/targets/Target.sys.mjs"; const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { RemoteAgent: "chrome://remote/content/components/RemoteAgent.sys.mjs", TabManager: "chrome://remote/content/shared/TabManager.sys.mjs", -}); - -XPCOMUtils.defineLazyModuleGetters(lazy, { - TabSession: "chrome://remote/content/cdp/sessions/TabSession.jsm", + TabSession: "chrome://remote/content/cdp/sessions/TabSession.sys.mjs", }); XPCOMUtils.defineLazyServiceGetter( @@ -35,7 +24,7 @@ XPCOMUtils.defineLazyServiceGetter( /** * Target for a local tab or a remoted frame. */ -class TabTarget extends Target { +export class TabTarget extends Target { /** * @param TargetList targetList * @param BrowserElement browser diff --git a/remote/cdp/targets/Target.jsm b/remote/cdp/targets/Target.sys.mjs similarity index 86% rename from remote/cdp/targets/Target.jsm rename to remote/cdp/targets/Target.sys.mjs index b3461672ae86..71a8fbbd1c76 100644 --- a/remote/cdp/targets/Target.jsm +++ b/remote/cdp/targets/Target.sys.mjs @@ -2,29 +2,18 @@ * 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"; - -var EXPORTED_SYMBOLS = ["Target"]; - -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); - const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { + CDPConnection: "chrome://remote/content/cdp/CDPConnection.sys.mjs", WebSocketHandshake: "chrome://remote/content/server/WebSocketHandshake.sys.mjs", }); -XPCOMUtils.defineLazyModuleGetters(lazy, { - CDPConnection: "chrome://remote/content/cdp/CDPConnection.jsm", -}); - /** * Base class for all the targets. */ -class Target { +export class Target { /** * @param TargetList targetList * @param Class sessionClass diff --git a/remote/cdp/targets/TargetList.jsm b/remote/cdp/targets/TargetList.sys.mjs similarity index 92% rename from remote/cdp/targets/TargetList.jsm rename to remote/cdp/targets/TargetList.sys.mjs index f21000b8acad..75ab0ec183c4 100644 --- a/remote/cdp/targets/TargetList.jsm +++ b/remote/cdp/targets/TargetList.sys.mjs @@ -2,30 +2,23 @@ * 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"; - -var EXPORTED_SYMBOLS = ["TargetList"]; - -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); +import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { + MainProcessTarget: + "chrome://remote/content/cdp/targets/MainProcessTarget.sys.mjs", TabManager: "chrome://remote/content/shared/TabManager.sys.mjs", + TabObserver: "chrome://remote/content/cdp/observers/TargetObserver.sys.mjs", + TabTarget: "chrome://remote/content/cdp/targets/TabTarget.sys.mjs", }); XPCOMUtils.defineLazyModuleGetters(lazy, { EventEmitter: "resource://gre/modules/EventEmitter.jsm", - - MainProcessTarget: - "chrome://remote/content/cdp/targets/MainProcessTarget.jsm", - TabObserver: "chrome://remote/content/cdp/observers/TargetObserver.jsm", - TabTarget: "chrome://remote/content/cdp/targets/TabTarget.jsm", }); -class TargetList { +export class TargetList { constructor() { // Target ID -> Target this._targets = new Map(); diff --git a/remote/cdp/test/browser/head.js b/remote/cdp/test/browser/head.js index f843ce711964..4a7fcbdd7893 100644 --- a/remote/cdp/test/browser/head.js +++ b/remote/cdp/test/browser/head.js @@ -8,8 +8,8 @@ const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm"); const { RemoteAgent } = ChromeUtils.importESModule( "chrome://remote/content/components/RemoteAgent.sys.mjs" ); -const { RemoteAgentError } = ChromeUtils.import( - "chrome://remote/content/cdp/Error.jsm" +const { RemoteAgentError } = ChromeUtils.importESModule( + "chrome://remote/content/cdp/Error.sys.mjs" ); const { TabManager } = ChromeUtils.importESModule( "chrome://remote/content/shared/TabManager.sys.mjs" diff --git a/remote/cdp/test/browser/input/head.js b/remote/cdp/test/browser/input/head.js index fe085fc7b2ae..9f15b9a933f2 100644 --- a/remote/cdp/test/browser/input/head.js +++ b/remote/cdp/test/browser/input/head.js @@ -10,8 +10,8 @@ Services.scriptloader.loadSubScript( this ); -const { Input: I } = ChromeUtils.import( - "chrome://remote/content/cdp/domains/parent/Input.jsm" +const { Input: I } = ChromeUtils.importESModule( + "chrome://remote/content/cdp/domains/parent/Input.sys.mjs" ); const { AppInfo } = ChromeUtils.importESModule( "chrome://remote/content/shared/AppInfo.sys.mjs" diff --git a/remote/cdp/test/browser/io/head.js b/remote/cdp/test/browser/io/head.js index a1eafb303dbf..dc9cc7cef81e 100644 --- a/remote/cdp/test/browser/io/head.js +++ b/remote/cdp/test/browser/io/head.js @@ -10,8 +10,8 @@ Services.scriptloader.loadSubScript( this ); -const { streamRegistry } = ChromeUtils.import( - "chrome://remote/content/cdp/domains/parent/IO.jsm" +const { streamRegistry } = ChromeUtils.importESModule( + "chrome://remote/content/cdp/domains/parent/IO.sys.mjs" ); async function registerFileStream(contents, options = {}) { diff --git a/remote/cdp/test/xpcshell/test_CDPConnection.js b/remote/cdp/test/xpcshell/test_CDPConnection.js index 139240bfd09e..41044702d1c1 100644 --- a/remote/cdp/test/xpcshell/test_CDPConnection.js +++ b/remote/cdp/test/xpcshell/test_CDPConnection.js @@ -3,8 +3,8 @@ "use strict"; -const { splitMethod } = ChromeUtils.import( - "chrome://remote/content/cdp/CDPConnection.jsm" +const { splitMethod } = ChromeUtils.importESModule( + "chrome://remote/content/cdp/CDPConnection.sys.mjs" ); add_test(function test_Connection_splitMethod() { diff --git a/remote/cdp/test/xpcshell/test_DomainCache.js b/remote/cdp/test/xpcshell/test_DomainCache.js index 33c29c481a13..8f303361beef 100644 --- a/remote/cdp/test/xpcshell/test_DomainCache.js +++ b/remote/cdp/test/xpcshell/test_DomainCache.js @@ -3,11 +3,11 @@ "use strict"; -const { Domain } = ChromeUtils.import( - "chrome://remote/content/cdp/domains/Domain.jsm" +const { Domain } = ChromeUtils.importESModule( + "chrome://remote/content/cdp/domains/Domain.sys.mjs" ); -const { DomainCache } = ChromeUtils.import( - "chrome://remote/content/cdp/domains/DomainCache.jsm" +const { DomainCache } = ChromeUtils.importESModule( + "chrome://remote/content/cdp/domains/DomainCache.sys.mjs" ); class MockSession { diff --git a/remote/cdp/test/xpcshell/test_Error.js b/remote/cdp/test/xpcshell/test_Error.js index 3d10b4b3d7d5..13ffc90566c3 100644 --- a/remote/cdp/test/xpcshell/test_Error.js +++ b/remote/cdp/test/xpcshell/test_Error.js @@ -8,7 +8,7 @@ const { RemoteAgentError, UnknownMethodError, UnsupportedError, -} = ChromeUtils.import("chrome://remote/content/cdp/Error.jsm"); +} = ChromeUtils.importESModule("chrome://remote/content/cdp/Error.sys.mjs"); add_test(function test_RemoteAgentError_ctor() { const e1 = new RemoteAgentError(); diff --git a/remote/cdp/test/xpcshell/test_Session.js b/remote/cdp/test/xpcshell/test_Session.js index 85795a34ca64..00758baa69be 100644 --- a/remote/cdp/test/xpcshell/test_Session.js +++ b/remote/cdp/test/xpcshell/test_Session.js @@ -3,8 +3,8 @@ "use strict"; -const { Session } = ChromeUtils.import( - "chrome://remote/content/cdp/sessions/Session.jsm" +const { Session } = ChromeUtils.importESModule( + "chrome://remote/content/cdp/sessions/Session.sys.mjs" ); const connection = { diff --git a/remote/cdp/test/xpcshell/test_StreamRegistry.js b/remote/cdp/test/xpcshell/test_StreamRegistry.js index 7a804a1dbd26..ffc1e59c52b3 100644 --- a/remote/cdp/test/xpcshell/test_StreamRegistry.js +++ b/remote/cdp/test/xpcshell/test_StreamRegistry.js @@ -5,8 +5,8 @@ const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm"); -const { StreamRegistry } = ChromeUtils.import( - "chrome://remote/content/cdp/StreamRegistry.jsm" +const { StreamRegistry } = ChromeUtils.importESModule( + "chrome://remote/content/cdp/StreamRegistry.sys.mjs" ); add_test(function test_constructor() { diff --git a/remote/components/RemoteAgent.sys.mjs b/remote/components/RemoteAgent.sys.mjs index e23105c8d572..a4b59fdffc37 100644 --- a/remote/components/RemoteAgent.sys.mjs +++ b/remote/components/RemoteAgent.sys.mjs @@ -7,13 +7,13 @@ import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { + CDP: "chrome://remote/content/cdp/CDP.sys.mjs", Deferred: "chrome://remote/content/shared/Sync.sys.mjs", Log: "chrome://remote/content/shared/Log.sys.mjs", WebDriverBiDi: "chrome://remote/content/webdriver-bidi/WebDriverBiDi.sys.mjs", }); XPCOMUtils.defineLazyModuleGetters(lazy, { - CDP: "chrome://remote/content/cdp/CDP.jsm", HttpServer: "chrome://remote/content/server/HTTPD.jsm", }); diff --git a/tools/esmify/map.json b/tools/esmify/map.json index 2394564a5b70..b6017eabbc14 100644 --- a/tools/esmify/map.json +++ b/tools/esmify/map.json @@ -41,88 +41,6 @@ "browser/components/pocket/content/pktApi.jsm", "chrome://pocket/content/pktTelemetry.jsm": "browser/components/pocket/content/pktTelemetry.jsm", - "chrome://remote/content/cdp/CDP.jsm": "remote/cdp/CDP.jsm", - "chrome://remote/content/cdp/CDPConnection.jsm": - "remote/cdp/CDPConnection.jsm", - "chrome://remote/content/cdp/Error.jsm": "remote/cdp/Error.jsm", - "chrome://remote/content/cdp/JSONHandler.jsm": "remote/cdp/JSONHandler.jsm", - "chrome://remote/content/cdp/Protocol.jsm": "remote/cdp/Protocol.jsm", - "chrome://remote/content/cdp/StreamRegistry.jsm": - "remote/cdp/StreamRegistry.jsm", - "chrome://remote/content/cdp/domains/ContentProcessDomain.jsm": - "remote/cdp/domains/ContentProcessDomain.jsm", - "chrome://remote/content/cdp/domains/ContentProcessDomains.jsm": - "remote/cdp/domains/ContentProcessDomains.jsm", - "chrome://remote/content/cdp/domains/Domain.jsm": - "remote/cdp/domains/Domain.jsm", - "chrome://remote/content/cdp/domains/DomainCache.jsm": - "remote/cdp/domains/DomainCache.jsm", - "chrome://remote/content/cdp/domains/ParentProcessDomains.jsm": - "remote/cdp/domains/ParentProcessDomains.jsm", - "chrome://remote/content/cdp/domains/content/DOM.jsm": - "remote/cdp/domains/content/DOM.jsm", - "chrome://remote/content/cdp/domains/content/Emulation.jsm": - "remote/cdp/domains/content/Emulation.jsm", - "chrome://remote/content/cdp/domains/content/Input.jsm": - "remote/cdp/domains/content/Input.jsm", - "chrome://remote/content/cdp/domains/content/Log.jsm": - "remote/cdp/domains/content/Log.jsm", - "chrome://remote/content/cdp/domains/content/Network.jsm": - "remote/cdp/domains/content/Network.jsm", - "chrome://remote/content/cdp/domains/content/Page.jsm": - "remote/cdp/domains/content/Page.jsm", - "chrome://remote/content/cdp/domains/content/Performance.jsm": - "remote/cdp/domains/content/Performance.jsm", - "chrome://remote/content/cdp/domains/content/Runtime.jsm": - "remote/cdp/domains/content/Runtime.jsm", - "chrome://remote/content/cdp/domains/content/Security.jsm": - "remote/cdp/domains/content/Security.jsm", - "chrome://remote/content/cdp/domains/content/runtime/ExecutionContext.jsm": - "remote/cdp/domains/content/runtime/ExecutionContext.jsm", - "chrome://remote/content/cdp/domains/parent/Browser.jsm": - "remote/cdp/domains/parent/Browser.jsm", - "chrome://remote/content/cdp/domains/parent/Emulation.jsm": - "remote/cdp/domains/parent/Emulation.jsm", - "chrome://remote/content/cdp/domains/parent/Fetch.jsm": - "remote/cdp/domains/parent/Fetch.jsm", - "chrome://remote/content/cdp/domains/parent/IO.jsm": - "remote/cdp/domains/parent/IO.jsm", - "chrome://remote/content/cdp/domains/parent/Input.jsm": - "remote/cdp/domains/parent/Input.jsm", - "chrome://remote/content/cdp/domains/parent/Network.jsm": - "remote/cdp/domains/parent/Network.jsm", - "chrome://remote/content/cdp/domains/parent/Page.jsm": - "remote/cdp/domains/parent/Page.jsm", - "chrome://remote/content/cdp/domains/parent/Security.jsm": - "remote/cdp/domains/parent/Security.jsm", - "chrome://remote/content/cdp/domains/parent/Target.jsm": - "remote/cdp/domains/parent/Target.jsm", - "chrome://remote/content/cdp/domains/parent/page/DialogHandler.jsm": - "remote/cdp/domains/parent/page/DialogHandler.jsm", - "chrome://remote/content/cdp/observers/ChannelEventSink.jsm": - "remote/cdp/observers/ChannelEventSink.jsm", - "chrome://remote/content/cdp/observers/ContextObserver.jsm": - "remote/cdp/observers/ContextObserver.jsm", - "chrome://remote/content/cdp/observers/NetworkObserver.jsm": - "remote/cdp/observers/NetworkObserver.jsm", - "chrome://remote/content/cdp/observers/TargetObserver.jsm": - "remote/cdp/observers/TargetObserver.jsm", - "chrome://remote/content/cdp/sessions/ContentProcessSession.jsm": - "remote/cdp/sessions/ContentProcessSession.jsm", - "chrome://remote/content/cdp/sessions/MainProcessSession.jsm": - "remote/cdp/sessions/MainProcessSession.jsm", - "chrome://remote/content/cdp/sessions/Session.jsm": - "remote/cdp/sessions/Session.jsm", - "chrome://remote/content/cdp/sessions/TabSession.jsm": - "remote/cdp/sessions/TabSession.jsm", - "chrome://remote/content/cdp/targets/MainProcessTarget.jsm": - "remote/cdp/targets/MainProcessTarget.jsm", - "chrome://remote/content/cdp/targets/TabTarget.jsm": - "remote/cdp/targets/TabTarget.jsm", - "chrome://remote/content/cdp/targets/Target.jsm": - "remote/cdp/targets/Target.jsm", - "chrome://remote/content/cdp/targets/TargetList.jsm": - "remote/cdp/targets/TargetList.jsm", "resource:///actors/ASRouterChild.jsm": "browser/components/newtab/actors/ASRouterChild.jsm", "resource:///actors/ASRouterParent.jsm": diff --git a/tools/lint/rejected-words.yml b/tools/lint/rejected-words.yml index b0fbc7a878cf..fd8da982da2f 100644 --- a/tools/lint/rejected-words.yml +++ b/tools/lint/rejected-words.yml @@ -268,7 +268,7 @@ avoid-blacklist-and-whitelist: - python/mozbuild/mozbuild/configure/options.py - python/mozbuild/mozbuild/vendor/moz_yaml.py - python/mozbuild/mozbuild/vendor/vendor_rust.py - - remote/cdp/Protocol.jsm + - remote/cdp/Protocol.sys.mjs - security/certverifier/NSSCertDBTrustDomain.cpp - security/certverifier/TrustOverrideUtils.h - security/manager/ssl/DataStorageList.h