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

Depends on D158295

Differential Revision: https://phabricator.services.mozilla.com/D158296
This commit is contained in:
Julian Descottes 2022-09-30 11:08:08 +00:00
parent bf82c5039a
commit 4a1ddfd485
57 changed files with 317 additions and 609 deletions

View file

@ -166,7 +166,7 @@ python/
# These are (mainly) imported code that we don't want to lint to make imports easier.
remote/cdp/Protocol.jsm
remote/cdp/test/browser/chrome-remote-interface.js
remote/marionette/atom.js
remote/marionette/atom.sys.mjs
# This file explicitly has a syntax error and cannot be parsed by eslint.
remote/shared/messagehandler/test/browser/resources/modules/root/invalid.sys.mjs

View file

@ -82,7 +82,7 @@ const intermittently_loaded_scripts = {
"resource://gre/actors/CookieBannerChild.jsm",
// Test related
"chrome://remote/content/marionette/actors/MarionetteEventsChild.jsm",
"chrome://remote/content/marionette/actors/MarionetteEventsChild.sys.mjs",
"chrome://remote/content/shared/Log.sys.mjs",
"resource://testing-common/BrowserTestUtilsChild.jsm",
"resource://testing-common/ContentEventListenerChild.jsm",

View file

@ -71,7 +71,7 @@ const intermittently_loaded_scripts = {
"resource://gre/actors/CookieBannerChild.jsm",
// Test related
"chrome://remote/content/marionette/actors/MarionetteEventsChild.jsm",
"chrome://remote/content/marionette/actors/MarionetteEventsChild.sys.mjs",
"chrome://remote/content/shared/Log.sys.mjs",
"resource://testing-common/BrowserTestUtilsChild.jsm",
"resource://testing-common/ContentEventListenerChild.jsm",

View file

@ -368,7 +368,9 @@ if (!isDevtools) {
}
if (AppConstants.MOZ_CODE_COVERAGE) {
whitelist.add("chrome://remote/content/marionette/PerTestCoverageUtils.jsm");
whitelist.add(
"chrome://remote/content/marionette/PerTestCoverageUtils.sys.mjs"
);
}
const gInterestingCategories = new Set([

View file

@ -20,8 +20,8 @@ const gTestRoot = getRootDirectory(gTestPath).replace(
"http://mochi.test:8888"
);
const { TimedPromise } = ChromeUtils.import(
"chrome://remote/content/marionette/sync.js"
const { TimedPromise } = ChromeUtils.importESModule(
"chrome://remote/content/marionette/sync.sys.mjs"
);
async function run_test(count) {

View file

@ -8,17 +8,16 @@ const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
Deferred: "chrome://remote/content/shared/Sync.sys.mjs",
EnvironmentPrefs: "chrome://remote/content/marionette/prefs.sys.mjs",
Log: "chrome://remote/content/shared/Log.sys.mjs",
MarionettePrefs: "chrome://remote/content/marionette/prefs.sys.mjs",
RecommendedPreferences:
"chrome://remote/content/shared/RecommendedPreferences.sys.mjs",
TCPListener: "chrome://remote/content/marionette/server.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
Preferences: "resource://gre/modules/Preferences.jsm",
EnvironmentPrefs: "chrome://remote/content/marionette/prefs.js",
MarionettePrefs: "chrome://remote/content/marionette/prefs.js",
TCPListener: "chrome://remote/content/marionette/server.js",
});
XPCOMUtils.defineLazyGetter(lazy, "logger", () =>

View file

@ -13,11 +13,11 @@ Currently the following atoms are in use:
- `isDisplayed`
To use one of those atoms Javascript modules will have to import
[atom.js].
[atom.sys.mjs].
[Selenium atoms]: https://github.com/SeleniumHQ/selenium/tree/master/javascript/webdriver/atoms
[WebDriver specification]: https://w3c.github.io/webdriver/webdriver-spec.html
[atom.js]: https://searchfox.org/mozilla-central/source/remote/marionette/atom.js
[atom.sys.mjs]: https://searchfox.org/mozilla-central/source/remote/marionette/atom.sys.mjs
Update required Selenium atoms
@ -25,7 +25,7 @@ Update required Selenium atoms
In regular intervals the atoms, which are still in use, have to
be updated. Therefore they have to be exported from the Selenium
repository first, and then updated in [atom.js].
repository first, and then updated in [atom.sys.mjs].
### Export Selenium Atoms
@ -59,7 +59,7 @@ For each of the exported atoms a file can now be found in the folder
code including dependencies for the atom wrapped into a single function.
### Update atom.js
### Update atom.sys.mjs
To update the atoms for Marionette the `atoms.js` file has to be edited. For
each atom to be updated the steps as laid out below have to be performed:
@ -71,10 +71,10 @@ each atom to be updated the steps as laid out below have to be performed:
in the middle of the file.
3. Update the parameters of the wrapper function (at the very top)
so that those are equal with the used parameters in `atom.js`.
so that those are equal with the used parameters in `atom.sys.mjs`.
4. Copy the whole content of the file, and replace the existing
code for the atom in `atom.js`.
code for the atom in `atom.sys.mjs`.
### Test the changes

View file

@ -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";
const EXPORTED_SYMBOLS = ["accessibility"];
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 @@ XPCOMUtils.defineLazyGetter(lazy, "service", () => {
});
/** @namespace */
const accessibility = {
export const accessibility = {
get service() {
return lazy.service;
},

View file

@ -5,29 +5,20 @@
/* eslint no-dupe-keys:off */
/* eslint-disable no-restricted-globals */
"use strict";
const EXPORTED_SYMBOLS = ["action"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
AppInfo: "chrome://remote/content/shared/AppInfo.sys.mjs",
assert: "chrome://remote/content/shared/webdriver/Assert.sys.mjs",
element: "chrome://remote/content/marionette/element.sys.mjs",
error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs",
event: "chrome://remote/content/marionette/event.sys.mjs",
keyData: "chrome://remote/content/shared/webdriver/KeyData.sys.mjs",
Log: "chrome://remote/content/shared/Log.sys.mjs",
pprint: "chrome://remote/content/shared/Format.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
element: "chrome://remote/content/marionette/element.js",
event: "chrome://remote/content/marionette/event.js",
Sleep: "chrome://remote/content/marionette/sync.js",
Sleep: "chrome://remote/content/marionette/sync.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
@ -47,7 +38,7 @@ XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
*
* @namespace
*/
this.action = {};
export const action = {};
/** Map from normalized key value to UI Events modifier key name */
const MODIFIER_NAME_LOOKUP = {

View file

@ -4,38 +4,29 @@
/* eslint-disable no-restricted-globals */
"use strict";
const EXPORTED_SYMBOLS = ["MarionetteCommandsChild"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
action: "chrome://remote/content/marionette/action.sys.mjs",
atom: "chrome://remote/content/marionette/atom.sys.mjs",
element: "chrome://remote/content/marionette/element.sys.mjs",
error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs",
evaluate: "chrome://remote/content/marionette/evaluate.sys.mjs",
event: "chrome://remote/content/marionette/event.sys.mjs",
interaction: "chrome://remote/content/marionette/interaction.sys.mjs",
legacyaction: "chrome://remote/content/marionette/legacyaction.sys.mjs",
Log: "chrome://remote/content/shared/Log.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
action: "chrome://remote/content/marionette/action.js",
atom: "chrome://remote/content/marionette/atom.js",
element: "chrome://remote/content/marionette/element.js",
evaluate: "chrome://remote/content/marionette/evaluate.js",
event: "chrome://remote/content/marionette/event.js",
interaction: "chrome://remote/content/marionette/interaction.js",
legacyaction: "chrome://remote/content/marionette/legacyaction.js",
sandbox: "chrome://remote/content/marionette/evaluate.js",
Sandboxes: "chrome://remote/content/marionette/evaluate.js",
sandbox: "chrome://remote/content/marionette/evaluate.sys.mjs",
Sandboxes: "chrome://remote/content/marionette/evaluate.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
lazy.Log.get(lazy.Log.TYPES.MARIONETTE)
);
class MarionetteCommandsChild extends JSWindowActorChild {
export class MarionetteCommandsChild extends JSWindowActorChild {
constructor() {
super();

View file

@ -2,33 +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");
const EXPORTED_SYMBOLS = [
"clearElementIdCache",
"getMarionetteCommandsActorProxy",
"MarionetteCommandsParent",
"registerCommandsActor",
"unregisterCommandsActor",
];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
capture: "chrome://remote/content/marionette/capture.sys.mjs",
element: "chrome://remote/content/marionette/element.sys.mjs",
error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs",
evaluate: "chrome://remote/content/marionette/evaluate.sys.mjs",
Log: "chrome://remote/content/shared/Log.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
capture: "chrome://remote/content/marionette/capture.js",
element: "chrome://remote/content/marionette/element.js",
evaluate: "chrome://remote/content/marionette/evaluate.js",
});
XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
lazy.Log.get(lazy.Log.TYPES.MARIONETTE)
);
@ -36,7 +21,7 @@ XPCOMUtils.defineLazyGetter(lazy, "elementIdCache", () => {
return new lazy.element.ReferenceStore();
});
class MarionetteCommandsParent extends JSWindowActorParent {
export class MarionetteCommandsParent extends JSWindowActorParent {
actorCreated() {
this._resolveDialogOpened = null;
@ -286,7 +271,7 @@ class MarionetteCommandsParent extends JSWindowActorParent {
/**
* Clear all the entries from the element id cache.
*/
function clearElementIdCache() {
export function clearElementIdCache() {
lazy.elementIdCache.clear();
}
@ -303,7 +288,7 @@ function _onTabClose(event) {
* A function that returns the reference to the browsing context for which
* the query should run.
*/
function getMarionetteCommandsActorProxy(browsingContextFn) {
export function getMarionetteCommandsActorProxy(browsingContextFn) {
const MAX_ATTEMPTS = 10;
/**
@ -382,17 +367,17 @@ function getMarionetteCommandsActorProxy(browsingContextFn) {
/**
* Register the MarionetteCommands actor that holds all the commands.
*/
function registerCommandsActor() {
export function registerCommandsActor() {
try {
ChromeUtils.registerWindowActor("MarionetteCommands", {
kind: "JSWindowActor",
parent: {
moduleURI:
"chrome://remote/content/marionette/actors/MarionetteCommandsParent.jsm",
esModuleURI:
"chrome://remote/content/marionette/actors/MarionetteCommandsParent.sys.mjs",
},
child: {
moduleURI:
"chrome://remote/content/marionette/actors/MarionetteCommandsChild.jsm",
esModuleURI:
"chrome://remote/content/marionette/actors/MarionetteCommandsChild.sys.mjs",
},
allFrames: true,
@ -407,6 +392,6 @@ function registerCommandsActor() {
}
}
function unregisterCommandsActor() {
export function unregisterCommandsActor() {
ChromeUtils.unregisterWindowActor("MarionetteCommands");
}

View file

@ -4,29 +4,20 @@
/* eslint-disable no-restricted-globals */
"use strict";
const EXPORTED_SYMBOLS = ["MarionetteEventsChild"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
event: "chrome://remote/content/marionette/event.sys.mjs",
Log: "chrome://remote/content/shared/Log.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
event: "chrome://remote/content/marionette/event.js",
});
XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
lazy.Log.get(lazy.Log.TYPES.MARIONETTE)
);
class MarionetteEventsChild extends JSWindowActorChild {
export class MarionetteEventsChild extends JSWindowActorChild {
get innerWindowId() {
return this.manager.innerWindowId;
}

View file

@ -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");
const EXPORTED_SYMBOLS = [
"disableEventsActor",
"enableEventsActor",
"EventDispatcher",
"MarionetteEventsParent",
];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
@ -30,14 +19,15 @@ XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
);
// Singleton to allow forwarding events to registered listeners.
const EventDispatcher = {
export const EventDispatcher = {
init() {
lazy.EventEmitter.decorate(this);
},
};
EventDispatcher.init();
class MarionetteEventsParent extends JSWindowActorParent {
export class MarionetteEventsParent extends JSWindowActorParent {
async receiveMessage(msg) {
const { name, data } = msg;
@ -68,12 +58,12 @@ function registerEventsActor() {
ChromeUtils.registerWindowActor("MarionetteEvents", {
kind: "JSWindowActor",
parent: {
moduleURI:
"chrome://remote/content/marionette/actors/MarionetteEventsParent.jsm",
esModuleURI:
"chrome://remote/content/marionette/actors/MarionetteEventsParent.sys.mjs",
},
child: {
moduleURI:
"chrome://remote/content/marionette/actors/MarionetteEventsChild.jsm",
esModuleURI:
"chrome://remote/content/marionette/actors/MarionetteEventsChild.sys.mjs",
events: {
beforeunload: { capture: true },
DOMContentLoaded: { mozSystemGroup: true },
@ -107,7 +97,7 @@ function registerEventsActor() {
* Enable MarionetteEvents actors to start forwarding page load events from the
* child actor to the parent actor. Register the MarionetteEvents actor if necessary.
*/
function enableEventsActor() {
export function enableEventsActor() {
// sharedData is replicated across processes and will be checked by
// MarionetteEventsChild before forward events to the parent actor.
Services.ppmm.sharedData.set("MARIONETTE_EVENTS_ENABLED", true);
@ -121,7 +111,7 @@ function enableEventsActor() {
* Disable MarionetteEvents actors to stop forwarding page load events from the
* child actor to the parent actor.
*/
function disableEventsActor() {
export function disableEventsActor() {
Services.ppmm.sharedData.set("MARIONETTE_EVENTS_ENABLED", false);
Services.ppmm.sharedData.flush();
}

View file

@ -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";
const EXPORTED_SYMBOLS = ["MarionetteReftestChild"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
@ -23,7 +17,7 @@ XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
/**
* Child JSWindowActor to handle navigation for reftests relying on marionette.
*/
class MarionetteReftestChild extends JSWindowActorChild {
export class MarionetteReftestChild extends JSWindowActorChild {
constructor() {
super();

View file

@ -2,14 +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");
const EXPORTED_SYMBOLS = ["MarionetteReftestParent"];
/**
* Parent JSWindowActor to handle navigation for reftests relying on marionette.
*/
class MarionetteReftestParent extends JSWindowActorParent {
export class MarionetteReftestParent extends JSWindowActorParent {
/**
* Wait for the expected URL to be loaded.
*

View file

@ -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";
const EXPORTED_SYMBOLS = ["Addon"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
@ -46,7 +40,7 @@ async function installAddon(file) {
}
/** Installs addons by path and uninstalls by ID. */
class Addon {
export class Addon {
/**
* Install a Firefox addon.
*

View file

@ -12,10 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
const EXPORTED_SYMBOLS = ["atom"];
/** @namespace */
this.atom = {};
export const atom = {};
// https://github.com/SeleniumHQ/selenium/blob/master/javascript/atoms/dom.js#L979
atom.getElementText = function(element, window){return function(){var g,l=this;function n(a){return void 0!==a}function p(a){return"string"==typeof a}function aa(a){return"number"==typeof a}function ba(a,b){a=a.split(".");var c=l;a[0]in c||!c.execScript||c.execScript("var "+a[0]);for(var d;a.length&&(d=a.shift());)!a.length&&n(b)?c[d]=b:c[d]&&c[d]!==Object.prototype[d]?c=c[d]:c=c[d]={}}

View file

@ -2,31 +2,21 @@
* 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 EXPORTED_SYMBOLS = ["browser", "Context", "WindowState"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
AppInfo: "chrome://remote/content/shared/AppInfo.sys.mjs",
error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs",
EventPromise: "chrome://remote/content/shared/Sync.sys.mjs",
MessageManagerDestroyedPromise:
"chrome://remote/content/marionette/sync.sys.mjs",
TabManager: "chrome://remote/content/shared/TabManager.sys.mjs",
WebElementEventTarget: "chrome://remote/content/marionette/dom.sys.mjs",
windowManager: "chrome://remote/content/shared/WindowManager.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
MessageManagerDestroyedPromise: "chrome://remote/content/marionette/sync.js",
WebElementEventTarget: "chrome://remote/content/marionette/dom.js",
});
/** @namespace */
const browser = {};
export const browser = {};
/**
* Variations of Marionette contexts.
@ -37,7 +27,7 @@ const browser = {};
*
* @class Marionette.Context
*/
class Context {
export class Context {
/**
* Gets the correct context from a string.
*
@ -63,6 +53,7 @@ class Context {
}
}
}
Context.Chrome = "chrome";
Context.Content = "content";
@ -351,7 +342,7 @@ browser.Context = class {
*
* @enum {string}
*/
const WindowState = {
export const WindowState = {
Maximized: "maximized",
Minimized: "minimized",
Normal: "normal",

View file

@ -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";
const EXPORTED_SYMBOLS = ["capture"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
@ -32,7 +26,7 @@ const XHTML_NS = "http://www.w3.org/1999/xhtml";
*
* @namespace
*/
const capture = {};
export const capture = {};
capture.Format = {
Base64: 0,

View file

@ -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";
const EXPORTED_SYMBOLS = ["allowAllCerts"];
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 @@ const CERT_PINNING_ENFORCEMENT_PREF = "security.cert_pinning.enforcement_level";
const HSTS_PRELOAD_LIST_PREF = "network.stricttransportsecurity.preloadlist";
/** @namespace */
const allowAllCerts = {};
export const allowAllCerts = {};
/**
* Disable all security check and allow all certs.

View file

@ -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";
const EXPORTED_SYMBOLS = ["cookie"];
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
@ -23,7 +19,7 @@ const SAMESITE_MAP = new Map([
]);
/** @namespace */
const cookie = {
export const cookie = {
manager: Services.cookies,
};

View file

@ -2,16 +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";
const EXPORTED_SYMBOLS = [
"ContentEventObserverService",
"WebElementEventTarget",
];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
@ -41,7 +32,7 @@ XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
* chromeWindow.minimize();
* });
*/
class WebElementEventTarget {
export class WebElementEventTarget {
/**
* @param {function(): nsIMessageListenerManager} messageManagerFn
* Message manager to the current browser.
@ -149,7 +140,7 @@ class WebElementEventTarget {
* to cease listening for, and despatches IPC messages to the browser
* when they fire.
*/
class ContentEventObserverService {
export class ContentEventObserverService {
/**
* @param {WindowProxy} windowGlobal
* Window.

View file

@ -2,71 +2,62 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const EXPORTED_SYMBOLS = ["GeckoDriver"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const { element } = ChromeUtils.import(
"chrome://remote/content/marionette/element.js"
);
import {
element,
WebReference,
} from "chrome://remote/content/marionette/element.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
Addon: "chrome://remote/content/marionette/addon.sys.mjs",
AppInfo: "chrome://remote/content/shared/AppInfo.sys.mjs",
assert: "chrome://remote/content/shared/webdriver/Assert.sys.mjs",
atom: "chrome://remote/content/marionette/atom.sys.mjs",
browser: "chrome://remote/content/marionette/browser.sys.mjs",
capture: "chrome://remote/content/marionette/capture.sys.mjs",
clearElementIdCache:
"chrome://remote/content/marionette/actors/MarionetteCommandsParent.sys.mjs",
Context: "chrome://remote/content/marionette/browser.sys.mjs",
cookie: "chrome://remote/content/marionette/cookie.sys.mjs",
DebounceCallback: "chrome://remote/content/marionette/sync.sys.mjs",
disableEventsActor:
"chrome://remote/content/marionette/actors/MarionetteEventsParent.sys.mjs",
enableEventsActor:
"chrome://remote/content/marionette/actors/MarionetteEventsParent.sys.mjs",
error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs",
EventPromise: "chrome://remote/content/shared/Sync.sys.mjs",
getMarionetteCommandsActorProxy:
"chrome://remote/content/marionette/actors/MarionetteCommandsParent.sys.mjs",
IdlePromise: "chrome://remote/content/marionette/sync.sys.mjs",
l10n: "chrome://remote/content/marionette/l10n.sys.mjs",
Log: "chrome://remote/content/shared/Log.sys.mjs",
Marionette: "chrome://remote/content/components/Marionette.sys.mjs",
MarionettePrefs: "chrome://remote/content/marionette/prefs.sys.mjs",
modal: "chrome://remote/content/marionette/modal.sys.mjs",
navigate: "chrome://remote/content/marionette/navigate.sys.mjs",
permissions: "chrome://remote/content/marionette/permissions.sys.mjs",
pprint: "chrome://remote/content/shared/Format.sys.mjs",
print: "chrome://remote/content/shared/PDF.sys.mjs",
reftest: "chrome://remote/content/marionette/reftest.sys.mjs",
registerCommandsActor:
"chrome://remote/content/marionette/actors/MarionetteCommandsParent.sys.mjs",
RemoteAgent: "chrome://remote/content/components/RemoteAgent.sys.mjs",
TabManager: "chrome://remote/content/shared/TabManager.sys.mjs",
TimedPromise: "chrome://remote/content/marionette/sync.sys.mjs",
Timeouts: "chrome://remote/content/shared/webdriver/Capabilities.sys.mjs",
UnhandledPromptBehavior:
"chrome://remote/content/shared/webdriver/Capabilities.sys.mjs",
unregisterCommandsActor:
"chrome://remote/content/marionette/actors/MarionetteCommandsParent.sys.mjs",
waitForInitialNavigationCompleted:
"chrome://remote/content/shared/Navigate.sys.mjs",
waitForObserverTopic: "chrome://remote/content/marionette/sync.sys.mjs",
WebDriverSession: "chrome://remote/content/shared/webdriver/Session.sys.mjs",
windowManager: "chrome://remote/content/shared/WindowManager.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
Addon: "chrome://remote/content/marionette/addon.js",
atom: "chrome://remote/content/marionette/atom.js",
browser: "chrome://remote/content/marionette/browser.js",
capture: "chrome://remote/content/marionette/capture.js",
clearElementIdCache:
"chrome://remote/content/marionette/actors/MarionetteCommandsParent.jsm",
Context: "chrome://remote/content/marionette/browser.js",
cookie: "chrome://remote/content/marionette/cookie.js",
DebounceCallback: "chrome://remote/content/marionette/sync.js",
disableEventsActor:
"chrome://remote/content/marionette/actors/MarionetteEventsParent.jsm",
enableEventsActor:
"chrome://remote/content/marionette/actors/MarionetteEventsParent.jsm",
getMarionetteCommandsActorProxy:
"chrome://remote/content/marionette/actors/MarionetteCommandsParent.jsm",
IdlePromise: "chrome://remote/content/marionette/sync.js",
l10n: "chrome://remote/content/marionette/l10n.js",
MarionettePrefs: "chrome://remote/content/marionette/prefs.js",
modal: "chrome://remote/content/marionette/modal.js",
navigate: "chrome://remote/content/marionette/navigate.js",
permissions: "chrome://remote/content/marionette/permissions.js",
reftest: "chrome://remote/content/marionette/reftest.js",
registerCommandsActor:
"chrome://remote/content/marionette/actors/MarionetteCommandsParent.jsm",
TimedPromise: "chrome://remote/content/marionette/sync.js",
unregisterCommandsActor:
"chrome://remote/content/marionette/actors/MarionetteCommandsParent.jsm",
waitForObserverTopic: "chrome://remote/content/marionette/sync.js",
WebReference: "chrome://remote/content/marionette/element.js",
WindowState: "chrome://remote/content/marionette/browser.js",
WindowState: "chrome://remote/content/marionette/browser.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
@ -114,7 +105,7 @@ const TOPIC_BROWSER_READY = "browser-delayed-startup-finished";
* @param {MarionetteServer} server
* The instance of Marionette server.
*/
function GeckoDriver(server) {
export function GeckoDriver(server) {
this._server = server;
// WebDriver Session
@ -1360,9 +1351,9 @@ GeckoDriver.prototype.switchToFrame = async function(cmd) {
// Bug 1495063: Elements should be passed as WebReference reference
let byFrame;
if (typeof el == "string") {
byFrame = lazy.WebReference.fromUUID(el);
byFrame = WebReference.fromUUID(el);
} else if (el) {
byFrame = lazy.WebReference.fromJSON(el);
byFrame = WebReference.fromJSON(el);
}
const { browsingContext } = await this.getActor({ top }).switchToFrame(
@ -1402,7 +1393,7 @@ GeckoDriver.prototype.singleTap = async function(cmd) {
lazy.assert.open(this.getBrowsingContext());
let { id, x, y } = cmd.parameters;
let webEl = lazy.WebReference.fromUUID(id);
let webEl = WebReference.fromUUID(id);
await this.getActor().singleTap(
webEl,
@ -1491,7 +1482,7 @@ GeckoDriver.prototype.findElement = async function(cmd) {
let startNode;
if (typeof el != "undefined") {
startNode = lazy.WebReference.fromUUID(el);
startNode = WebReference.fromUUID(el);
}
let opts = {
@ -1536,7 +1527,7 @@ GeckoDriver.prototype.findElements = async function(cmd) {
let startNode;
if (typeof el != "undefined") {
startNode = lazy.WebReference.fromUUID(el);
startNode = WebReference.fromUUID(el);
}
let opts = {
@ -1581,7 +1572,7 @@ GeckoDriver.prototype.getShadowRoot = async function(cmd) {
cmd.parameters.id,
lazy.pprint`Expected "id" to be a string, got ${cmd.parameters.id}`
);
let webEl = lazy.WebReference.fromUUID(id);
let webEl = WebReference.fromUUID(id);
return this.getActor().getShadowRoot(webEl);
};
@ -1633,7 +1624,7 @@ GeckoDriver.prototype.clickElement = async function(cmd) {
await this._handleUserPrompts();
let id = lazy.assert.string(cmd.parameters.id);
let webEl = lazy.WebReference.fromUUID(id);
let webEl = WebReference.fromUUID(id);
const actor = this.getActor();
@ -1684,7 +1675,7 @@ GeckoDriver.prototype.getElementAttribute = async function(cmd) {
const id = lazy.assert.string(cmd.parameters.id);
const name = lazy.assert.string(cmd.parameters.name);
const webEl = lazy.WebReference.fromUUID(id);
const webEl = WebReference.fromUUID(id);
return this.getActor().getElementAttribute(webEl, name);
};
@ -1717,7 +1708,7 @@ GeckoDriver.prototype.getElementProperty = async function(cmd) {
const id = lazy.assert.string(cmd.parameters.id);
const name = lazy.assert.string(cmd.parameters.name);
const webEl = lazy.WebReference.fromUUID(id);
const webEl = WebReference.fromUUID(id);
return this.getActor().getElementProperty(webEl, name);
};
@ -1748,7 +1739,7 @@ GeckoDriver.prototype.getElementText = async function(cmd) {
await this._handleUserPrompts();
let id = lazy.assert.string(cmd.parameters.id);
let webEl = lazy.WebReference.fromUUID(id);
let webEl = WebReference.fromUUID(id);
return this.getActor().getElementText(webEl);
};
@ -1778,7 +1769,7 @@ GeckoDriver.prototype.getElementTagName = async function(cmd) {
await this._handleUserPrompts();
let id = lazy.assert.string(cmd.parameters.id);
let webEl = lazy.WebReference.fromUUID(id);
let webEl = WebReference.fromUUID(id);
return this.getActor().getElementTagName(webEl);
};
@ -1806,7 +1797,7 @@ GeckoDriver.prototype.isElementDisplayed = async function(cmd) {
await this._handleUserPrompts();
let id = lazy.assert.string(cmd.parameters.id);
let webEl = lazy.WebReference.fromUUID(id);
let webEl = WebReference.fromUUID(id);
return this.getActor().isElementDisplayed(
webEl,
@ -1842,7 +1833,7 @@ GeckoDriver.prototype.getElementValueOfCssProperty = async function(cmd) {
let id = lazy.assert.string(cmd.parameters.id);
let prop = lazy.assert.string(cmd.parameters.propertyName);
let webEl = lazy.WebReference.fromUUID(id);
let webEl = WebReference.fromUUID(id);
return this.getActor().getElementValueOfCssProperty(webEl, prop);
};
@ -1872,7 +1863,7 @@ GeckoDriver.prototype.isElementEnabled = async function(cmd) {
await this._handleUserPrompts();
let id = lazy.assert.string(cmd.parameters.id);
let webEl = lazy.WebReference.fromUUID(id);
let webEl = WebReference.fromUUID(id);
return this.getActor().isElementEnabled(
webEl,
@ -1903,7 +1894,7 @@ GeckoDriver.prototype.isElementSelected = async function(cmd) {
await this._handleUserPrompts();
let id = lazy.assert.string(cmd.parameters.id);
let webEl = lazy.WebReference.fromUUID(id);
let webEl = WebReference.fromUUID(id);
return this.getActor().isElementSelected(
webEl,
@ -1928,7 +1919,7 @@ GeckoDriver.prototype.getElementRect = async function(cmd) {
await this._handleUserPrompts();
let id = lazy.assert.string(cmd.parameters.id);
let webEl = lazy.WebReference.fromUUID(id);
let webEl = WebReference.fromUUID(id);
return this.getActor().getElementRect(webEl);
};
@ -1958,7 +1949,7 @@ GeckoDriver.prototype.sendKeysToElement = async function(cmd) {
let id = lazy.assert.string(cmd.parameters.id);
let text = lazy.assert.string(cmd.parameters.text);
let webEl = lazy.WebReference.fromUUID(id);
let webEl = WebReference.fromUUID(id);
return this.getActor().sendKeysToElement(
webEl,
@ -1989,7 +1980,7 @@ GeckoDriver.prototype.clearElement = async function(cmd) {
await this._handleUserPrompts();
let id = lazy.assert.string(cmd.parameters.id);
let webEl = lazy.WebReference.fromUUID(id);
let webEl = WebReference.fromUUID(id);
await this.getActor().clearElement(webEl);
};
@ -2344,7 +2335,7 @@ GeckoDriver.prototype.takeScreenshot = async function(cmd) {
full = typeof full == "undefined" ? true : full;
scroll = typeof scroll == "undefined" ? true : scroll;
let webEl = id ? lazy.WebReference.fromUUID(id) : null;
let webEl = id ? WebReference.fromUUID(id) : null;
// Only consider full screenshot if no element has been specified
full = webEl ? false : full;

View file

@ -2,34 +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";
const EXPORTED_SYMBOLS = [
"element",
"ShadowRoot",
"WebElement",
"WebFrame",
"WebReference",
"WebWindow",
];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
assert: "chrome://remote/content/shared/webdriver/Assert.sys.mjs",
atom: "chrome://remote/content/marionette/atom.sys.mjs",
error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs",
PollPromise: "chrome://remote/content/marionette/sync.sys.mjs",
pprint: "chrome://remote/content/shared/Format.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
ContentDOMReference: "resource://gre/modules/ContentDOMReference.jsm",
atom: "chrome://remote/content/marionette/atom.js",
PollPromise: "chrome://remote/content/marionette/sync.js",
});
const ORDERED_NODE_ITERATOR_TYPE = 5;
@ -72,7 +58,7 @@ const XUL_SELECTED_ELS = new Set([
*
* @namespace
*/
const element = {};
export const element = {};
element.Strategy = {
ClassName: "class name",
@ -1449,7 +1435,7 @@ element.isBooleanAttribute = function(el, attr) {
* In Marionette this abstraction can represent DOM elements,
* WindowProxies, and XUL elements.
*/
class WebReference {
export class WebReference {
/**
* @param {string} uuid
* Identifier that must be unique across all browsing contexts
@ -1620,7 +1606,7 @@ class WebReference {
* DOM elements are represented as web elements when they are
* transported over the wire protocol.
*/
class WebElement extends WebReference {
export class WebElement extends WebReference {
toJSON() {
return { [WebElement.Identifier]: this.uuid };
}
@ -1638,13 +1624,14 @@ class WebElement extends WebReference {
return new WebElement(uuid);
}
}
WebElement.Identifier = "element-6066-11e4-a52e-4f735466cecf";
/**
* Shadow Root elements are represented as shadow root references when they are
* transported over the wire protocol
*/
class ShadowRoot extends WebReference {
export class ShadowRoot extends WebReference {
toJSON() {
return { [ShadowRoot.Identifier]: this.uuid };
}
@ -1662,6 +1649,7 @@ class ShadowRoot extends WebReference {
return new ShadowRoot(uuid);
}
}
ShadowRoot.Identifier = "shadow-6066-11e4-a52e-4f735466cecf";
/**
@ -1669,7 +1657,7 @@ ShadowRoot.Identifier = "shadow-6066-11e4-a52e-4f735466cecf";
* whose <code>opener</code> is null, are represented as web windows
* over the wire protocol.
*/
class WebWindow extends WebReference {
export class WebWindow extends WebReference {
toJSON() {
return { [WebWindow.Identifier]: this.uuid };
}
@ -1684,6 +1672,7 @@ class WebWindow extends WebReference {
return new WebWindow(uuid);
}
}
WebWindow.Identifier = "window-fcc6-11e5-b4f8-330a88ab9d7f";
/**
@ -1691,7 +1680,7 @@ WebWindow.Identifier = "window-fcc6-11e5-b4f8-330a88ab9d7f";
* associated with <tt>&lt;frame&gt;</tt> and <tt>&lt;iframe&gt;</tt>,
* are represented as web frames over the wire protocol.
*/
class WebFrame extends WebReference {
export class WebFrame extends WebReference {
toJSON() {
return { [WebFrame.Identifier]: this.uuid };
}
@ -1706,4 +1695,5 @@ class WebFrame extends WebReference {
return new WebFrame(uuid);
}
}
WebFrame.Identifier = "frame-075b-4da1-b6ba-e579c2d3230a";

View file

@ -2,27 +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 EXPORTED_SYMBOLS = ["evaluate", "sandbox", "Sandboxes"];
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const { clearTimeout, setTimeout } = ChromeUtils.import(
"resource://gre/modules/Timer.jsm"
);
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
element: "chrome://remote/content/marionette/element.sys.mjs",
error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs",
Log: "chrome://remote/content/shared/Log.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
element: "chrome://remote/content/marionette/element.js",
WebReference: "chrome://remote/content/marionette/element.js",
WebReference: "chrome://remote/content/marionette/element.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
@ -36,7 +28,7 @@ const DEFAULT_TIMEOUT = 10000; // ms
const FINISH = "finish";
/** @namespace */
const evaluate = {};
export const evaluate = {};
/**
* Asserts that an arbitrary object is not cyclic.
@ -476,7 +468,7 @@ evaluate.isDead = function(obj, prop) {
return false;
};
const sandbox = {};
export const sandbox = {};
/**
* Provides a safe way to take an object defined in a privileged scope and
@ -585,7 +577,7 @@ sandbox.createSimpleTest = function(win, harness) {
*
* @memberof evaluate
*/
class Sandboxes {
export class Sandboxes {
/**
* @param {function(): Window} windowFn
* A function that returns the references to the current Window

View file

@ -2,14 +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";
/* eslint-disable no-restricted-globals */
const EXPORTED_SYMBOLS = ["event"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
@ -18,7 +13,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
});
/** Provides functionality for creating and sending DOM events. */
const event = {};
export const event = {};
XPCOMUtils.defineLazyGetter(lazy, "dblclickTimer", () => {
return Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);

View file

@ -4,28 +4,19 @@
/* eslint-disable no-restricted-globals */
"use strict";
const EXPORTED_SYMBOLS = ["interaction"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
accessibility: "chrome://remote/content/marionette/accessibility.sys.mjs",
atom: "chrome://remote/content/marionette/atom.sys.mjs",
element: "chrome://remote/content/marionette/element.sys.mjs",
error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs",
event: "chrome://remote/content/marionette/event.sys.mjs",
Log: "chrome://remote/content/shared/Log.sys.mjs",
pprint: "chrome://remote/content/shared/Format.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
accessibility: "chrome://remote/content/marionette/accessibility.js",
atom: "chrome://remote/content/marionette/atom.js",
element: "chrome://remote/content/marionette/element.js",
event: "chrome://remote/content/marionette/event.js",
TimedPromise: "chrome://remote/content/marionette/sync.js",
TimedPromise: "chrome://remote/content/marionette/sync.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
@ -78,7 +69,7 @@ const INPUT_TYPES_NO_EVENT = new Set([
]);
/** @namespace */
const interaction = {};
export const interaction = {};
/**
* Interact with an element by clicking it.

View file

@ -4,41 +4,41 @@
remote.jar:
% content remote %content/
content/marionette/accessibility.js (accessibility.js)
content/marionette/action.js (action.js)
content/marionette/actors/MarionetteCommandsChild.jsm (actors/MarionetteCommandsChild.jsm)
content/marionette/actors/MarionetteCommandsParent.jsm (actors/MarionetteCommandsParent.jsm)
content/marionette/actors/MarionetteEventsChild.jsm (actors/MarionetteEventsChild.jsm)
content/marionette/actors/MarionetteEventsParent.jsm (actors/MarionetteEventsParent.jsm)
content/marionette/actors/MarionetteReftestChild.jsm (actors/MarionetteReftestChild.jsm)
content/marionette/actors/MarionetteReftestParent.jsm (actors/MarionetteReftestParent.jsm)
content/marionette/addon.js (addon.js)
content/marionette/atom.js (atom.js)
content/marionette/browser.js (browser.js)
content/marionette/capture.js (capture.js)
content/marionette/cert.js (cert.js)
content/marionette/cookie.js (cookie.js)
content/marionette/dom.js (dom.js)
content/marionette/driver.js (driver.js)
content/marionette/element.js (element.js)
content/marionette/evaluate.js (evaluate.js)
content/marionette/event.js (event.js)
content/marionette/interaction.js (interaction.js)
content/marionette/l10n.js (l10n.js)
content/marionette/legacyaction.js (legacyaction.js)
content/marionette/message.js (message.js)
content/marionette/modal.js (modal.js)
content/marionette/navigate.js (navigate.js)
content/marionette/packets.js (packets.js)
content/marionette/permissions.js (permissions.js)
content/marionette/prefs.js (prefs.js)
content/marionette/reftest.js (reftest.js)
content/marionette/accessibility.sys.mjs (accessibility.sys.mjs)
content/marionette/action.sys.mjs (action.sys.mjs)
content/marionette/actors/MarionetteCommandsChild.sys.mjs (actors/MarionetteCommandsChild.sys.mjs)
content/marionette/actors/MarionetteCommandsParent.sys.mjs (actors/MarionetteCommandsParent.sys.mjs)
content/marionette/actors/MarionetteEventsChild.sys.mjs (actors/MarionetteEventsChild.sys.mjs)
content/marionette/actors/MarionetteEventsParent.sys.mjs (actors/MarionetteEventsParent.sys.mjs)
content/marionette/actors/MarionetteReftestChild.sys.mjs (actors/MarionetteReftestChild.sys.mjs)
content/marionette/actors/MarionetteReftestParent.sys.mjs (actors/MarionetteReftestParent.sys.mjs)
content/marionette/addon.sys.mjs (addon.sys.mjs)
content/marionette/atom.sys.mjs (atom.sys.mjs)
content/marionette/browser.sys.mjs (browser.sys.mjs)
content/marionette/capture.sys.mjs (capture.sys.mjs)
content/marionette/cert.sys.mjs (cert.sys.mjs)
content/marionette/cookie.sys.mjs (cookie.sys.mjs)
content/marionette/dom.sys.mjs (dom.sys.mjs)
content/marionette/driver.sys.mjs (driver.sys.mjs)
content/marionette/element.sys.mjs (element.sys.mjs)
content/marionette/evaluate.sys.mjs (evaluate.sys.mjs)
content/marionette/event.sys.mjs (event.sys.mjs)
content/marionette/interaction.sys.mjs (interaction.sys.mjs)
content/marionette/l10n.sys.mjs (l10n.sys.mjs)
content/marionette/legacyaction.sys.mjs (legacyaction.sys.mjs)
content/marionette/message.sys.mjs (message.sys.mjs)
content/marionette/modal.sys.mjs (modal.sys.mjs)
content/marionette/navigate.sys.mjs (navigate.sys.mjs)
content/marionette/packets.sys.mjs (packets.sys.mjs)
content/marionette/permissions.sys.mjs (permissions.sys.mjs)
content/marionette/prefs.sys.mjs (prefs.sys.mjs)
content/marionette/reftest.sys.mjs (reftest.sys.mjs)
content/marionette/reftest.xhtml (chrome/reftest.xhtml)
content/marionette/reftest-content.js (reftest-content.js)
content/marionette/server.js (server.js)
content/marionette/stream-utils.js (stream-utils.js)
content/marionette/sync.js (sync.js)
content/marionette/transport.js (transport.js)
content/marionette/server.sys.mjs (server.sys.mjs)
content/marionette/stream-utils.sys.mjs (stream-utils.sys.mjs)
content/marionette/sync.sys.mjs (sync.sys.mjs)
content/marionette/transport.sys.mjs (transport.sys.mjs)
#ifdef ENABLE_TESTS
content/marionette/test_dialog.dtd (chrome/test_dialog.dtd)
content/marionette/test_dialog.properties (chrome/test_dialog.properties)

View file

@ -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";
const EXPORTED_SYMBOLS = ["l10n"];
/**
* An API which allows Marionette to handle localized content.
*
@ -17,9 +13,7 @@ const EXPORTED_SYMBOLS = ["l10n"];
* content retrieved.
*/
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.defineLazyGetter(lazy, "domParser", () => {
});
/** @namespace */
const l10n = {};
export const l10n = {};
/**
* Retrieve the localized string for the specified entity id.

View file

@ -4,29 +4,22 @@
/* eslint-disable no-restricted-globals */
"use strict";
const EXPORTED_SYMBOLS = ["legacyaction"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
accessibility: "chrome://remote/content/marionette/accessibility.sys.mjs",
element: "chrome://remote/content/marionette/element.sys.mjs",
error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs",
evaluate: "chrome://remote/content/marionette/evaluate.sys.mjs",
event: "chrome://remote/content/marionette/event.sys.mjs",
Log: "chrome://remote/content/shared/Log.sys.mjs",
WebReference: "chrome://remote/content/marionette/element.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
Preferences: "resource://gre/modules/Preferences.jsm",
accessibility: "chrome://remote/content/marionette/accessibility.js",
element: "chrome://remote/content/marionette/element.js",
evaluate: "chrome://remote/content/marionette/evaluate.js",
event: "chrome://remote/content/marionette/event.js",
WebReference: "chrome://remote/content/marionette/element.js",
});
XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
@ -37,7 +30,8 @@ const CONTEXT_MENU_DELAY_PREF = "ui.click_hold_context_menus.delay";
const DEFAULT_CONTEXT_MENU_DELAY = 750; // ms
/** @namespace */
const legacyaction = {};
export const legacyaction = {};
const action = legacyaction;
/**

View file

@ -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";
const EXPORTED_SYMBOLS = ["Command", "Message", "Response"];
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
@ -15,7 +11,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
});
/** Representation of the packets transproted over the wire. */
class Message {
export class Message {
/**
* @param {number} messageID
* Message ID unique identifying this message.
@ -135,7 +131,7 @@ Message.Origin = {
* @param {Object.<string, ?>} params
* Command parameters.
*/
class Command extends Message {
export class Command extends Message {
constructor(messageID, name, params = {}) {
super(messageID);
@ -200,6 +196,7 @@ class Command extends Message {
return new Command(msgID, name, params);
}
}
Command.Type = 0;
/**
@ -229,7 +226,7 @@ Command.Type = 0;
* @param {ResponseHandler} respHandler
* Function callback called on sending the response.
*/
class Response extends Message {
export class Response extends Message {
constructor(messageID, respHandler = () => {}) {
super(messageID);
@ -328,4 +325,5 @@ class Response extends Message {
return resp;
}
}
Response.Type = 1;

View file

@ -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";
const EXPORTED_SYMBOLS = ["modal"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
@ -24,7 +18,7 @@ XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
const COMMON_DIALOG = "chrome://global/content/commonDialog.xhtml";
/** @namespace */
const modal = {
export const modal = {
ACTION_CLOSED: "closed",
ACTION_OPENED: "opened",
};

View file

@ -2,32 +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";
const EXPORTED_SYMBOLS = ["navigate"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs",
EventDispatcher:
"chrome://remote/content/marionette/actors/MarionetteEventsParent.sys.mjs",
Log: "chrome://remote/content/shared/Log.sys.mjs",
modal: "chrome://remote/content/marionette/modal.sys.mjs",
PageLoadStrategy:
"chrome://remote/content/shared/webdriver/Capabilities.sys.mjs",
ProgressListener: "chrome://remote/content/shared/Navigate.sys.mjs",
TimedPromise: "chrome://remote/content/marionette/sync.sys.mjs",
truncate: "chrome://remote/content/shared/Format.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
EventDispatcher:
"chrome://remote/content/marionette/actors/MarionetteEventsParent.jsm",
modal: "chrome://remote/content/marionette/modal.js",
TimedPromise: "chrome://remote/content/marionette/sync.js",
});
XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
lazy.Log.get(lazy.Log.TYPES.MARIONETTE)
);
@ -37,7 +28,7 @@ const TIMEOUT_BEFOREUNLOAD_EVENT = 200;
const TIMEOUT_UNLOAD_EVENT = 5000;
/** @namespace */
const navigate = {};
export const navigate = {};
/**
* Checks the value of readyState for the current page

View file

@ -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";
const EXPORTED_SYMBOLS = ["RawPacket", "Packet", "JSONPacket", "BulkPacket"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
XPCOMUtils.defineLazyModuleGetters(lazy, {
StreamUtils: "chrome://remote/content/marionette/stream-utils.js",
ChromeUtils.defineESModuleGetters(lazy, {
StreamUtils: "chrome://remote/content/marionette/stream-utils.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "unicodeConverter", () => {
@ -65,7 +59,7 @@ const PACKET_LENGTH_MAX = Math.pow(2, 40);
*
* @class
*/
function Packet(transport) {
export function Packet(transport) {
this._transport = transport;
this._length = 0;
}
@ -122,7 +116,7 @@ Packet.prototype = {
* @param {DebuggerTransport} transport
* Transport instance that will own the packet.
*/
function JSONPacket(transport) {
export function JSONPacket(transport) {
Packet.call(this, transport);
this._data = "";
this._done = false;
@ -251,7 +245,7 @@ JSONPacket.prototype.toString = function() {
* @param {DebuggerTransport} transport
* Transport instance that will own the packet.
*/
function BulkPacket(transport) {
export function BulkPacket(transport) {
Packet.call(this, transport);
this._done = false;
this._readyForWriting = defer();
@ -404,7 +398,7 @@ BulkPacket.prototype.toString = function() {
* @param data string
* The raw string to send out onto the stream.
*/
function RawPacket(transport, data) {
export function RawPacket(transport, data) {
Packet.call(this, transport);
this._data = data;
this.length = data.length;

View file

@ -2,26 +2,15 @@
* 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 EXPORTED_SYMBOLS = ["permissions"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
MarionettePrefs: "chrome://remote/content/marionette/prefs.js",
MarionettePrefs: "chrome://remote/content/marionette/prefs.sys.mjs",
});
/** @namespace */
const permissions = {};
export const permissions = {};
/**
* Set a permission's state.

View file

@ -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";
const EXPORTED_SYMBOLS = ["Branch", "EnvironmentPrefs", "MarionettePrefs"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
@ -21,7 +15,7 @@ XPCOMUtils.defineLazyServiceGetter(
const { PREF_BOOL, PREF_INT, PREF_INVALID, PREF_STRING } = Ci.nsIPrefBranch;
class Branch {
export class Branch {
/**
* @param {string=} branch
* Preference subtree. Uses root tree given `null`.
@ -162,7 +156,7 @@ class MarionetteBranch extends Branch {
}
/** Reads a JSON serialised blob stored in the environment. */
class EnvironmentPrefs {
export class EnvironmentPrefs {
/**
* Reads the environment variable `key` and tries to parse it as
* JSON Object, then provides an iterator over its keys and values.
@ -194,4 +188,4 @@ class EnvironmentPrefs {
// There is a future potential of exposing this as Marionette.prefs.port
// if we introduce a Marionette.jsm module.
const MarionettePrefs = new MarionetteBranch();
export const MarionettePrefs = new MarionetteBranch();

View file

@ -2,29 +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";
const EXPORTED_SYMBOLS = ["reftest"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
AppInfo: "chrome://remote/content/shared/AppInfo.sys.mjs",
assert: "chrome://remote/content/shared/webdriver/Assert.sys.mjs",
capture: "chrome://remote/content/marionette/capture.sys.mjs",
Log: "chrome://remote/content/shared/Log.sys.mjs",
navigate: "chrome://remote/content/marionette/navigate.sys.mjs",
print: "chrome://remote/content/shared/PDF.sys.mjs",
windowManager: "chrome://remote/content/shared/WindowManager.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
E10SUtils: "resource://gre/modules/E10SUtils.jsm",
capture: "chrome://remote/content/marionette/capture.js",
navigate: "chrome://remote/content/marionette/navigate.js",
});
XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
@ -65,7 +58,7 @@ const DEFAULT_PDF_RESOLUTION = 96 / 72;
*
* @namespace
*/
const reftest = {};
export const reftest = {};
/**
* @memberof reftest
@ -116,12 +109,12 @@ reftest.Runner = class {
ChromeUtils.registerWindowActor("MarionetteReftest", {
kind: "JSWindowActor",
parent: {
moduleURI:
"chrome://remote/content/marionette/actors/MarionetteReftestParent.jsm",
esModuleURI:
"chrome://remote/content/marionette/actors/MarionetteReftestParent.sys.mjs",
},
child: {
moduleURI:
"chrome://remote/content/marionette/actors/MarionetteReftestChild.jsm",
esModuleURI:
"chrome://remote/content/marionette/actors/MarionetteReftestChild.sys.mjs",
events: {
load: { mozSystemGroup: true, capture: true },
},

View file

@ -2,30 +2,21 @@
* 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 EXPORTED_SYMBOLS = ["TCPConnection", "TCPListener"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
assert: "chrome://remote/content/shared/webdriver/Assert.sys.mjs",
Command: "chrome://remote/content/marionette/message.sys.mjs",
DebuggerTransport: "chrome://remote/content/marionette/transport.sys.mjs",
error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs",
GeckoDriver: "chrome://remote/content/marionette/driver.sys.mjs",
Log: "chrome://remote/content/shared/Log.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
Command: "chrome://remote/content/marionette/message.js",
DebuggerTransport: "chrome://remote/content/marionette/transport.js",
GeckoDriver: "chrome://remote/content/marionette/driver.js",
MarionettePrefs: "chrome://remote/content/marionette/prefs.js",
Message: "chrome://remote/content/marionette/message.js",
Response: "chrome://remote/content/marionette/message.js",
WebReference: "chrome://remote/content/marionette/element.js",
MarionettePrefs: "chrome://remote/content/marionette/prefs.sys.mjs",
Message: "chrome://remote/content/marionette/message.sys.mjs",
Response: "chrome://remote/content/marionette/message.sys.mjs",
WebReference: "chrome://remote/content/marionette/element.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
@ -50,7 +41,7 @@ const PROTOCOL_VERSION = 3;
* debugger transport interface on the provided `port`. For every
* new connection, a {@link TCPConnection} is created.
*/
class TCPListener {
export class TCPListener {
/**
* @param {number} port
* Port for server to listen to.
@ -184,7 +175,7 @@ class TCPListener {
* @param {function(): GeckoDriver} driverFactory
* Factory function that produces a {@link GeckoDriver}.
*/
class TCPConnection {
export class TCPConnection {
constructor(connID, transport, driverFactory) {
this.id = connID;
this.conn = transport;

View file

@ -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";
const EXPORTED_SYMBOLS = ["StreamUtils"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
@ -256,7 +250,7 @@ function delimitedRead(stream, delimiter, count) {
return data;
}
const StreamUtils = {
export const StreamUtils = {
copyStream,
delimitedRead,
};

View file

@ -2,26 +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";
const EXPORTED_SYMBOLS = [
"executeSoon",
"DebounceCallback",
"IdlePromise",
"MessageManagerDestroyedPromise",
"PollPromise",
"Sleep",
"TimedPromise",
"waitForMessage",
"waitForObserverTopic",
];
const { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm"
);
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
@ -44,7 +28,7 @@ const PROMISE_TIMEOUT = AppConstants.DEBUG ? 4500 : 1500;
* @param {function} func
* Function to be executed.
*/
function executeSoon(func) {
export function executeSoon(func) {
if (typeof func != "function") {
throw new TypeError();
}
@ -103,7 +87,7 @@ function executeSoon(func) {
* @throws {RangeError}
* If `timeout` or `interval` are not unsigned integers.
*/
function PollPromise(func, { timeout = null, interval = 10 } = {}) {
export function PollPromise(func, { timeout = null, interval = 10 } = {}) {
const timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
if (typeof func != "function") {
@ -199,7 +183,7 @@ function PollPromise(func, { timeout = null, interval = 10 } = {}) {
* @throws {RangeError}
* If `timeout` is not an unsigned integer.
*/
function TimedPromise(fn, options = {}) {
export function TimedPromise(fn, options = {}) {
const {
errorMessage = "TimedPromise timed out",
timeout = PROMISE_TIMEOUT,
@ -267,7 +251,7 @@ function TimedPromise(fn, options = {}) {
* @throws {RangeError}
* If `timeout` is not an unsigned integer.
*/
function Sleep(timeout) {
export function Sleep(timeout) {
if (typeof timeout != "number") {
throw new TypeError();
}
@ -314,7 +298,7 @@ function Sleep(timeout) {
* @return {Promise}
* A promise that resolves when the message manager has been destroyed.
*/
function MessageManagerDestroyedPromise(messageManager) {
export function MessageManagerDestroyedPromise(messageManager) {
return new Promise(resolve => {
function observe(subject, topic) {
lazy.logger.trace(`Received observer notification ${topic}`);
@ -338,7 +322,7 @@ function MessageManagerDestroyedPromise(messageManager) {
*
* @return Promise
*/
function IdlePromise(win) {
export function IdlePromise(win) {
const animationFramePromise = new Promise(resolve => {
executeSoon(() => {
win.requestAnimationFrame(resolve);
@ -390,7 +374,7 @@ function IdlePromise(win) {
* @param {number=} [timeout = 250] timeout
* Time since last event firing, before `fn` will be invoked.
*/
class DebounceCallback {
export class DebounceCallback {
constructor(fn, { timeout = 250 } = {}) {
if (typeof fn != "function" || typeof timeout != "number") {
throw new TypeError();
@ -438,7 +422,7 @@ class DebounceCallback {
* Promise which resolves to the data property of the received
* ``Message``.
*/
function waitForMessage(
export function waitForMessage(
messageManager,
messageName,
{ checkFn = undefined } = {}
@ -488,7 +472,7 @@ function waitForMessage(
* Promise which resolves to an array of ``subject``, and ``data`` from
* the observed notification.
*/
function waitForObserverTopic(topic, { checkFn = null } = {}) {
export function waitForObserverTopic(topic, { checkFn = null } = {}) {
if (typeof topic != "string") {
throw new TypeError();
}

View file

@ -4,8 +4,8 @@
"use strict";
const { action } = ChromeUtils.import(
"chrome://remote/content/marionette/action.js"
const { action } = ChromeUtils.importESModule(
"chrome://remote/content/marionette/action.sys.mjs"
);
const XHTMLNS = "http://www.w3.org/1999/xhtml";

View file

@ -8,11 +8,11 @@ const {
getMarionetteCommandsActorProxy,
registerCommandsActor,
unregisterCommandsActor,
} = ChromeUtils.import(
"chrome://remote/content/marionette/actors/MarionetteCommandsParent.jsm"
} = ChromeUtils.importESModule(
"chrome://remote/content/marionette/actors/MarionetteCommandsParent.sys.mjs"
);
const { enableEventsActor, disableEventsActor } = ChromeUtils.import(
"chrome://remote/content/marionette/actors/MarionetteEventsParent.jsm"
const { enableEventsActor, disableEventsActor } = ChromeUtils.importESModule(
"chrome://remote/content/marionette/actors/MarionetteEventsParent.sys.mjs"
);
registerCleanupFunction(function() {

View file

@ -1,5 +1,5 @@
const { Context } = ChromeUtils.import(
"chrome://remote/content/marionette/browser.js"
const { Context } = ChromeUtils.importESModule(
"chrome://remote/content/marionette/browser.sys.mjs"
);
add_test(function test_Context() {

View file

@ -2,8 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
const { cookie } = ChromeUtils.import(
"chrome://remote/content/marionette/cookie.js"
const { cookie } = ChromeUtils.importESModule(
"chrome://remote/content/marionette/cookie.sys.mjs"
);
/* eslint-disable mozilla/use-chromeutils-generateqi */

View file

@ -1,7 +1,9 @@
const {
ContentEventObserverService,
WebElementEventTarget,
} = ChromeUtils.import("chrome://remote/content/marionette/dom.js");
} = ChromeUtils.importESModule(
"chrome://remote/content/marionette/dom.sys.mjs"
);
class MessageSender {
constructor() {

View file

@ -8,7 +8,9 @@ const {
WebFrame,
WebReference,
WebWindow,
} = ChromeUtils.import("chrome://remote/content/marionette/element.js");
} = ChromeUtils.importESModule(
"chrome://remote/content/marionette/element.sys.mjs"
);
const SVG_NS = "http://www.w3.org/2000/svg";
const XHTML_NS = "http://www.w3.org/1999/xhtml";

View file

@ -1,8 +1,8 @@
const { element, WebReference } = ChromeUtils.import(
"chrome://remote/content/marionette/element.js"
const { element, WebReference } = ChromeUtils.importESModule(
"chrome://remote/content/marionette/element.sys.mjs"
);
const { evaluate } = ChromeUtils.import(
"chrome://remote/content/marionette/evaluate.js"
const { evaluate } = ChromeUtils.importESModule(
"chrome://remote/content/marionette/evaluate.sys.mjs"
);
const SVG_NS = "http://www.w3.org/2000/svg";

View file

@ -5,8 +5,8 @@
const { error } = ChromeUtils.importESModule(
"chrome://remote/content/shared/webdriver/Errors.sys.mjs"
);
const { Command, Message, Response } = ChromeUtils.import(
"chrome://remote/content/marionette/message.js"
const { Command, Message, Response } = ChromeUtils.importESModule(
"chrome://remote/content/marionette/message.sys.mjs"
);
add_test(function test_Message_Origin() {

View file

@ -4,8 +4,8 @@
"use strict";
const { modal } = ChromeUtils.import(
"chrome://remote/content/marionette/modal.js"
const { modal } = ChromeUtils.importESModule(
"chrome://remote/content/marionette/modal.sys.mjs"
);
const chromeWindow = {};

View file

@ -2,8 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
const { navigate } = ChromeUtils.import(
"chrome://remote/content/marionette/navigate.js"
const { navigate } = ChromeUtils.importESModule(
"chrome://remote/content/marionette/navigate.sys.mjs"
);
const mockTopContext = {

View file

@ -15,8 +15,12 @@ XPCOMUtils.defineLazyServiceGetter(
"nsIEnvironment"
);
const { Branch, EnvironmentPrefs, MarionettePrefs } = ChromeUtils.import(
"chrome://remote/content/marionette/prefs.js"
const {
Branch,
EnvironmentPrefs,
MarionettePrefs,
} = ChromeUtils.importESModule(
"chrome://remote/content/marionette/prefs.sys.mjs"
);
function reset() {

View file

@ -1,5 +1,5 @@
const { element, WebReference } = ChromeUtils.import(
"chrome://remote/content/marionette/element.js"
const { element, WebReference } = ChromeUtils.importESModule(
"chrome://remote/content/marionette/element.sys.mjs"
);
const SVG_NS = "http://www.w3.org/2000/svg";

View file

@ -10,7 +10,9 @@ const {
TimedPromise,
waitForMessage,
waitForObserverTopic,
} = ChromeUtils.import("chrome://remote/content/marionette/sync.js");
} = ChromeUtils.importESModule(
"chrome://remote/content/marionette/sync.sys.mjs"
);
/**
* Mimic a message manager for sending messages.
@ -68,7 +70,9 @@ class MockTimer {
add_test(function test_executeSoon_callback() {
// executeSoon() is already defined for xpcshell in head.js. As such import
// our implementation into a custom namespace.
let sync = ChromeUtils.import("chrome://remote/content/marionette/sync.js");
let sync = ChromeUtils.importESModule(
"chrome://remote/content/marionette/sync.sys.mjs"
);
for (let func of ["foo", null, true, [], {}]) {
Assert.throws(() => sync.executeSoon(func), /TypeError/);

View file

@ -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";
const EXPORTED_SYMBOLS = ["DebuggerTransport"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
BulkPacket: "chrome://remote/content/marionette/packets.sys.mjs",
executeSoon: "chrome://remote/content/marionette/sync.sys.mjs",
JSONPacket: "chrome://remote/content/marionette/packets.sys.mjs",
Packet: "chrome://remote/content/marionette/packets.sys.mjs",
StreamUtils: "chrome://remote/content/marionette/stream-utils.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
EventEmitter: "resource://gre/modules/EventEmitter.jsm",
BulkPacket: "chrome://remote/content/marionette/packets.js",
executeSoon: "chrome://remote/content/marionette/sync.js",
JSONPacket: "chrome://remote/content/marionette/packets.js",
Packet: "chrome://remote/content/marionette/packets.js",
StreamUtils: "chrome://remote/content/marionette/stream-utils.js",
});
XPCOMUtils.defineLazyGetter(lazy, "ScriptableInputStream", () => {
@ -102,7 +98,7 @@ const PACKET_HEADER_MAX = 200;
*
* @class
*/
function DebuggerTransport(input, output) {
export function DebuggerTransport(input, output) {
lazy.EventEmitter.decorate(this);
this._input = input;

View file

@ -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/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
@ -11,11 +9,8 @@ ChromeUtils.defineESModuleGetters(lazy, {
error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs",
EventPromise: "chrome://remote/content/shared/Sync.sys.mjs",
TabManager: "chrome://remote/content/shared/TabManager.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
TimedPromise: "chrome://remote/content/marionette/sync.js",
waitForObserverTopic: "chrome://remote/content/marionette/sync.js",
TimedPromise: "chrome://remote/content/marionette/sync.sys.mjs",
waitForObserverTopic: "chrome://remote/content/marionette/sync.sys.mjs",
});
/**

View file

@ -7,6 +7,8 @@ import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
accessibility: "chrome://remote/content/marionette/accessibility.sys.mjs",
allowAllCerts: "chrome://remote/content/marionette/cert.sys.mjs",
Capabilities: "chrome://remote/content/shared/webdriver/Capabilities.sys.mjs",
error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs",
Log: "chrome://remote/content/shared/Log.sys.mjs",
@ -19,8 +21,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
accessibility: "chrome://remote/content/marionette/accessibility.js",
allowAllCerts: "chrome://remote/content/marionette/cert.js",
WebDriverBiDiConnection:
"chrome://remote/content/webdriver-bidi/WebDriverBiDiConnection.jsm",
});

View file

@ -123,61 +123,6 @@
"remote/cdp/targets/Target.jsm",
"chrome://remote/content/cdp/targets/TargetList.jsm":
"remote/cdp/targets/TargetList.jsm",
"chrome://remote/content/marionette/PerTestCoverageUtils.jsm":
"tools/code-coverage/PerTestCoverageUtils.jsm",
"chrome://remote/content/marionette/accessibility.js":
"remote/marionette/accessibility.js",
"chrome://remote/content/marionette/action.js": "remote/marionette/action.js",
"chrome://remote/content/marionette/actors/MarionetteCommandsChild.jsm":
"remote/marionette/actors/MarionetteCommandsChild.jsm",
"chrome://remote/content/marionette/actors/MarionetteCommandsParent.jsm":
"remote/marionette/actors/MarionetteCommandsParent.jsm",
"chrome://remote/content/marionette/actors/MarionetteEventsChild.jsm":
"remote/marionette/actors/MarionetteEventsChild.jsm",
"chrome://remote/content/marionette/actors/MarionetteEventsParent.jsm":
"remote/marionette/actors/MarionetteEventsParent.jsm",
"chrome://remote/content/marionette/actors/MarionetteReftestChild.jsm":
"remote/marionette/actors/MarionetteReftestChild.jsm",
"chrome://remote/content/marionette/actors/MarionetteReftestParent.jsm":
"remote/marionette/actors/MarionetteReftestParent.jsm",
"chrome://remote/content/marionette/addon.js": "remote/marionette/addon.js",
"chrome://remote/content/marionette/atom.js": "remote/marionette/atom.js",
"chrome://remote/content/marionette/browser.js":
"remote/marionette/browser.js",
"chrome://remote/content/marionette/capture.js":
"remote/marionette/capture.js",
"chrome://remote/content/marionette/cert.js": "remote/marionette/cert.js",
"chrome://remote/content/marionette/cookie.js": "remote/marionette/cookie.js",
"chrome://remote/content/marionette/dom.js": "remote/marionette/dom.js",
"chrome://remote/content/marionette/driver.js": "remote/marionette/driver.js",
"chrome://remote/content/marionette/element.js":
"remote/marionette/element.js",
"chrome://remote/content/marionette/evaluate.js":
"remote/marionette/evaluate.js",
"chrome://remote/content/marionette/event.js": "remote/marionette/event.js",
"chrome://remote/content/marionette/interaction.js":
"remote/marionette/interaction.js",
"chrome://remote/content/marionette/l10n.js": "remote/marionette/l10n.js",
"chrome://remote/content/marionette/legacyaction.js":
"remote/marionette/legacyaction.js",
"chrome://remote/content/marionette/message.js":
"remote/marionette/message.js",
"chrome://remote/content/marionette/modal.js": "remote/marionette/modal.js",
"chrome://remote/content/marionette/navigate.js":
"remote/marionette/navigate.js",
"chrome://remote/content/marionette/packets.js":
"remote/marionette/packets.js",
"chrome://remote/content/marionette/permissions.js":
"remote/marionette/permissions.js",
"chrome://remote/content/marionette/prefs.js": "remote/marionette/prefs.js",
"chrome://remote/content/marionette/reftest.js":
"remote/marionette/reftest.js",
"chrome://remote/content/marionette/server.js": "remote/marionette/server.js",
"chrome://remote/content/marionette/stream-utils.js":
"remote/marionette/stream-utils.js",
"chrome://remote/content/marionette/sync.js": "remote/marionette/sync.js",
"chrome://remote/content/marionette/transport.js":
"remote/marionette/transport.js",
"chrome://remote/content/webdriver-bidi/NewSessionHandler.jsm":
"remote/webdriver-bidi/NewSessionHandler.jsm",
"chrome://remote/content/webdriver-bidi/RemoteValue.jsm":