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

Depends on D158297

Differential Revision: https://phabricator.services.mozilla.com/D158298
This commit is contained in:
Julian Descottes 2022-09-30 11:08:09 +00:00
Родитель 3635b10bad
Коммит 5db63c4432
59 изменённых файлов: 234 добавлений и 616 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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.
*

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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}`);

Просмотреть файл

@ -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 = {

Просмотреть файл

@ -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 };

Просмотреть файл

@ -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();

Просмотреть файл

@ -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();
}

Просмотреть файл

@ -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",
});

Просмотреть файл

@ -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",
});

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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",
});

Просмотреть файл

@ -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",
});

Просмотреть файл

@ -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;

Просмотреть файл

@ -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
/**

Просмотреть файл

@ -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);

Просмотреть файл

@ -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;

Просмотреть файл

@ -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
/**

Просмотреть файл

@ -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);

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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);

Просмотреть файл

@ -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

Просмотреть файл

@ -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: "" });

Просмотреть файл

@ -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);

Просмотреть файл

@ -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
/**

Просмотреть файл

@ -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
/**

Просмотреть файл

@ -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;

Просмотреть файл

@ -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);

Просмотреть файл

@ -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 });
}

Просмотреть файл

@ -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);

Просмотреть файл

@ -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;

Просмотреть файл

@ -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)

Просмотреть файл

@ -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
);

Просмотреть файл

@ -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);

Просмотреть файл

@ -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 "<unknown error>";
}
var EXPORTED_SYMBOLS = ["NetworkObserver"];

Просмотреть файл

@ -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

Просмотреть файл

@ -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;

Просмотреть файл

@ -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 {}

Просмотреть файл

@ -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.

Просмотреть файл

@ -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.

Просмотреть файл

@ -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);

Просмотреть файл

@ -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
*/

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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();

Просмотреть файл

@ -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"

Просмотреть файл

@ -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"

Просмотреть файл

@ -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 = {}) {

Просмотреть файл

@ -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() {

Просмотреть файл

@ -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 {

Просмотреть файл

@ -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();

Просмотреть файл

@ -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 = {

Просмотреть файл

@ -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() {

Просмотреть файл

@ -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",
});

Просмотреть файл

@ -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":

Просмотреть файл

@ -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