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. # These are (mainly) imported code that we don't want to lint to make imports easier.
remote/cdp/Protocol.jsm remote/cdp/Protocol.jsm
remote/cdp/test/browser/chrome-remote-interface.js 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. # This file explicitly has a syntax error and cannot be parsed by eslint.
remote/shared/messagehandler/test/browser/resources/modules/root/invalid.sys.mjs 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", "resource://gre/actors/CookieBannerChild.jsm",
// Test related // Test related
"chrome://remote/content/marionette/actors/MarionetteEventsChild.jsm", "chrome://remote/content/marionette/actors/MarionetteEventsChild.sys.mjs",
"chrome://remote/content/shared/Log.sys.mjs", "chrome://remote/content/shared/Log.sys.mjs",
"resource://testing-common/BrowserTestUtilsChild.jsm", "resource://testing-common/BrowserTestUtilsChild.jsm",
"resource://testing-common/ContentEventListenerChild.jsm", "resource://testing-common/ContentEventListenerChild.jsm",

View file

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

View file

@ -368,7 +368,9 @@ if (!isDevtools) {
} }
if (AppConstants.MOZ_CODE_COVERAGE) { 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([ const gInterestingCategories = new Set([

View file

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

View file

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

View file

@ -13,11 +13,11 @@ Currently the following atoms are in use:
- `isDisplayed` - `isDisplayed`
To use one of those atoms Javascript modules will have to import 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 [Selenium atoms]: https://github.com/SeleniumHQ/selenium/tree/master/javascript/webdriver/atoms
[WebDriver specification]: https://w3c.github.io/webdriver/webdriver-spec.html [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 Update required Selenium atoms
@ -25,7 +25,7 @@ Update required Selenium atoms
In regular intervals the atoms, which are still in use, have to In regular intervals the atoms, which are still in use, have to
be updated. Therefore they have to be exported from the Selenium 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 ### 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. 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 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: 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. in the middle of the file.
3. Update the parameters of the wrapper function (at the very top) 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 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 ### 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, * 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/. */ * 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 = ["accessibility"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -33,7 +27,7 @@ XPCOMUtils.defineLazyGetter(lazy, "service", () => {
}); });
/** @namespace */ /** @namespace */
const accessibility = { export const accessibility = {
get service() { get service() {
return lazy.service; return lazy.service;
}, },

View file

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

View file

@ -4,38 +4,29 @@
/* eslint-disable no-restricted-globals */ /* eslint-disable no-restricted-globals */
"use strict"; import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const EXPORTED_SYMBOLS = ["MarionetteCommandsChild"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
ChromeUtils.defineESModuleGetters(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", 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", Log: "chrome://remote/content/shared/Log.sys.mjs",
}); sandbox: "chrome://remote/content/marionette/evaluate.sys.mjs",
Sandboxes: "chrome://remote/content/marionette/evaluate.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",
}); });
XPCOMUtils.defineLazyGetter(lazy, "logger", () => XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
lazy.Log.get(lazy.Log.TYPES.MARIONETTE) lazy.Log.get(lazy.Log.TYPES.MARIONETTE)
); );
class MarionetteCommandsChild extends JSWindowActorChild { export class MarionetteCommandsChild extends JSWindowActorChild {
constructor() { constructor() {
super(); super();

View file

@ -2,33 +2,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
("use strict"); import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const EXPORTED_SYMBOLS = [
"clearElementIdCache",
"getMarionetteCommandsActorProxy",
"MarionetteCommandsParent",
"registerCommandsActor",
"unregisterCommandsActor",
];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
ChromeUtils.defineESModuleGetters(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", 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", 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", () => XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
lazy.Log.get(lazy.Log.TYPES.MARIONETTE) lazy.Log.get(lazy.Log.TYPES.MARIONETTE)
); );
@ -36,7 +21,7 @@ XPCOMUtils.defineLazyGetter(lazy, "elementIdCache", () => {
return new lazy.element.ReferenceStore(); return new lazy.element.ReferenceStore();
}); });
class MarionetteCommandsParent extends JSWindowActorParent { export class MarionetteCommandsParent extends JSWindowActorParent {
actorCreated() { actorCreated() {
this._resolveDialogOpened = null; this._resolveDialogOpened = null;
@ -286,7 +271,7 @@ class MarionetteCommandsParent extends JSWindowActorParent {
/** /**
* Clear all the entries from the element id cache. * Clear all the entries from the element id cache.
*/ */
function clearElementIdCache() { export function clearElementIdCache() {
lazy.elementIdCache.clear(); lazy.elementIdCache.clear();
} }
@ -303,7 +288,7 @@ function _onTabClose(event) {
* A function that returns the reference to the browsing context for which * A function that returns the reference to the browsing context for which
* the query should run. * the query should run.
*/ */
function getMarionetteCommandsActorProxy(browsingContextFn) { export function getMarionetteCommandsActorProxy(browsingContextFn) {
const MAX_ATTEMPTS = 10; const MAX_ATTEMPTS = 10;
/** /**
@ -382,17 +367,17 @@ function getMarionetteCommandsActorProxy(browsingContextFn) {
/** /**
* Register the MarionetteCommands actor that holds all the commands. * Register the MarionetteCommands actor that holds all the commands.
*/ */
function registerCommandsActor() { export function registerCommandsActor() {
try { try {
ChromeUtils.registerWindowActor("MarionetteCommands", { ChromeUtils.registerWindowActor("MarionetteCommands", {
kind: "JSWindowActor", kind: "JSWindowActor",
parent: { parent: {
moduleURI: esModuleURI:
"chrome://remote/content/marionette/actors/MarionetteCommandsParent.jsm", "chrome://remote/content/marionette/actors/MarionetteCommandsParent.sys.mjs",
}, },
child: { child: {
moduleURI: esModuleURI:
"chrome://remote/content/marionette/actors/MarionetteCommandsChild.jsm", "chrome://remote/content/marionette/actors/MarionetteCommandsChild.sys.mjs",
}, },
allFrames: true, allFrames: true,
@ -407,6 +392,6 @@ function registerCommandsActor() {
} }
} }
function unregisterCommandsActor() { export function unregisterCommandsActor() {
ChromeUtils.unregisterWindowActor("MarionetteCommands"); ChromeUtils.unregisterWindowActor("MarionetteCommands");
} }

View file

@ -4,29 +4,20 @@
/* eslint-disable no-restricted-globals */ /* eslint-disable no-restricted-globals */
"use strict"; import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const EXPORTED_SYMBOLS = ["MarionetteEventsChild"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
event: "chrome://remote/content/marionette/event.sys.mjs",
Log: "chrome://remote/content/shared/Log.sys.mjs", Log: "chrome://remote/content/shared/Log.sys.mjs",
}); });
XPCOMUtils.defineLazyModuleGetters(lazy, {
event: "chrome://remote/content/marionette/event.js",
});
XPCOMUtils.defineLazyGetter(lazy, "logger", () => XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
lazy.Log.get(lazy.Log.TYPES.MARIONETTE) lazy.Log.get(lazy.Log.TYPES.MARIONETTE)
); );
class MarionetteEventsChild extends JSWindowActorChild { export class MarionetteEventsChild extends JSWindowActorChild {
get innerWindowId() { get innerWindowId() {
return this.manager.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 * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
("use strict"); import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const EXPORTED_SYMBOLS = [
"disableEventsActor",
"enableEventsActor",
"EventDispatcher",
"MarionetteEventsParent",
];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -30,14 +19,15 @@ XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
); );
// Singleton to allow forwarding events to registered listeners. // Singleton to allow forwarding events to registered listeners.
const EventDispatcher = { export const EventDispatcher = {
init() { init() {
lazy.EventEmitter.decorate(this); lazy.EventEmitter.decorate(this);
}, },
}; };
EventDispatcher.init(); EventDispatcher.init();
class MarionetteEventsParent extends JSWindowActorParent { export class MarionetteEventsParent extends JSWindowActorParent {
async receiveMessage(msg) { async receiveMessage(msg) {
const { name, data } = msg; const { name, data } = msg;
@ -68,12 +58,12 @@ function registerEventsActor() {
ChromeUtils.registerWindowActor("MarionetteEvents", { ChromeUtils.registerWindowActor("MarionetteEvents", {
kind: "JSWindowActor", kind: "JSWindowActor",
parent: { parent: {
moduleURI: esModuleURI:
"chrome://remote/content/marionette/actors/MarionetteEventsParent.jsm", "chrome://remote/content/marionette/actors/MarionetteEventsParent.sys.mjs",
}, },
child: { child: {
moduleURI: esModuleURI:
"chrome://remote/content/marionette/actors/MarionetteEventsChild.jsm", "chrome://remote/content/marionette/actors/MarionetteEventsChild.sys.mjs",
events: { events: {
beforeunload: { capture: true }, beforeunload: { capture: true },
DOMContentLoaded: { mozSystemGroup: true }, DOMContentLoaded: { mozSystemGroup: true },
@ -107,7 +97,7 @@ function registerEventsActor() {
* Enable MarionetteEvents actors to start forwarding page load events from the * Enable MarionetteEvents actors to start forwarding page load events from the
* child actor to the parent actor. Register the MarionetteEvents actor if necessary. * 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 // sharedData is replicated across processes and will be checked by
// MarionetteEventsChild before forward events to the parent actor. // MarionetteEventsChild before forward events to the parent actor.
Services.ppmm.sharedData.set("MARIONETTE_EVENTS_ENABLED", true); 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 * Disable MarionetteEvents actors to stop forwarding page load events from the
* child actor to the parent actor. * child actor to the parent actor.
*/ */
function disableEventsActor() { export function disableEventsActor() {
Services.ppmm.sharedData.set("MARIONETTE_EVENTS_ENABLED", false); Services.ppmm.sharedData.set("MARIONETTE_EVENTS_ENABLED", false);
Services.ppmm.sharedData.flush(); 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 * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict"; import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const EXPORTED_SYMBOLS = ["MarionetteReftestChild"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -23,7 +17,7 @@ XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
/** /**
* Child JSWindowActor to handle navigation for reftests relying on marionette. * Child JSWindowActor to handle navigation for reftests relying on marionette.
*/ */
class MarionetteReftestChild extends JSWindowActorChild { export class MarionetteReftestChild extends JSWindowActorChild {
constructor() { constructor() {
super(); super();

View file

@ -2,14 +2,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
("use strict");
const EXPORTED_SYMBOLS = ["MarionetteReftestParent"];
/** /**
* Parent JSWindowActor to handle navigation for reftests relying on marionette. * 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. * 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, * 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/. */ * 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 = ["Addon"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -46,7 +40,7 @@ async function installAddon(file) {
} }
/** Installs addons by path and uninstalls by ID. */ /** Installs addons by path and uninstalls by ID. */
class Addon { export class Addon {
/** /**
* Install a Firefox addon. * Install a Firefox addon.
* *

View file

@ -12,10 +12,8 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
const EXPORTED_SYMBOLS = ["atom"];
/** @namespace */ /** @namespace */
this.atom = {}; export const atom = {};
// https://github.com/SeleniumHQ/selenium/blob/master/javascript/atoms/dom.js#L979 // 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]={}} 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, * 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/. */ * 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 = {}; const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
AppInfo: "chrome://remote/content/shared/AppInfo.sys.mjs", AppInfo: "chrome://remote/content/shared/AppInfo.sys.mjs",
error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs", error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs",
EventPromise: "chrome://remote/content/shared/Sync.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", TabManager: "chrome://remote/content/shared/TabManager.sys.mjs",
WebElementEventTarget: "chrome://remote/content/marionette/dom.sys.mjs",
windowManager: "chrome://remote/content/shared/WindowManager.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 */ /** @namespace */
const browser = {}; export const browser = {};
/** /**
* Variations of Marionette contexts. * Variations of Marionette contexts.
@ -37,7 +27,7 @@ const browser = {};
* *
* @class Marionette.Context * @class Marionette.Context
*/ */
class Context { export class Context {
/** /**
* Gets the correct context from a string. * Gets the correct context from a string.
* *
@ -63,6 +53,7 @@ class Context {
} }
} }
} }
Context.Chrome = "chrome"; Context.Chrome = "chrome";
Context.Content = "content"; Context.Content = "content";
@ -351,7 +342,7 @@ browser.Context = class {
* *
* @enum {string} * @enum {string}
*/ */
const WindowState = { export const WindowState = {
Maximized: "maximized", Maximized: "maximized",
Minimized: "minimized", Minimized: "minimized",
Normal: "normal", Normal: "normal",

View file

@ -2,13 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file, * 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/. */ * 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 = ["capture"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -32,7 +26,7 @@ const XHTML_NS = "http://www.w3.org/1999/xhtml";
* *
* @namespace * @namespace
*/ */
const capture = {}; export const capture = {};
capture.Format = { capture.Format = {
Base64: 0, Base64: 0,

View file

@ -2,13 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file, * 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/. */ * 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 = ["allowAllCerts"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -34,7 +28,7 @@ const CERT_PINNING_ENFORCEMENT_PREF = "security.cert_pinning.enforcement_level";
const HSTS_PRELOAD_LIST_PREF = "network.stricttransportsecurity.preloadlist"; const HSTS_PRELOAD_LIST_PREF = "network.stricttransportsecurity.preloadlist";
/** @namespace */ /** @namespace */
const allowAllCerts = {}; export const allowAllCerts = {};
/** /**
* Disable all security check and allow all certs. * 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, * 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/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const EXPORTED_SYMBOLS = ["cookie"];
const lazy = {}; const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
@ -23,7 +19,7 @@ const SAMESITE_MAP = new Map([
]); ]);
/** @namespace */ /** @namespace */
const cookie = { export const cookie = {
manager: Services.cookies, 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, * 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/. */ * 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 = [
"ContentEventObserverService",
"WebElementEventTarget",
];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -41,7 +32,7 @@ XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
* chromeWindow.minimize(); * chromeWindow.minimize();
* }); * });
*/ */
class WebElementEventTarget { export class WebElementEventTarget {
/** /**
* @param {function(): nsIMessageListenerManager} messageManagerFn * @param {function(): nsIMessageListenerManager} messageManagerFn
* Message manager to the current browser. * Message manager to the current browser.
@ -149,7 +140,7 @@ class WebElementEventTarget {
* to cease listening for, and despatches IPC messages to the browser * to cease listening for, and despatches IPC messages to the browser
* when they fire. * when they fire.
*/ */
class ContentEventObserverService { export class ContentEventObserverService {
/** /**
* @param {WindowProxy} windowGlobal * @param {WindowProxy} windowGlobal
* Window. * Window.

View file

@ -2,71 +2,62 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file, * 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/. */ * 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"]; import {
element,
const { XPCOMUtils } = ChromeUtils.importESModule( WebReference,
"resource://gre/modules/XPCOMUtils.sys.mjs" } from "chrome://remote/content/marionette/element.sys.mjs";
);
const { element } = ChromeUtils.import(
"chrome://remote/content/marionette/element.js"
);
const lazy = {}; const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
Addon: "chrome://remote/content/marionette/addon.sys.mjs",
AppInfo: "chrome://remote/content/shared/AppInfo.sys.mjs", AppInfo: "chrome://remote/content/shared/AppInfo.sys.mjs",
assert: "chrome://remote/content/shared/webdriver/Assert.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", error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs",
EventPromise: "chrome://remote/content/shared/Sync.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", Log: "chrome://remote/content/shared/Log.sys.mjs",
Marionette: "chrome://remote/content/components/Marionette.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", pprint: "chrome://remote/content/shared/Format.sys.mjs",
print: "chrome://remote/content/shared/PDF.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", RemoteAgent: "chrome://remote/content/components/RemoteAgent.sys.mjs",
TabManager: "chrome://remote/content/shared/TabManager.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", Timeouts: "chrome://remote/content/shared/webdriver/Capabilities.sys.mjs",
UnhandledPromptBehavior: UnhandledPromptBehavior:
"chrome://remote/content/shared/webdriver/Capabilities.sys.mjs", "chrome://remote/content/shared/webdriver/Capabilities.sys.mjs",
unregisterCommandsActor:
"chrome://remote/content/marionette/actors/MarionetteCommandsParent.sys.mjs",
waitForInitialNavigationCompleted: waitForInitialNavigationCompleted:
"chrome://remote/content/shared/Navigate.sys.mjs", "chrome://remote/content/shared/Navigate.sys.mjs",
waitForObserverTopic: "chrome://remote/content/marionette/sync.sys.mjs",
WebDriverSession: "chrome://remote/content/shared/webdriver/Session.sys.mjs", WebDriverSession: "chrome://remote/content/shared/webdriver/Session.sys.mjs",
windowManager: "chrome://remote/content/shared/WindowManager.sys.mjs", windowManager: "chrome://remote/content/shared/WindowManager.sys.mjs",
}); WindowState: "chrome://remote/content/marionette/browser.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",
}); });
XPCOMUtils.defineLazyGetter(lazy, "logger", () => XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
@ -114,7 +105,7 @@ const TOPIC_BROWSER_READY = "browser-delayed-startup-finished";
* @param {MarionetteServer} server * @param {MarionetteServer} server
* The instance of Marionette server. * The instance of Marionette server.
*/ */
function GeckoDriver(server) { export function GeckoDriver(server) {
this._server = server; this._server = server;
// WebDriver Session // WebDriver Session
@ -1360,9 +1351,9 @@ GeckoDriver.prototype.switchToFrame = async function(cmd) {
// Bug 1495063: Elements should be passed as WebReference reference // Bug 1495063: Elements should be passed as WebReference reference
let byFrame; let byFrame;
if (typeof el == "string") { if (typeof el == "string") {
byFrame = lazy.WebReference.fromUUID(el); byFrame = WebReference.fromUUID(el);
} else if (el) { } else if (el) {
byFrame = lazy.WebReference.fromJSON(el); byFrame = WebReference.fromJSON(el);
} }
const { browsingContext } = await this.getActor({ top }).switchToFrame( const { browsingContext } = await this.getActor({ top }).switchToFrame(
@ -1402,7 +1393,7 @@ GeckoDriver.prototype.singleTap = async function(cmd) {
lazy.assert.open(this.getBrowsingContext()); lazy.assert.open(this.getBrowsingContext());
let { id, x, y } = cmd.parameters; let { id, x, y } = cmd.parameters;
let webEl = lazy.WebReference.fromUUID(id); let webEl = WebReference.fromUUID(id);
await this.getActor().singleTap( await this.getActor().singleTap(
webEl, webEl,
@ -1491,7 +1482,7 @@ GeckoDriver.prototype.findElement = async function(cmd) {
let startNode; let startNode;
if (typeof el != "undefined") { if (typeof el != "undefined") {
startNode = lazy.WebReference.fromUUID(el); startNode = WebReference.fromUUID(el);
} }
let opts = { let opts = {
@ -1536,7 +1527,7 @@ GeckoDriver.prototype.findElements = async function(cmd) {
let startNode; let startNode;
if (typeof el != "undefined") { if (typeof el != "undefined") {
startNode = lazy.WebReference.fromUUID(el); startNode = WebReference.fromUUID(el);
} }
let opts = { let opts = {
@ -1581,7 +1572,7 @@ GeckoDriver.prototype.getShadowRoot = async function(cmd) {
cmd.parameters.id, cmd.parameters.id,
lazy.pprint`Expected "id" to be a string, got ${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); return this.getActor().getShadowRoot(webEl);
}; };
@ -1633,7 +1624,7 @@ GeckoDriver.prototype.clickElement = async function(cmd) {
await this._handleUserPrompts(); await this._handleUserPrompts();
let id = lazy.assert.string(cmd.parameters.id); let id = lazy.assert.string(cmd.parameters.id);
let webEl = lazy.WebReference.fromUUID(id); let webEl = WebReference.fromUUID(id);
const actor = this.getActor(); const actor = this.getActor();
@ -1684,7 +1675,7 @@ GeckoDriver.prototype.getElementAttribute = async function(cmd) {
const id = lazy.assert.string(cmd.parameters.id); const id = lazy.assert.string(cmd.parameters.id);
const name = lazy.assert.string(cmd.parameters.name); 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); 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 id = lazy.assert.string(cmd.parameters.id);
const name = lazy.assert.string(cmd.parameters.name); 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); return this.getActor().getElementProperty(webEl, name);
}; };
@ -1748,7 +1739,7 @@ GeckoDriver.prototype.getElementText = async function(cmd) {
await this._handleUserPrompts(); await this._handleUserPrompts();
let id = lazy.assert.string(cmd.parameters.id); let id = lazy.assert.string(cmd.parameters.id);
let webEl = lazy.WebReference.fromUUID(id); let webEl = WebReference.fromUUID(id);
return this.getActor().getElementText(webEl); return this.getActor().getElementText(webEl);
}; };
@ -1778,7 +1769,7 @@ GeckoDriver.prototype.getElementTagName = async function(cmd) {
await this._handleUserPrompts(); await this._handleUserPrompts();
let id = lazy.assert.string(cmd.parameters.id); let id = lazy.assert.string(cmd.parameters.id);
let webEl = lazy.WebReference.fromUUID(id); let webEl = WebReference.fromUUID(id);
return this.getActor().getElementTagName(webEl); return this.getActor().getElementTagName(webEl);
}; };
@ -1806,7 +1797,7 @@ GeckoDriver.prototype.isElementDisplayed = async function(cmd) {
await this._handleUserPrompts(); await this._handleUserPrompts();
let id = lazy.assert.string(cmd.parameters.id); let id = lazy.assert.string(cmd.parameters.id);
let webEl = lazy.WebReference.fromUUID(id); let webEl = WebReference.fromUUID(id);
return this.getActor().isElementDisplayed( return this.getActor().isElementDisplayed(
webEl, webEl,
@ -1842,7 +1833,7 @@ GeckoDriver.prototype.getElementValueOfCssProperty = async function(cmd) {
let id = lazy.assert.string(cmd.parameters.id); let id = lazy.assert.string(cmd.parameters.id);
let prop = lazy.assert.string(cmd.parameters.propertyName); 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); return this.getActor().getElementValueOfCssProperty(webEl, prop);
}; };
@ -1872,7 +1863,7 @@ GeckoDriver.prototype.isElementEnabled = async function(cmd) {
await this._handleUserPrompts(); await this._handleUserPrompts();
let id = lazy.assert.string(cmd.parameters.id); let id = lazy.assert.string(cmd.parameters.id);
let webEl = lazy.WebReference.fromUUID(id); let webEl = WebReference.fromUUID(id);
return this.getActor().isElementEnabled( return this.getActor().isElementEnabled(
webEl, webEl,
@ -1903,7 +1894,7 @@ GeckoDriver.prototype.isElementSelected = async function(cmd) {
await this._handleUserPrompts(); await this._handleUserPrompts();
let id = lazy.assert.string(cmd.parameters.id); let id = lazy.assert.string(cmd.parameters.id);
let webEl = lazy.WebReference.fromUUID(id); let webEl = WebReference.fromUUID(id);
return this.getActor().isElementSelected( return this.getActor().isElementSelected(
webEl, webEl,
@ -1928,7 +1919,7 @@ GeckoDriver.prototype.getElementRect = async function(cmd) {
await this._handleUserPrompts(); await this._handleUserPrompts();
let id = lazy.assert.string(cmd.parameters.id); let id = lazy.assert.string(cmd.parameters.id);
let webEl = lazy.WebReference.fromUUID(id); let webEl = WebReference.fromUUID(id);
return this.getActor().getElementRect(webEl); return this.getActor().getElementRect(webEl);
}; };
@ -1958,7 +1949,7 @@ GeckoDriver.prototype.sendKeysToElement = async function(cmd) {
let id = lazy.assert.string(cmd.parameters.id); let id = lazy.assert.string(cmd.parameters.id);
let text = lazy.assert.string(cmd.parameters.text); let text = lazy.assert.string(cmd.parameters.text);
let webEl = lazy.WebReference.fromUUID(id); let webEl = WebReference.fromUUID(id);
return this.getActor().sendKeysToElement( return this.getActor().sendKeysToElement(
webEl, webEl,
@ -1989,7 +1980,7 @@ GeckoDriver.prototype.clearElement = async function(cmd) {
await this._handleUserPrompts(); await this._handleUserPrompts();
let id = lazy.assert.string(cmd.parameters.id); let id = lazy.assert.string(cmd.parameters.id);
let webEl = lazy.WebReference.fromUUID(id); let webEl = WebReference.fromUUID(id);
await this.getActor().clearElement(webEl); await this.getActor().clearElement(webEl);
}; };
@ -2344,7 +2335,7 @@ GeckoDriver.prototype.takeScreenshot = async function(cmd) {
full = typeof full == "undefined" ? true : full; full = typeof full == "undefined" ? true : full;
scroll = typeof scroll == "undefined" ? true : scroll; 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 // Only consider full screenshot if no element has been specified
full = webEl ? false : full; 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, * 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/. */ * 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 = [
"element",
"ShadowRoot",
"WebElement",
"WebFrame",
"WebReference",
"WebWindow",
];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
assert: "chrome://remote/content/shared/webdriver/Assert.sys.mjs", 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", 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", pprint: "chrome://remote/content/shared/Format.sys.mjs",
}); });
XPCOMUtils.defineLazyModuleGetters(lazy, { XPCOMUtils.defineLazyModuleGetters(lazy, {
ContentDOMReference: "resource://gre/modules/ContentDOMReference.jsm", 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; const ORDERED_NODE_ITERATOR_TYPE = 5;
@ -72,7 +58,7 @@ const XUL_SELECTED_ELS = new Set([
* *
* @namespace * @namespace
*/ */
const element = {}; export const element = {};
element.Strategy = { element.Strategy = {
ClassName: "class name", ClassName: "class name",
@ -1449,7 +1435,7 @@ element.isBooleanAttribute = function(el, attr) {
* In Marionette this abstraction can represent DOM elements, * In Marionette this abstraction can represent DOM elements,
* WindowProxies, and XUL elements. * WindowProxies, and XUL elements.
*/ */
class WebReference { export class WebReference {
/** /**
* @param {string} uuid * @param {string} uuid
* Identifier that must be unique across all browsing contexts * 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 * DOM elements are represented as web elements when they are
* transported over the wire protocol. * transported over the wire protocol.
*/ */
class WebElement extends WebReference { export class WebElement extends WebReference {
toJSON() { toJSON() {
return { [WebElement.Identifier]: this.uuid }; return { [WebElement.Identifier]: this.uuid };
} }
@ -1638,13 +1624,14 @@ class WebElement extends WebReference {
return new WebElement(uuid); return new WebElement(uuid);
} }
} }
WebElement.Identifier = "element-6066-11e4-a52e-4f735466cecf"; WebElement.Identifier = "element-6066-11e4-a52e-4f735466cecf";
/** /**
* Shadow Root elements are represented as shadow root references when they are * Shadow Root elements are represented as shadow root references when they are
* transported over the wire protocol * transported over the wire protocol
*/ */
class ShadowRoot extends WebReference { export class ShadowRoot extends WebReference {
toJSON() { toJSON() {
return { [ShadowRoot.Identifier]: this.uuid }; return { [ShadowRoot.Identifier]: this.uuid };
} }
@ -1662,6 +1649,7 @@ class ShadowRoot extends WebReference {
return new ShadowRoot(uuid); return new ShadowRoot(uuid);
} }
} }
ShadowRoot.Identifier = "shadow-6066-11e4-a52e-4f735466cecf"; 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 * whose <code>opener</code> is null, are represented as web windows
* over the wire protocol. * over the wire protocol.
*/ */
class WebWindow extends WebReference { export class WebWindow extends WebReference {
toJSON() { toJSON() {
return { [WebWindow.Identifier]: this.uuid }; return { [WebWindow.Identifier]: this.uuid };
} }
@ -1684,6 +1672,7 @@ class WebWindow extends WebReference {
return new WebWindow(uuid); return new WebWindow(uuid);
} }
} }
WebWindow.Identifier = "window-fcc6-11e5-b4f8-330a88ab9d7f"; 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>, * associated with <tt>&lt;frame&gt;</tt> and <tt>&lt;iframe&gt;</tt>,
* are represented as web frames over the wire protocol. * are represented as web frames over the wire protocol.
*/ */
class WebFrame extends WebReference { export class WebFrame extends WebReference {
toJSON() { toJSON() {
return { [WebFrame.Identifier]: this.uuid }; return { [WebFrame.Identifier]: this.uuid };
} }
@ -1706,4 +1695,5 @@ class WebFrame extends WebReference {
return new WebFrame(uuid); return new WebFrame(uuid);
} }
} }
WebFrame.Identifier = "frame-075b-4da1-b6ba-e579c2d3230a"; 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, * 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/. */ * 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 = ["evaluate", "sandbox", "Sandboxes"];
const { clearTimeout, setTimeout } = ChromeUtils.import( const { clearTimeout, setTimeout } = ChromeUtils.import(
"resource://gre/modules/Timer.jsm" "resource://gre/modules/Timer.jsm"
); );
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
element: "chrome://remote/content/marionette/element.sys.mjs",
error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs", error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs",
Log: "chrome://remote/content/shared/Log.sys.mjs", Log: "chrome://remote/content/shared/Log.sys.mjs",
}); WebReference: "chrome://remote/content/marionette/element.sys.mjs",
XPCOMUtils.defineLazyModuleGetters(lazy, {
element: "chrome://remote/content/marionette/element.js",
WebReference: "chrome://remote/content/marionette/element.js",
}); });
XPCOMUtils.defineLazyGetter(lazy, "logger", () => XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
@ -36,7 +28,7 @@ const DEFAULT_TIMEOUT = 10000; // ms
const FINISH = "finish"; const FINISH = "finish";
/** @namespace */ /** @namespace */
const evaluate = {}; export const evaluate = {};
/** /**
* Asserts that an arbitrary object is not cyclic. * Asserts that an arbitrary object is not cyclic.
@ -476,7 +468,7 @@ evaluate.isDead = function(obj, prop) {
return false; return false;
}; };
const sandbox = {}; export const sandbox = {};
/** /**
* Provides a safe way to take an object defined in a privileged scope and * 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 * @memberof evaluate
*/ */
class Sandboxes { export class Sandboxes {
/** /**
* @param {function(): Window} windowFn * @param {function(): Window} windowFn
* A function that returns the references to the current Window * 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 * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/* eslint-disable no-restricted-globals */ /* eslint-disable no-restricted-globals */
const EXPORTED_SYMBOLS = ["event"]; import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -18,7 +13,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
}); });
/** Provides functionality for creating and sending DOM events. */ /** Provides functionality for creating and sending DOM events. */
const event = {}; export const event = {};
XPCOMUtils.defineLazyGetter(lazy, "dblclickTimer", () => { XPCOMUtils.defineLazyGetter(lazy, "dblclickTimer", () => {
return Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); return Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);

View file

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

View file

@ -4,41 +4,41 @@
remote.jar: remote.jar:
% content remote %content/ % content remote %content/
content/marionette/accessibility.js (accessibility.js) content/marionette/accessibility.sys.mjs (accessibility.sys.mjs)
content/marionette/action.js (action.js) content/marionette/action.sys.mjs (action.sys.mjs)
content/marionette/actors/MarionetteCommandsChild.jsm (actors/MarionetteCommandsChild.jsm) content/marionette/actors/MarionetteCommandsChild.sys.mjs (actors/MarionetteCommandsChild.sys.mjs)
content/marionette/actors/MarionetteCommandsParent.jsm (actors/MarionetteCommandsParent.jsm) content/marionette/actors/MarionetteCommandsParent.sys.mjs (actors/MarionetteCommandsParent.sys.mjs)
content/marionette/actors/MarionetteEventsChild.jsm (actors/MarionetteEventsChild.jsm) content/marionette/actors/MarionetteEventsChild.sys.mjs (actors/MarionetteEventsChild.sys.mjs)
content/marionette/actors/MarionetteEventsParent.jsm (actors/MarionetteEventsParent.jsm) content/marionette/actors/MarionetteEventsParent.sys.mjs (actors/MarionetteEventsParent.sys.mjs)
content/marionette/actors/MarionetteReftestChild.jsm (actors/MarionetteReftestChild.jsm) content/marionette/actors/MarionetteReftestChild.sys.mjs (actors/MarionetteReftestChild.sys.mjs)
content/marionette/actors/MarionetteReftestParent.jsm (actors/MarionetteReftestParent.jsm) content/marionette/actors/MarionetteReftestParent.sys.mjs (actors/MarionetteReftestParent.sys.mjs)
content/marionette/addon.js (addon.js) content/marionette/addon.sys.mjs (addon.sys.mjs)
content/marionette/atom.js (atom.js) content/marionette/atom.sys.mjs (atom.sys.mjs)
content/marionette/browser.js (browser.js) content/marionette/browser.sys.mjs (browser.sys.mjs)
content/marionette/capture.js (capture.js) content/marionette/capture.sys.mjs (capture.sys.mjs)
content/marionette/cert.js (cert.js) content/marionette/cert.sys.mjs (cert.sys.mjs)
content/marionette/cookie.js (cookie.js) content/marionette/cookie.sys.mjs (cookie.sys.mjs)
content/marionette/dom.js (dom.js) content/marionette/dom.sys.mjs (dom.sys.mjs)
content/marionette/driver.js (driver.js) content/marionette/driver.sys.mjs (driver.sys.mjs)
content/marionette/element.js (element.js) content/marionette/element.sys.mjs (element.sys.mjs)
content/marionette/evaluate.js (evaluate.js) content/marionette/evaluate.sys.mjs (evaluate.sys.mjs)
content/marionette/event.js (event.js) content/marionette/event.sys.mjs (event.sys.mjs)
content/marionette/interaction.js (interaction.js) content/marionette/interaction.sys.mjs (interaction.sys.mjs)
content/marionette/l10n.js (l10n.js) content/marionette/l10n.sys.mjs (l10n.sys.mjs)
content/marionette/legacyaction.js (legacyaction.js) content/marionette/legacyaction.sys.mjs (legacyaction.sys.mjs)
content/marionette/message.js (message.js) content/marionette/message.sys.mjs (message.sys.mjs)
content/marionette/modal.js (modal.js) content/marionette/modal.sys.mjs (modal.sys.mjs)
content/marionette/navigate.js (navigate.js) content/marionette/navigate.sys.mjs (navigate.sys.mjs)
content/marionette/packets.js (packets.js) content/marionette/packets.sys.mjs (packets.sys.mjs)
content/marionette/permissions.js (permissions.js) content/marionette/permissions.sys.mjs (permissions.sys.mjs)
content/marionette/prefs.js (prefs.js) content/marionette/prefs.sys.mjs (prefs.sys.mjs)
content/marionette/reftest.js (reftest.js) content/marionette/reftest.sys.mjs (reftest.sys.mjs)
content/marionette/reftest.xhtml (chrome/reftest.xhtml) content/marionette/reftest.xhtml (chrome/reftest.xhtml)
content/marionette/reftest-content.js (reftest-content.js) content/marionette/reftest-content.js (reftest-content.js)
content/marionette/server.js (server.js) content/marionette/server.sys.mjs (server.sys.mjs)
content/marionette/stream-utils.js (stream-utils.js) content/marionette/stream-utils.sys.mjs (stream-utils.sys.mjs)
content/marionette/sync.js (sync.js) content/marionette/sync.sys.mjs (sync.sys.mjs)
content/marionette/transport.js (transport.js) content/marionette/transport.sys.mjs (transport.sys.mjs)
#ifdef ENABLE_TESTS #ifdef ENABLE_TESTS
content/marionette/test_dialog.dtd (chrome/test_dialog.dtd) content/marionette/test_dialog.dtd (chrome/test_dialog.dtd)
content/marionette/test_dialog.properties (chrome/test_dialog.properties) 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, * 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/. */ * 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. * An API which allows Marionette to handle localized content.
* *
@ -17,9 +13,7 @@ const EXPORTED_SYMBOLS = ["l10n"];
* content retrieved. * content retrieved.
*/ */
const { XPCOMUtils } = ChromeUtils.importESModule( import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -34,7 +28,7 @@ XPCOMUtils.defineLazyGetter(lazy, "domParser", () => {
}); });
/** @namespace */ /** @namespace */
const l10n = {}; export const l10n = {};
/** /**
* Retrieve the localized string for the specified entity id. * Retrieve the localized string for the specified entity id.

View file

@ -4,29 +4,22 @@
/* eslint-disable no-restricted-globals */ /* eslint-disable no-restricted-globals */
"use strict"; import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const EXPORTED_SYMBOLS = ["legacyaction"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
ChromeUtils.defineESModuleGetters(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", 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", Log: "chrome://remote/content/shared/Log.sys.mjs",
WebReference: "chrome://remote/content/marionette/element.sys.mjs",
}); });
XPCOMUtils.defineLazyModuleGetters(lazy, { XPCOMUtils.defineLazyModuleGetters(lazy, {
Preferences: "resource://gre/modules/Preferences.jsm", 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", () => 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 const DEFAULT_CONTEXT_MENU_DELAY = 750; // ms
/** @namespace */ /** @namespace */
const legacyaction = {}; export const legacyaction = {};
const action = 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, * 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/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const EXPORTED_SYMBOLS = ["Command", "Message", "Response"];
const lazy = {}; const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
@ -15,7 +11,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
}); });
/** Representation of the packets transproted over the wire. */ /** Representation of the packets transproted over the wire. */
class Message { export class Message {
/** /**
* @param {number} messageID * @param {number} messageID
* Message ID unique identifying this message. * Message ID unique identifying this message.
@ -135,7 +131,7 @@ Message.Origin = {
* @param {Object.<string, ?>} params * @param {Object.<string, ?>} params
* Command parameters. * Command parameters.
*/ */
class Command extends Message { export class Command extends Message {
constructor(messageID, name, params = {}) { constructor(messageID, name, params = {}) {
super(messageID); super(messageID);
@ -200,6 +196,7 @@ class Command extends Message {
return new Command(msgID, name, params); return new Command(msgID, name, params);
} }
} }
Command.Type = 0; Command.Type = 0;
/** /**
@ -229,7 +226,7 @@ Command.Type = 0;
* @param {ResponseHandler} respHandler * @param {ResponseHandler} respHandler
* Function callback called on sending the response. * Function callback called on sending the response.
*/ */
class Response extends Message { export class Response extends Message {
constructor(messageID, respHandler = () => {}) { constructor(messageID, respHandler = () => {}) {
super(messageID); super(messageID);
@ -328,4 +325,5 @@ class Response extends Message {
return resp; return resp;
} }
} }
Response.Type = 1; 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, * 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/. */ * 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 = ["modal"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -24,7 +18,7 @@ XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
const COMMON_DIALOG = "chrome://global/content/commonDialog.xhtml"; const COMMON_DIALOG = "chrome://global/content/commonDialog.xhtml";
/** @namespace */ /** @namespace */
const modal = { export const modal = {
ACTION_CLOSED: "closed", ACTION_CLOSED: "closed",
ACTION_OPENED: "opened", 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, * 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/. */ * 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 = ["navigate"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs", error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs",
EventDispatcher:
"chrome://remote/content/marionette/actors/MarionetteEventsParent.sys.mjs",
Log: "chrome://remote/content/shared/Log.sys.mjs", Log: "chrome://remote/content/shared/Log.sys.mjs",
modal: "chrome://remote/content/marionette/modal.sys.mjs",
PageLoadStrategy: PageLoadStrategy:
"chrome://remote/content/shared/webdriver/Capabilities.sys.mjs", "chrome://remote/content/shared/webdriver/Capabilities.sys.mjs",
ProgressListener: "chrome://remote/content/shared/Navigate.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", 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", () => XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
lazy.Log.get(lazy.Log.TYPES.MARIONETTE) lazy.Log.get(lazy.Log.TYPES.MARIONETTE)
); );
@ -37,7 +28,7 @@ const TIMEOUT_BEFOREUNLOAD_EVENT = 200;
const TIMEOUT_UNLOAD_EVENT = 5000; const TIMEOUT_UNLOAD_EVENT = 5000;
/** @namespace */ /** @namespace */
const navigate = {}; export const navigate = {};
/** /**
* Checks the value of readyState for the current page * 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 * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict"; import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const EXPORTED_SYMBOLS = ["RawPacket", "Packet", "JSONPacket", "BulkPacket"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
XPCOMUtils.defineLazyModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
StreamUtils: "chrome://remote/content/marionette/stream-utils.js", StreamUtils: "chrome://remote/content/marionette/stream-utils.sys.mjs",
}); });
XPCOMUtils.defineLazyGetter(lazy, "unicodeConverter", () => { XPCOMUtils.defineLazyGetter(lazy, "unicodeConverter", () => {
@ -65,7 +59,7 @@ const PACKET_LENGTH_MAX = Math.pow(2, 40);
* *
* @class * @class
*/ */
function Packet(transport) { export function Packet(transport) {
this._transport = transport; this._transport = transport;
this._length = 0; this._length = 0;
} }
@ -122,7 +116,7 @@ Packet.prototype = {
* @param {DebuggerTransport} transport * @param {DebuggerTransport} transport
* Transport instance that will own the packet. * Transport instance that will own the packet.
*/ */
function JSONPacket(transport) { export function JSONPacket(transport) {
Packet.call(this, transport); Packet.call(this, transport);
this._data = ""; this._data = "";
this._done = false; this._done = false;
@ -251,7 +245,7 @@ JSONPacket.prototype.toString = function() {
* @param {DebuggerTransport} transport * @param {DebuggerTransport} transport
* Transport instance that will own the packet. * Transport instance that will own the packet.
*/ */
function BulkPacket(transport) { export function BulkPacket(transport) {
Packet.call(this, transport); Packet.call(this, transport);
this._done = false; this._done = false;
this._readyForWriting = defer(); this._readyForWriting = defer();
@ -404,7 +398,7 @@ BulkPacket.prototype.toString = function() {
* @param data string * @param data string
* The raw string to send out onto the stream. * The raw string to send out onto the stream.
*/ */
function RawPacket(transport, data) { export function RawPacket(transport, data) {
Packet.call(this, transport); Packet.call(this, transport);
this._data = data; this._data = data;
this.length = data.length; 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, * 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/. */ * 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 = {}; const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs", error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs",
}); MarionettePrefs: "chrome://remote/content/marionette/prefs.sys.mjs",
XPCOMUtils.defineLazyModuleGetters(lazy, {
MarionettePrefs: "chrome://remote/content/marionette/prefs.js",
}); });
/** @namespace */ /** @namespace */
const permissions = {}; export const permissions = {};
/** /**
* Set a permission's state. * 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, * 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/. */ * 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 = ["Branch", "EnvironmentPrefs", "MarionettePrefs"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -21,7 +15,7 @@ XPCOMUtils.defineLazyServiceGetter(
const { PREF_BOOL, PREF_INT, PREF_INVALID, PREF_STRING } = Ci.nsIPrefBranch; const { PREF_BOOL, PREF_INT, PREF_INVALID, PREF_STRING } = Ci.nsIPrefBranch;
class Branch { export class Branch {
/** /**
* @param {string=} branch * @param {string=} branch
* Preference subtree. Uses root tree given `null`. * Preference subtree. Uses root tree given `null`.
@ -162,7 +156,7 @@ class MarionetteBranch extends Branch {
} }
/** Reads a JSON serialised blob stored in the environment. */ /** 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 * Reads the environment variable `key` and tries to parse it as
* JSON Object, then provides an iterator over its keys and values. * 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 // There is a future potential of exposing this as Marionette.prefs.port
// if we introduce a Marionette.jsm module. // 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, * 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/. */ * 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 = ["reftest"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
AppInfo: "chrome://remote/content/shared/AppInfo.sys.mjs", AppInfo: "chrome://remote/content/shared/AppInfo.sys.mjs",
assert: "chrome://remote/content/shared/webdriver/Assert.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", Log: "chrome://remote/content/shared/Log.sys.mjs",
navigate: "chrome://remote/content/marionette/navigate.sys.mjs",
print: "chrome://remote/content/shared/PDF.sys.mjs", print: "chrome://remote/content/shared/PDF.sys.mjs",
windowManager: "chrome://remote/content/shared/WindowManager.sys.mjs", windowManager: "chrome://remote/content/shared/WindowManager.sys.mjs",
}); });
XPCOMUtils.defineLazyModuleGetters(lazy, { XPCOMUtils.defineLazyModuleGetters(lazy, {
E10SUtils: "resource://gre/modules/E10SUtils.jsm", E10SUtils: "resource://gre/modules/E10SUtils.jsm",
capture: "chrome://remote/content/marionette/capture.js",
navigate: "chrome://remote/content/marionette/navigate.js",
}); });
XPCOMUtils.defineLazyGetter(lazy, "logger", () => XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
@ -65,7 +58,7 @@ const DEFAULT_PDF_RESOLUTION = 96 / 72;
* *
* @namespace * @namespace
*/ */
const reftest = {}; export const reftest = {};
/** /**
* @memberof reftest * @memberof reftest
@ -116,12 +109,12 @@ reftest.Runner = class {
ChromeUtils.registerWindowActor("MarionetteReftest", { ChromeUtils.registerWindowActor("MarionetteReftest", {
kind: "JSWindowActor", kind: "JSWindowActor",
parent: { parent: {
moduleURI: esModuleURI:
"chrome://remote/content/marionette/actors/MarionetteReftestParent.jsm", "chrome://remote/content/marionette/actors/MarionetteReftestParent.sys.mjs",
}, },
child: { child: {
moduleURI: esModuleURI:
"chrome://remote/content/marionette/actors/MarionetteReftestChild.jsm", "chrome://remote/content/marionette/actors/MarionetteReftestChild.sys.mjs",
events: { events: {
load: { mozSystemGroup: true, capture: true }, 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, * 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/. */ * 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 = ["TCPConnection", "TCPListener"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
assert: "chrome://remote/content/shared/webdriver/Assert.sys.mjs", 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", 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", Log: "chrome://remote/content/shared/Log.sys.mjs",
}); MarionettePrefs: "chrome://remote/content/marionette/prefs.sys.mjs",
Message: "chrome://remote/content/marionette/message.sys.mjs",
XPCOMUtils.defineLazyModuleGetters(lazy, { Response: "chrome://remote/content/marionette/message.sys.mjs",
Command: "chrome://remote/content/marionette/message.js", WebReference: "chrome://remote/content/marionette/element.sys.mjs",
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",
}); });
XPCOMUtils.defineLazyGetter(lazy, "logger", () => XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
@ -50,7 +41,7 @@ const PROTOCOL_VERSION = 3;
* debugger transport interface on the provided `port`. For every * debugger transport interface on the provided `port`. For every
* new connection, a {@link TCPConnection} is created. * new connection, a {@link TCPConnection} is created.
*/ */
class TCPListener { export class TCPListener {
/** /**
* @param {number} port * @param {number} port
* Port for server to listen to. * Port for server to listen to.
@ -184,7 +175,7 @@ class TCPListener {
* @param {function(): GeckoDriver} driverFactory * @param {function(): GeckoDriver} driverFactory
* Factory function that produces a {@link GeckoDriver}. * Factory function that produces a {@link GeckoDriver}.
*/ */
class TCPConnection { export class TCPConnection {
constructor(connID, transport, driverFactory) { constructor(connID, transport, driverFactory) {
this.id = connID; this.id = connID;
this.conn = transport; this.conn = transport;

View file

@ -2,13 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict"; import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const EXPORTED_SYMBOLS = ["StreamUtils"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -256,7 +250,7 @@ function delimitedRead(stream, delimiter, count) {
return data; return data;
} }
const StreamUtils = { export const StreamUtils = {
copyStream, copyStream,
delimitedRead, delimitedRead,
}; };

View file

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

View file

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

View file

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

View file

@ -1,5 +1,5 @@
const { Context } = ChromeUtils.import( const { Context } = ChromeUtils.importESModule(
"chrome://remote/content/marionette/browser.js" "chrome://remote/content/marionette/browser.sys.mjs"
); );
add_test(function test_Context() { 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, * 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/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
const { cookie } = ChromeUtils.import( const { cookie } = ChromeUtils.importESModule(
"chrome://remote/content/marionette/cookie.js" "chrome://remote/content/marionette/cookie.sys.mjs"
); );
/* eslint-disable mozilla/use-chromeutils-generateqi */ /* eslint-disable mozilla/use-chromeutils-generateqi */

View file

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

View file

@ -8,7 +8,9 @@ const {
WebFrame, WebFrame,
WebReference, WebReference,
WebWindow, 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 SVG_NS = "http://www.w3.org/2000/svg";
const XHTML_NS = "http://www.w3.org/1999/xhtml"; const XHTML_NS = "http://www.w3.org/1999/xhtml";

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -10,7 +10,9 @@ const {
TimedPromise, TimedPromise,
waitForMessage, waitForMessage,
waitForObserverTopic, 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. * Mimic a message manager for sending messages.
@ -68,7 +70,9 @@ class MockTimer {
add_test(function test_executeSoon_callback() { add_test(function test_executeSoon_callback() {
// executeSoon() is already defined for xpcshell in head.js. As such import // executeSoon() is already defined for xpcshell in head.js. As such import
// our implementation into a custom namespace. // 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, [], {}]) { for (let func of ["foo", null, true, [], {}]) {
Assert.throws(() => sync.executeSoon(func), /TypeError/); 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 * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict"; import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const EXPORTED_SYMBOLS = ["DebuggerTransport"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; 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, { XPCOMUtils.defineLazyModuleGetters(lazy, {
EventEmitter: "resource://gre/modules/EventEmitter.jsm", 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", () => { XPCOMUtils.defineLazyGetter(lazy, "ScriptableInputStream", () => {
@ -102,7 +98,7 @@ const PACKET_HEADER_MAX = 200;
* *
* @class * @class
*/ */
function DebuggerTransport(input, output) { export function DebuggerTransport(input, output) {
lazy.EventEmitter.decorate(this); lazy.EventEmitter.decorate(this);
this._input = input; this._input = input;

View file

@ -2,8 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {}; const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
@ -11,11 +9,8 @@ ChromeUtils.defineESModuleGetters(lazy, {
error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs", error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs",
EventPromise: "chrome://remote/content/shared/Sync.sys.mjs", EventPromise: "chrome://remote/content/shared/Sync.sys.mjs",
TabManager: "chrome://remote/content/shared/TabManager.sys.mjs", TabManager: "chrome://remote/content/shared/TabManager.sys.mjs",
}); TimedPromise: "chrome://remote/content/marionette/sync.sys.mjs",
waitForObserverTopic: "chrome://remote/content/marionette/sync.sys.mjs",
XPCOMUtils.defineLazyModuleGetters(lazy, {
TimedPromise: "chrome://remote/content/marionette/sync.js",
waitForObserverTopic: "chrome://remote/content/marionette/sync.js",
}); });
/** /**

View file

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

View file

@ -123,61 +123,6 @@
"remote/cdp/targets/Target.jsm", "remote/cdp/targets/Target.jsm",
"chrome://remote/content/cdp/targets/TargetList.jsm": "chrome://remote/content/cdp/targets/TargetList.jsm":
"remote/cdp/targets/TargetList.jsm", "remote/cdp/targets/TargetList.jsm",
"chrome://remote/content/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": "chrome://remote/content/webdriver-bidi/NewSessionHandler.jsm":
"remote/webdriver-bidi/NewSessionHandler.jsm", "remote/webdriver-bidi/NewSessionHandler.jsm",
"chrome://remote/content/webdriver-bidi/RemoteValue.jsm": "chrome://remote/content/webdriver-bidi/RemoteValue.jsm":