Bug 1790472 - [bidi] Convert /remote/webdriver-bidi JSM modules to ESM r=webdriver-reviewers,whimboo

Depends on D158296

Differential Revision: https://phabricator.services.mozilla.com/D158297
This commit is contained in:
Julian Descottes 2022-09-30 11:08:08 +00:00
parent 4a1ddfd485
commit 3635b10bad
23 changed files with 94 additions and 247 deletions

View file

@ -9,12 +9,12 @@ const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
Deferred: "chrome://remote/content/shared/Sync.sys.mjs", Deferred: "chrome://remote/content/shared/Sync.sys.mjs",
Log: "chrome://remote/content/shared/Log.sys.mjs", Log: "chrome://remote/content/shared/Log.sys.mjs",
WebDriverBiDi: "chrome://remote/content/webdriver-bidi/WebDriverBiDi.sys.mjs",
}); });
XPCOMUtils.defineLazyModuleGetters(lazy, { XPCOMUtils.defineLazyModuleGetters(lazy, {
CDP: "chrome://remote/content/cdp/CDP.jsm", CDP: "chrome://remote/content/cdp/CDP.jsm",
HttpServer: "chrome://remote/content/server/HTTPD.jsm", HttpServer: "chrome://remote/content/server/HTTPD.jsm",
WebDriverBiDi: "chrome://remote/content/webdriver-bidi/WebDriverBiDi.jsm",
}); });
XPCOMUtils.defineLazyServiceGetter( XPCOMUtils.defineLazyServiceGetter(

View file

@ -16,12 +16,13 @@ const protocols = {
bidi: {}, bidi: {},
test: {}, test: {},
}; };
XPCOMUtils.defineLazyModuleGetters(protocols.bidi, { // eslint-disable-next-line mozilla/lazy-getter-object-name
ChromeUtils.defineESModuleGetters(protocols.bidi, {
// Additional protocols might use a different registry for their modules, // Additional protocols might use a different registry for their modules,
// in which case this will no longer be a constant but will instead depend on // in which case this will no longer be a constant but will instead depend on
// the protocol owning the MessageHandler. See Bug 1722464. // the protocol owning the MessageHandler. See Bug 1722464.
getModuleClass: getModuleClass:
"chrome://remote/content/webdriver-bidi/modules/ModuleRegistry.jsm", "chrome://remote/content/webdriver-bidi/modules/ModuleRegistry.sys.mjs",
}); });
// eslint-disable-next-line mozilla/lazy-getter-object-name // eslint-disable-next-line mozilla/lazy-getter-object-name
ChromeUtils.defineESModuleGetters(protocols.test, { ChromeUtils.defineESModuleGetters(protocols.test, {

View file

@ -16,15 +16,12 @@ ChromeUtils.defineESModuleGetters(lazy, {
"chrome://remote/content/shared/messagehandler/RootMessageHandler.sys.mjs", "chrome://remote/content/shared/messagehandler/RootMessageHandler.sys.mjs",
RootMessageHandlerRegistry: RootMessageHandlerRegistry:
"chrome://remote/content/shared/messagehandler/RootMessageHandlerRegistry.sys.mjs", "chrome://remote/content/shared/messagehandler/RootMessageHandlerRegistry.sys.mjs",
WebDriverBiDiConnection:
"chrome://remote/content/webdriver-bidi/WebDriverBiDiConnection.sys.mjs",
WebSocketHandshake: WebSocketHandshake:
"chrome://remote/content/server/WebSocketHandshake.sys.mjs", "chrome://remote/content/server/WebSocketHandshake.sys.mjs",
}); });
XPCOMUtils.defineLazyModuleGetters(lazy, {
WebDriverBiDiConnection:
"chrome://remote/content/webdriver-bidi/WebDriverBiDiConnection.jsm",
});
XPCOMUtils.defineLazyGetter(lazy, "logger", () => lazy.Log.get()); XPCOMUtils.defineLazyGetter(lazy, "logger", () => lazy.Log.get());
/** /**

View file

@ -2,30 +2,19 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var EXPORTED_SYMBOLS = ["WebDriverNewSessionHandler"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
WebDriverBiDiConnection:
"chrome://remote/content/webdriver-bidi/WebDriverBiDiConnection.sys.mjs",
WebSocketHandshake: WebSocketHandshake:
"chrome://remote/content/server/WebSocketHandshake.sys.mjs", "chrome://remote/content/server/WebSocketHandshake.sys.mjs",
}); });
XPCOMUtils.defineLazyModuleGetters(lazy, {
WebDriverBiDiConnection:
"chrome://remote/content/webdriver-bidi/WebDriverBiDiConnection.jsm",
});
/** /**
* httpd.js JSON handler for direct BiDi connections. * httpd.js JSON handler for direct BiDi connections.
*/ */
class WebDriverNewSessionHandler { export class WebDriverNewSessionHandler {
/** /**
* Construct a new JSON handler. * Construct a new JSON handler.
* *

View file

@ -2,13 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * 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 = ["Realm", "RealmType", "WindowRealm"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
XPCOMUtils.defineLazyModuleGetters(lazy, { XPCOMUtils.defineLazyModuleGetters(lazy, {
@ -31,7 +25,7 @@ XPCOMUtils.defineLazyGetter(lazy, "dbg", () => {
* @readonly * @readonly
* @enum {RealmType} * @enum {RealmType}
**/ **/
const RealmType = { export const RealmType = {
AudioWorklet: "audio-worklet", AudioWorklet: "audio-worklet",
DedicatedWorker: "dedicated-worker", DedicatedWorker: "dedicated-worker",
PaintWorklet: "paint-worklet", PaintWorklet: "paint-worklet",
@ -52,7 +46,7 @@ function getUUID() {
/** /**
* Base class that wraps any kind of WebDriver BiDi realm. * Base class that wraps any kind of WebDriver BiDi realm.
*/ */
class Realm { export class Realm {
#handleObjectMap; #handleObjectMap;
#id; #id;
@ -150,7 +144,7 @@ class Realm {
/** /**
* Wrapper for Window realms including sandbox objects. * Wrapper for Window realms including sandbox objects.
*/ */
class WindowRealm extends Realm { export class WindowRealm extends Realm {
#globalObject; #globalObject;
#globalObjectReference; #globalObjectReference;
#sandboxName; #sandboxName;

View file

@ -2,18 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * 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 = [
"deserialize",
"OwnershipModel",
"serialize",
"stringify",
];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -37,7 +26,7 @@ XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
* @readonly * @readonly
* @enum {OwnershipModel} * @enum {OwnershipModel}
**/ **/
const OwnershipModel = { export const OwnershipModel = {
None: "none", None: "none",
Root: "root", Root: "root",
}; };
@ -201,7 +190,7 @@ function deserializeKeyValueList(realm, serializedKeyValueList) {
* *
* @return {Object} Deserialized representation of the value. * @return {Object} Deserialized representation of the value.
*/ */
function deserialize(realm, serializedValue) { export function deserialize(realm, serializedValue) {
const { handle, type, value } = serializedValue; const { handle, type, value } = serializedValue;
// With a handle present deserialize as remote reference. // With a handle present deserialize as remote reference.
@ -458,7 +447,7 @@ function serializeMapping(
* *
* @return {Object} Serialized representation of the value. * @return {Object} Serialized representation of the value.
*/ */
function serialize( export function serialize(
value, value,
maxDepth, maxDepth,
ownershipType, ownershipType,
@ -639,7 +628,7 @@ function setInternalIdsIfNeeded(serializationInternalMap, remoteValue, object) {
* *
* @return {string} String representation of the value. * @return {string} String representation of the value.
*/ */
function stringify(obj) { export function stringify(obj) {
let text; let text;
try { try {
text = text =

View file

@ -2,25 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * 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 = ["WebDriverBiDi"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs", error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs",
Log: "chrome://remote/content/shared/Log.sys.mjs", Log: "chrome://remote/content/shared/Log.sys.mjs",
WebDriverSession: "chrome://remote/content/shared/webdriver/Session.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
WebDriverNewSessionHandler: WebDriverNewSessionHandler:
"chrome://remote/content/webdriver-bidi/NewSessionHandler.jsm", "chrome://remote/content/webdriver-bidi/NewSessionHandler.sys.mjs",
WebDriverSession: "chrome://remote/content/shared/webdriver/Session.sys.mjs",
}); });
XPCOMUtils.defineLazyGetter(lazy, "logger", () => XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
@ -33,7 +24,7 @@ XPCOMUtils.defineLazyGetter(lazy, "textEncoder", () => new TextEncoder());
* *
* @see https://w3c.github.io/webdriver-bidi * @see https://w3c.github.io/webdriver-bidi
*/ */
class WebDriverBiDi { export class WebDriverBiDi {
/** /**
* Creates a new instance of the WebDriverBiDi class. * Creates a new instance of the WebDriverBiDi class.
* *

View file

@ -2,17 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * 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 = ["splitMethod", "WebDriverBiDiConnection"]; import { WebSocketConnection } from "chrome://remote/content/shared/WebSocketConnection.sys.mjs";
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const { WebSocketConnection } = ChromeUtils.importESModule(
"chrome://remote/content/shared/WebSocketConnection.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -27,7 +19,7 @@ XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
lazy.Log.get(lazy.Log.TYPES.WEBDRIVER_BIDI) lazy.Log.get(lazy.Log.TYPES.WEBDRIVER_BIDI)
); );
class WebDriverBiDiConnection extends WebSocketConnection { export class WebDriverBiDiConnection extends WebSocketConnection {
/** /**
* @param {WebSocket} webSocket * @param {WebSocket} webSocket
* The WebSocket server connection to wrap. * The WebSocket server connection to wrap.
@ -194,7 +186,7 @@ class WebDriverBiDiConnection extends WebSocketConnection {
* Object with the module ("session") and command ("subscribe") * Object with the module ("session") and command ("subscribe")
* as properties. * as properties.
*/ */
function splitMethod(method) { export function splitMethod(method) {
const parts = method.split("."); const parts = method.split(".");
if (parts.length != 2 || !parts[0].length || !parts[1].length) { if (parts.length != 2 || !parts[0].length || !parts[1].length) {

View file

@ -5,26 +5,26 @@
remote.jar: remote.jar:
% content remote %content/ % content remote %content/
content/webdriver-bidi/NewSessionHandler.jsm (NewSessionHandler.jsm) content/webdriver-bidi/NewSessionHandler.sys.mjs (NewSessionHandler.sys.mjs)
content/webdriver-bidi/Realm.jsm (Realm.jsm) content/webdriver-bidi/Realm.sys.mjs (Realm.sys.mjs)
content/webdriver-bidi/RemoteValue.jsm (RemoteValue.jsm) content/webdriver-bidi/RemoteValue.sys.mjs (RemoteValue.sys.mjs)
content/webdriver-bidi/WebDriverBiDi.jsm (WebDriverBiDi.jsm) content/webdriver-bidi/WebDriverBiDi.sys.mjs (WebDriverBiDi.sys.mjs)
content/webdriver-bidi/WebDriverBiDiConnection.jsm (WebDriverBiDiConnection.jsm) content/webdriver-bidi/WebDriverBiDiConnection.sys.mjs (WebDriverBiDiConnection.sys.mjs)
# WebDriver BiDi modules # WebDriver BiDi modules
content/webdriver-bidi/modules/ModuleRegistry.jsm (modules/ModuleRegistry.jsm) content/webdriver-bidi/modules/ModuleRegistry.sys.mjs (modules/ModuleRegistry.sys.mjs)
# WebDriver BiDi root modules # WebDriver BiDi root modules
content/webdriver-bidi/modules/root/browsingContext.jsm (modules/root/browsingContext.jsm) content/webdriver-bidi/modules/root/browsingContext.sys.mjs (modules/root/browsingContext.sys.mjs)
content/webdriver-bidi/modules/root/log.jsm (modules/root/log.jsm) content/webdriver-bidi/modules/root/log.sys.mjs (modules/root/log.sys.mjs)
content/webdriver-bidi/modules/root/script.jsm (modules/root/script.jsm) content/webdriver-bidi/modules/root/script.sys.mjs (modules/root/script.sys.mjs)
content/webdriver-bidi/modules/root/session.jsm (modules/root/session.jsm) content/webdriver-bidi/modules/root/session.sys.mjs (modules/root/session.sys.mjs)
# WebDriver BiDi windowglobal modules # WebDriver BiDi windowglobal modules
content/webdriver-bidi/modules/windowglobal/browsingContext.jsm (modules/windowglobal/browsingContext.jsm) content/webdriver-bidi/modules/windowglobal/browsingContext.sys.mjs (modules/windowglobal/browsingContext.sys.mjs)
content/webdriver-bidi/modules/windowglobal/log.jsm (modules/windowglobal/log.jsm) content/webdriver-bidi/modules/windowglobal/log.sys.mjs (modules/windowglobal/log.sys.mjs)
content/webdriver-bidi/modules/windowglobal/script.jsm (modules/windowglobal/script.jsm) content/webdriver-bidi/modules/windowglobal/script.sys.mjs (modules/windowglobal/script.sys.mjs)
# WebDriver BiDi windowglobal-in-root modules # WebDriver BiDi windowglobal-in-root modules
content/webdriver-bidi/modules/windowglobal-in-root/browsingContext.jsm (modules/windowglobal-in-root/browsingContext.jsm) content/webdriver-bidi/modules/windowglobal-in-root/browsingContext.sys.mjs (modules/windowglobal-in-root/browsingContext.sys.mjs)
content/webdriver-bidi/modules/windowglobal-in-root/log.jsm (modules/windowglobal-in-root/log.jsm) content/webdriver-bidi/modules/windowglobal-in-root/log.sys.mjs (modules/windowglobal-in-root/log.sys.mjs)

View file

@ -2,41 +2,38 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var EXPORTED_SYMBOLS = ["getModuleClass"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const modules = { const modules = {
root: {}, root: {},
"windowglobal-in-root": {}, "windowglobal-in-root": {},
windowglobal: {}, windowglobal: {},
}; };
XPCOMUtils.defineLazyModuleGetters(modules.root, { // eslint-disable-next-line mozilla/lazy-getter-object-name
ChromeUtils.defineESModuleGetters(modules.root, {
browsingContext: browsingContext:
"chrome://remote/content/webdriver-bidi/modules/root/browsingContext.jsm", "chrome://remote/content/webdriver-bidi/modules/root/browsingContext.sys.mjs",
log: "chrome://remote/content/webdriver-bidi/modules/root/log.jsm", log: "chrome://remote/content/webdriver-bidi/modules/root/log.sys.mjs",
script: "chrome://remote/content/webdriver-bidi/modules/root/script.jsm", script: "chrome://remote/content/webdriver-bidi/modules/root/script.sys.mjs",
session: "chrome://remote/content/webdriver-bidi/modules/root/session.jsm", session:
"chrome://remote/content/webdriver-bidi/modules/root/session.sys.mjs",
}); });
XPCOMUtils.defineLazyModuleGetters(modules["windowglobal-in-root"], { // eslint-disable-next-line mozilla/lazy-getter-object-name
ChromeUtils.defineESModuleGetters(modules["windowglobal-in-root"], {
browsingContext: browsingContext:
"chrome://remote/content/webdriver-bidi/modules/windowglobal-in-root/browsingContext.jsm", "chrome://remote/content/webdriver-bidi/modules/windowglobal-in-root/browsingContext.sys.mjs",
log: log:
"chrome://remote/content/webdriver-bidi/modules/windowglobal-in-root/log.jsm", "chrome://remote/content/webdriver-bidi/modules/windowglobal-in-root/log.sys.mjs",
}); });
XPCOMUtils.defineLazyModuleGetters(modules.windowglobal, { // eslint-disable-next-line mozilla/lazy-getter-object-name
ChromeUtils.defineESModuleGetters(modules.windowglobal, {
browsingContext: browsingContext:
"chrome://remote/content/webdriver-bidi/modules/windowglobal/browsingContext.jsm", "chrome://remote/content/webdriver-bidi/modules/windowglobal/browsingContext.sys.mjs",
log: "chrome://remote/content/webdriver-bidi/modules/windowglobal/log.jsm", log:
"chrome://remote/content/webdriver-bidi/modules/windowglobal/log.sys.mjs",
script: script:
"chrome://remote/content/webdriver-bidi/modules/windowglobal/script.jsm", "chrome://remote/content/webdriver-bidi/modules/windowglobal/script.sys.mjs",
}); });
/** /**
@ -53,7 +50,7 @@ XPCOMUtils.defineLazyModuleGetters(modules.windowglobal, {
* @throws {Error} * @throws {Error}
* If the provided module folder is unexpected. * If the provided module folder is unexpected.
**/ **/
const getModuleClass = function(moduleName, moduleFolder) { export const getModuleClass = function(moduleName, moduleFolder) {
if (!modules[moduleFolder]) { if (!modules[moduleFolder]) {
throw new Error( throw new Error(
`Invalid module folder "${moduleFolder}", expected one of "${Object.keys( `Invalid module folder "${moduleFolder}", expected one of "${Object.keys(

View file

@ -2,17 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict"; import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const EXPORTED_SYMBOLS = ["browsingContext"]; import { Module } from "chrome://remote/content/shared/messagehandler/Module.sys.mjs";
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const { Module } = ChromeUtils.importESModule(
"chrome://remote/content/shared/messagehandler/Module.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -569,4 +561,4 @@ class BrowsingContextModule extends Module {
} }
} }
const browsingContext = BrowsingContextModule; export const browsingContext = BrowsingContextModule;

View file

@ -2,13 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict"; import { Module } from "chrome://remote/content/shared/messagehandler/Module.sys.mjs";
const EXPORTED_SYMBOLS = ["log"];
const { Module } = ChromeUtils.importESModule(
"chrome://remote/content/shared/messagehandler/Module.sys.mjs"
);
class LogModule extends Module { class LogModule extends Module {
destroy() {} destroy() {}
@ -18,4 +12,4 @@ class LogModule extends Module {
} }
} }
const log = LogModule; export const log = LogModule;

View file

@ -2,17 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict"; import { Module } from "chrome://remote/content/shared/messagehandler/Module.sys.mjs";
const EXPORTED_SYMBOLS = ["script"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const { Module } = ChromeUtils.importESModule(
"chrome://remote/content/shared/messagehandler/Module.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -21,16 +11,13 @@ ChromeUtils.defineESModuleGetters(lazy, {
ContextDescriptorType: ContextDescriptorType:
"chrome://remote/content/shared/messagehandler/MessageHandler.sys.mjs", "chrome://remote/content/shared/messagehandler/MessageHandler.sys.mjs",
error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs", error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs",
OwnershipModel: "chrome://remote/content/webdriver-bidi/RemoteValue.sys.mjs",
RealmType: "chrome://remote/content/webdriver-bidi/Realm.sys.mjs",
TabManager: "chrome://remote/content/shared/TabManager.sys.mjs", TabManager: "chrome://remote/content/shared/TabManager.sys.mjs",
WindowGlobalMessageHandler: WindowGlobalMessageHandler:
"chrome://remote/content/shared/messagehandler/WindowGlobalMessageHandler.sys.mjs", "chrome://remote/content/shared/messagehandler/WindowGlobalMessageHandler.sys.mjs",
}); });
XPCOMUtils.defineLazyModuleGetters(lazy, {
OwnershipModel: "chrome://remote/content/webdriver-bidi/RemoteValue.jsm",
RealmType: "chrome://remote/content/webdriver-bidi/Realm.jsm",
});
class ScriptModule extends Module { class ScriptModule extends Module {
destroy() {} destroy() {}
@ -522,4 +509,4 @@ class ScriptModule extends Module {
} }
} }
const script = ScriptModule; export const script = ScriptModule;

View file

@ -2,13 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict"; import { Module } from "chrome://remote/content/shared/messagehandler/Module.sys.mjs";
const EXPORTED_SYMBOLS = ["session"];
const { Module } = ChromeUtils.importESModule(
"chrome://remote/content/shared/messagehandler/Module.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -224,4 +218,4 @@ class SessionModule extends Module {
} }
// To export the class as lower-case // To export the class as lower-case
const session = SessionModule; export const session = SessionModule;

View file

@ -2,13 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict"; import { Module } from "chrome://remote/content/shared/messagehandler/Module.sys.mjs";
const EXPORTED_SYMBOLS = ["browsingContext"];
const { Module } = ChromeUtils.importESModule(
"chrome://remote/content/shared/messagehandler/Module.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -31,4 +25,4 @@ class BrowsingContextModule extends Module {
} }
} }
const browsingContext = BrowsingContextModule; export const browsingContext = BrowsingContextModule;

View file

@ -2,13 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict"; import { Module } from "chrome://remote/content/shared/messagehandler/Module.sys.mjs";
const EXPORTED_SYMBOLS = ["log"];
const { Module } = ChromeUtils.importESModule(
"chrome://remote/content/shared/messagehandler/Module.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -31,4 +25,4 @@ class LogModule extends Module {
} }
} }
const log = LogModule; export const log = LogModule;

View file

@ -2,13 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict"; import { Module } from "chrome://remote/content/shared/messagehandler/Module.sys.mjs";
const EXPORTED_SYMBOLS = ["browsingContext"];
const { Module } = ChromeUtils.importESModule(
"chrome://remote/content/shared/messagehandler/Module.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -115,4 +109,4 @@ class BrowsingContextModule extends Module {
} }
} }
const browsingContext = BrowsingContextModule; export const browsingContext = BrowsingContextModule;

View file

@ -2,17 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict"; import { Module } from "chrome://remote/content/shared/messagehandler/Module.sys.mjs";
const EXPORTED_SYMBOLS = ["log"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const { Module } = ChromeUtils.importESModule(
"chrome://remote/content/shared/messagehandler/Module.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -22,11 +12,8 @@ ChromeUtils.defineESModuleGetters(lazy, {
ConsoleListener: ConsoleListener:
"chrome://remote/content/shared/listeners/ConsoleListener.sys.mjs", "chrome://remote/content/shared/listeners/ConsoleListener.sys.mjs",
isChromeFrame: "chrome://remote/content/shared/Stack.sys.mjs", isChromeFrame: "chrome://remote/content/shared/Stack.sys.mjs",
}); OwnershipModel: "chrome://remote/content/webdriver-bidi/RemoteValue.sys.mjs",
serialize: "chrome://remote/content/webdriver-bidi/RemoteValue.sys.mjs",
XPCOMUtils.defineLazyModuleGetters(lazy, {
OwnershipModel: "chrome://remote/content/webdriver-bidi/RemoteValue.jsm",
serialize: "chrome://remote/content/webdriver-bidi/RemoteValue.jsm",
}); });
class LogModule extends Module { class LogModule extends Module {
@ -235,4 +222,4 @@ class LogModule extends Module {
} }
} }
const log = LogModule; export const log = LogModule;

View file

@ -2,31 +2,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict"; import { Module } from "chrome://remote/content/shared/messagehandler/Module.sys.mjs";
const EXPORTED_SYMBOLS = ["script"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const { Module } = ChromeUtils.importESModule(
"chrome://remote/content/shared/messagehandler/Module.sys.mjs"
);
const lazy = {}; const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
deserialize: "chrome://remote/content/webdriver-bidi/RemoteValue.sys.mjs",
error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs", error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs",
getFramesFromStack: "chrome://remote/content/shared/Stack.sys.mjs", getFramesFromStack: "chrome://remote/content/shared/Stack.sys.mjs",
isChromeFrame: "chrome://remote/content/shared/Stack.sys.mjs", isChromeFrame: "chrome://remote/content/shared/Stack.sys.mjs",
}); serialize: "chrome://remote/content/webdriver-bidi/RemoteValue.sys.mjs",
stringify: "chrome://remote/content/webdriver-bidi/RemoteValue.sys.mjs",
XPCOMUtils.defineLazyModuleGetters(lazy, { WindowRealm: "chrome://remote/content/webdriver-bidi/Realm.sys.mjs",
deserialize: "chrome://remote/content/webdriver-bidi/RemoteValue.jsm",
serialize: "chrome://remote/content/webdriver-bidi/RemoteValue.jsm",
stringify: "chrome://remote/content/webdriver-bidi/RemoteValue.jsm",
WindowRealm: "chrome://remote/content/webdriver-bidi/Realm.jsm",
}); });
/** /**
@ -354,4 +341,4 @@ class ScriptModule extends Module {
} }
} }
const script = ScriptModule; export const script = ScriptModule;

View file

@ -3,8 +3,8 @@
"use strict"; "use strict";
const { Realm } = ChromeUtils.import( const { Realm } = ChromeUtils.importESModule(
"chrome://remote/content/webdriver-bidi/Realm.jsm" "chrome://remote/content/webdriver-bidi/Realm.sys.mjs"
); );
add_test(function test_id() { add_test(function test_id() {

View file

@ -314,12 +314,12 @@ const REMOTE_COMPLEX_VALUES = [
}, },
]; ];
const { Realm } = ChromeUtils.import( const { Realm } = ChromeUtils.importESModule(
"chrome://remote/content/webdriver-bidi/Realm.jsm" "chrome://remote/content/webdriver-bidi/Realm.sys.mjs"
); );
const { deserialize, serialize, stringify } = ChromeUtils.import( const { deserialize, serialize, stringify } = ChromeUtils.importESModule(
"chrome://remote/content/webdriver-bidi/RemoteValue.jsm" "chrome://remote/content/webdriver-bidi/RemoteValue.sys.mjs"
); );
add_test(function test_deserializePrimitiveTypes() { add_test(function test_deserializePrimitiveTypes() {

View file

@ -3,8 +3,8 @@
"use strict"; "use strict";
const { splitMethod } = ChromeUtils.import( const { splitMethod } = ChromeUtils.importESModule(
"chrome://remote/content/webdriver-bidi/WebDriverBiDiConnection.jsm" "chrome://remote/content/webdriver-bidi/WebDriverBiDiConnection.sys.mjs"
); );
add_test(function test_Connection_splitMethod() { add_test(function test_Connection_splitMethod() {

View file

@ -123,32 +123,6 @@
"remote/cdp/targets/Target.jsm", "remote/cdp/targets/Target.jsm",
"chrome://remote/content/cdp/targets/TargetList.jsm": "chrome://remote/content/cdp/targets/TargetList.jsm":
"remote/cdp/targets/TargetList.jsm", "remote/cdp/targets/TargetList.jsm",
"chrome://remote/content/webdriver-bidi/NewSessionHandler.jsm":
"remote/webdriver-bidi/NewSessionHandler.jsm",
"chrome://remote/content/webdriver-bidi/RemoteValue.jsm":
"remote/webdriver-bidi/RemoteValue.jsm",
"chrome://remote/content/webdriver-bidi/WebDriverBiDi.jsm":
"remote/webdriver-bidi/WebDriverBiDi.jsm",
"chrome://remote/content/webdriver-bidi/WebDriverBiDiConnection.jsm":
"remote/webdriver-bidi/WebDriverBiDiConnection.jsm",
"chrome://remote/content/webdriver-bidi/modules/ModuleRegistry.jsm":
"remote/webdriver-bidi/modules/ModuleRegistry.jsm",
"chrome://remote/content/webdriver-bidi/modules/root/browsingContext.jsm":
"remote/webdriver-bidi/modules/root/browsingContext.jsm",
"chrome://remote/content/webdriver-bidi/modules/root/log.jsm":
"remote/webdriver-bidi/modules/root/log.jsm",
"chrome://remote/content/webdriver-bidi/modules/root/script.jsm":
"remote/webdriver-bidi/modules/root/script.jsm",
"chrome://remote/content/webdriver-bidi/modules/root/session.jsm":
"remote/webdriver-bidi/modules/root/session.jsm",
"chrome://remote/content/webdriver-bidi/modules/windowglobal-in-root/log.jsm":
"remote/webdriver-bidi/modules/windowglobal-in-root/log.jsm",
"chrome://remote/content/webdriver-bidi/modules/windowglobal/browsingContext.jsm":
"remote/webdriver-bidi/modules/windowglobal/browsingContext.jsm",
"chrome://remote/content/webdriver-bidi/modules/windowglobal/log.jsm":
"remote/webdriver-bidi/modules/windowglobal/log.jsm",
"chrome://remote/content/webdriver-bidi/modules/windowglobal/script.jsm":
"remote/webdriver-bidi/modules/windowglobal/script.jsm",
"resource:///actors/ASRouterChild.jsm": "resource:///actors/ASRouterChild.jsm":
"browser/components/newtab/actors/ASRouterChild.jsm", "browser/components/newtab/actors/ASRouterChild.jsm",
"resource:///actors/ASRouterParent.jsm": "resource:///actors/ASRouterParent.jsm":