summaryrefslogtreecommitdiffstats
path: root/remote/marionette
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
commitfbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch)
tree4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /remote/marionette
parentReleasing progress-linux version 124.0.1-1~progress7.99u1. (diff)
downloadfirefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz
firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'remote/marionette')
-rw-r--r--remote/marionette/addon.sys.mjs2
-rw-r--r--remote/marionette/browser.sys.mjs5
-rw-r--r--remote/marionette/driver.sys.mjs2
-rw-r--r--remote/marionette/event.sys.mjs291
-rw-r--r--remote/marionette/interaction.sys.mjs2
-rw-r--r--remote/marionette/jar.mn1
-rw-r--r--remote/marionette/navigate.sys.mjs4
-rw-r--r--remote/marionette/prefs.sys.mjs2
-rw-r--r--remote/marionette/reftest-content.js15
-rw-r--r--remote/marionette/test/xpcshell/test_cookie.js5
-rw-r--r--remote/marionette/test/xpcshell/test_sync.js8
11 files changed, 19 insertions, 318 deletions
diff --git a/remote/marionette/addon.sys.mjs b/remote/marionette/addon.sys.mjs
index f83671694b..5d7169444c 100644
--- a/remote/marionette/addon.sys.mjs
+++ b/remote/marionette/addon.sys.mjs
@@ -37,7 +37,7 @@ async function installAddon(file) {
throw new lazy.error.UnknownError(ERRORS[install.error]);
}
- return install.install().catch(err => {
+ return install.install().catch(() => {
throw new lazy.error.UnknownError(ERRORS[install.error]);
});
}
diff --git a/remote/marionette/browser.sys.mjs b/remote/marionette/browser.sys.mjs
index fd5aac21a3..d9a867fac5 100644
--- a/remote/marionette/browser.sys.mjs
+++ b/remote/marionette/browser.sys.mjs
@@ -324,11 +324,8 @@ browser.Context = class {
* Registers a new frame, and sets its current frame id to this frame
* if it is not already assigned, and if a) we already have a session
* or b) we're starting a new session and it is the right start frame.
- *
- * @param {XULBrowser} target
- * The <xul:browser> that was the target of the originating message.
*/
- register(target) {
+ register() {
if (!this.tabBrowser) {
return;
}
diff --git a/remote/marionette/driver.sys.mjs b/remote/marionette/driver.sys.mjs
index 154d2cde83..f4642e756e 100644
--- a/remote/marionette/driver.sys.mjs
+++ b/remote/marionette/driver.sys.mjs
@@ -540,7 +540,7 @@ GeckoDriver.prototype.handleEvent = function ({ target, type }) {
}
};
-GeckoDriver.prototype.observe = async function (subject, topic, data) {
+GeckoDriver.prototype.observe = async function (subject, topic) {
switch (topic) {
case TOPIC_BROWSER_READY:
this.registerWindow(subject);
diff --git a/remote/marionette/event.sys.mjs b/remote/marionette/event.sys.mjs
deleted file mode 100644
index dbe6567e52..0000000000
--- a/remote/marionette/event.sys.mjs
+++ /dev/null
@@ -1,291 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/* eslint-disable no-restricted-globals */
-
-const lazy = {};
-
-ChromeUtils.defineESModuleGetters(lazy, {
- keyData: "chrome://remote/content/shared/webdriver/KeyData.sys.mjs",
-});
-
-/** Provides functionality for creating and sending DOM events. */
-export const event = {};
-
-const _eventUtils = new WeakMap();
-
-function _getEventUtils(win) {
- if (!_eventUtils.has(win)) {
- const eventUtilsObject = {
- window: win,
- parent: win,
- _EU_Ci: Ci,
- _EU_Cc: Cc,
- };
- Services.scriptloader.loadSubScript(
- "chrome://remote/content/external/EventUtils.js",
- eventUtilsObject
- );
- _eventUtils.set(win, eventUtilsObject);
- }
- return _eventUtils.get(win);
-}
-
-event.MouseEvents = {
- click: 0,
- dblclick: 1,
- mousedown: 2,
- mouseup: 3,
- mouseover: 4,
- mouseout: 5,
-};
-
-event.Modifiers = {
- shiftKey: 0,
- ctrlKey: 1,
- altKey: 2,
- metaKey: 3,
-};
-
-event.MouseButton = {
- isPrimary(button) {
- return button === 0;
- },
- isAuxiliary(button) {
- return button === 1;
- },
- isSecondary(button) {
- return button === 2;
- },
-};
-
-/**
- * Synthesise a mouse event at a point.
- *
- * If the type is specified in opts, an mouse event of that type is
- * fired. Otherwise, a mousedown followed by a mouseup is performed.
- *
- * @param {number} left
- * Offset from viewport left, in CSS pixels
- * @param {number} top
- * Offset from viewport top, in CSS pixels
- * @param {object} opts
- * Object which may contain the properties "shiftKey", "ctrlKey",
- * "altKey", "metaKey", "accessKey", "clickCount", "button", and
- * "type".
- * @param {Window} win
- * Window object.
- *
- * @returns {boolean} defaultPrevented
- */
-event.synthesizeMouseAtPoint = function (left, top, opts, win) {
- return _getEventUtils(win).synthesizeMouseAtPoint(left, top, opts, win);
-};
-
-/**
- * Synthesise a touch event at a point.
- *
- * If the type is specified in opts, a touch event of that type is
- * fired. Otherwise, a touchstart followed by a touchend is performed.
- *
- * @param {number} left
- * Offset from viewport left, in CSS pixels
- * @param {number} top
- * Offset from viewport top, in CSS pixels
- * @param {object} opts
- * Object which may contain the properties "id", "rx", "ry", "angle",
- * "force", "shiftKey", "ctrlKey", "altKey", "metaKey", "accessKey",
- * "type".
- * @param {Window} win
- * Window object.
- *
- * @returns {boolean} defaultPrevented
- */
-event.synthesizeTouchAtPoint = function (left, top, opts, win) {
- return _getEventUtils(win).synthesizeTouchAtPoint(left, top, opts, win);
-};
-
-/**
- * Synthesise a wheel scroll event at a point.
- *
- * @param {number} left
- * Offset from viewport left, in CSS pixels
- * @param {number} top
- * Offset from viewport top, in CSS pixels
- * @param {object} opts
- * Object which may contain the properties "shiftKey", "ctrlKey",
- * "altKey", "metaKey", "accessKey", "deltaX", "deltaY", "deltaZ",
- * "deltaMode", "lineOrPageDeltaX", "lineOrPageDeltaY", "isMomentum",
- * "isNoLineOrPageDelta", "isCustomizedByPrefs", "expectedOverflowDeltaX",
- * "expectedOverflowDeltaY"
- * @param {Window} win
- * Window object.
- */
-event.synthesizeWheelAtPoint = function (left, top, opts, win) {
- const dpr = win.devicePixelRatio;
-
- // All delta properties expect the value in device pixels while the
- // WebDriver specification uses CSS pixels.
- if (typeof opts.deltaX !== "undefined") {
- opts.deltaX *= dpr;
- }
- if (typeof opts.deltaY !== "undefined") {
- opts.deltaY *= dpr;
- }
- if (typeof opts.deltaZ !== "undefined") {
- opts.deltaZ *= dpr;
- }
-
- return _getEventUtils(win).synthesizeWheelAtPoint(left, top, opts, win);
-};
-
-event.synthesizeMultiTouch = function (opts, win) {
- const modifiers = _getEventUtils(win)._parseModifiers(opts);
- win.windowUtils.sendTouchEvent(
- opts.type,
- opts.id,
- opts.x,
- opts.y,
- opts.rx,
- opts.ry,
- opts.angle,
- opts.force,
- opts.tiltx,
- opts.tilty,
- opts.twist,
- modifiers
- );
-};
-
-/**
- * Synthesize a keydown event for a single key.
- *
- * @param {object} key
- * Key data as returned by keyData.getData
- * @param {Window} win
- * Window object.
- */
-event.sendKeyDown = function (key, win) {
- event.sendSingleKey(key, win, "keydown");
-};
-
-/**
- * Synthesize a keyup event for a single key.
- *
- * @param {object} key
- * Key data as returned by keyData.getData
- * @param {Window} win
- * Window object.
- */
-event.sendKeyUp = function (key, win) {
- event.sendSingleKey(key, win, "keyup");
-};
-
-/**
- * Synthesize a key event for a single key.
- *
- * @param {object} key
- * Key data as returned by keyData.getData
- * @param {Window} win
- * Window object.
- * @param {string=} type
- * Event to emit. By default the full keydown/keypressed/keyup event
- * sequence is emitted.
- */
-event.sendSingleKey = function (key, win, type = null) {
- let keyValue = key.key;
- if (!key.printable) {
- keyValue = `KEY_${keyValue}`;
- }
- const event = {
- code: key.code,
- location: key.location,
- altKey: key.altKey ?? false,
- shiftKey: key.shiftKey ?? false,
- ctrlKey: key.ctrlKey ?? false,
- metaKey: key.metaKey ?? false,
- repeat: key.repeat ?? false,
- };
- if (type) {
- event.type = type;
- }
- _getEventUtils(win).synthesizeKey(keyValue, event, win);
-};
-
-/**
- * Send a string as a series of keypresses.
- *
- * @param {string} keyString
- * Sequence of characters to send as key presses
- * @param {Window} win
- * Window object
- */
-event.sendKeys = function (keyString, win) {
- const modifiers = {};
- for (let modifier in event.Modifiers) {
- modifiers[modifier] = false;
- }
-
- for (let keyValue of keyString) {
- // keyValue will contain enough to represent the UTF-16 encoding of a single abstract character
- // i.e. either a single scalar value, or a surrogate pair
- if (modifiers.shiftKey) {
- keyValue = lazy.keyData.getShiftedKey(keyValue);
- }
- const data = lazy.keyData.getData(keyValue);
- const key = { ...data, ...modifiers };
- if (data.modifier) {
- // Negating the state of the modifier here is not spec compliant but
- // makes us compatible to Chrome's behavior for now. That's fine unless
- // we know the correct behavior.
- //
- // @see: https://github.com/w3c/webdriver/issues/1734
- modifiers[data.modifier] = !modifiers[data.modifier];
- }
- event.sendSingleKey(key, win);
- }
-};
-
-event.sendEvent = function (eventType, el, modifiers = {}, opts = {}) {
- opts.canBubble = opts.canBubble || true;
-
- let doc = el.ownerDocument || el.document;
- let ev = doc.createEvent("Event");
-
- ev.shiftKey = modifiers.shift;
- ev.metaKey = modifiers.meta;
- ev.altKey = modifiers.alt;
- ev.ctrlKey = modifiers.ctrl;
-
- ev.initEvent(eventType, opts.canBubble, true);
- el.dispatchEvent(ev);
-};
-
-event.mouseover = function (el, modifiers = {}, opts = {}) {
- return event.sendEvent("mouseover", el, modifiers, opts);
-};
-
-event.mousemove = function (el, modifiers = {}, opts = {}) {
- return event.sendEvent("mousemove", el, modifiers, opts);
-};
-
-event.mousedown = function (el, modifiers = {}, opts = {}) {
- return event.sendEvent("mousedown", el, modifiers, opts);
-};
-
-event.mouseup = function (el, modifiers = {}, opts = {}) {
- return event.sendEvent("mouseup", el, modifiers, opts);
-};
-
-event.click = function (el, modifiers = {}, opts = {}) {
- return event.sendEvent("click", el, modifiers, opts);
-};
-
-event.change = function (el, modifiers = {}, opts = {}) {
- return event.sendEvent("change", el, modifiers, opts);
-};
-
-event.input = function (el, modifiers = {}, opts = {}) {
- return event.sendEvent("input", el, modifiers, opts);
-};
diff --git a/remote/marionette/interaction.sys.mjs b/remote/marionette/interaction.sys.mjs
index c71149a96a..d710f2eb46 100644
--- a/remote/marionette/interaction.sys.mjs
+++ b/remote/marionette/interaction.sys.mjs
@@ -13,7 +13,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
atom: "chrome://remote/content/marionette/atom.sys.mjs",
dom: "chrome://remote/content/shared/DOM.sys.mjs",
error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs",
- event: "chrome://remote/content/marionette/event.sys.mjs",
+ event: "chrome://remote/content/shared/webdriver/Event.sys.mjs",
Log: "chrome://remote/content/shared/Log.sys.mjs",
pprint: "chrome://remote/content/shared/Format.sys.mjs",
TimedPromise: "chrome://remote/content/marionette/sync.sys.mjs",
diff --git a/remote/marionette/jar.mn b/remote/marionette/jar.mn
index b206dc2487..21c37ee455 100644
--- a/remote/marionette/jar.mn
+++ b/remote/marionette/jar.mn
@@ -18,7 +18,6 @@ remote.jar:
content/marionette/cookie.sys.mjs (cookie.sys.mjs)
content/marionette/driver.sys.mjs (driver.sys.mjs)
content/marionette/evaluate.sys.mjs (evaluate.sys.mjs)
- content/marionette/event.sys.mjs (event.sys.mjs)
content/marionette/interaction.sys.mjs (interaction.sys.mjs)
content/marionette/json.sys.mjs (json.sys.mjs)
content/marionette/l10n.sys.mjs (l10n.sys.mjs)
diff --git a/remote/marionette/navigate.sys.mjs b/remote/marionette/navigate.sys.mjs
index 993ca75cf8..31774c9e73 100644
--- a/remote/marionette/navigate.sys.mjs
+++ b/remote/marionette/navigate.sys.mjs
@@ -265,7 +265,7 @@ navigate.waitForNavigationCompleted = async function waitForNavigationCompleted(
checkDone({ finished: true });
};
- const onTimer = timer => {
+ const onTimer = () => {
// For the command "Element Click" we want to detect a potential navigation
// as early as possible. The `beforeunload` event is an indication for that
// but could still cause the navigation to get aborted by the user. As such
@@ -356,7 +356,7 @@ navigate.waitForNavigationCompleted = async function waitForNavigationCompleted(
}
};
- const onUnload = event => {
+ const onUnload = () => {
lazy.logger.trace(
"Canceled page load listener " +
"because the top-browsing context has been closed"
diff --git a/remote/marionette/prefs.sys.mjs b/remote/marionette/prefs.sys.mjs
index 17df13d0fd..d3b995634e 100644
--- a/remote/marionette/prefs.sys.mjs
+++ b/remote/marionette/prefs.sys.mjs
@@ -171,5 +171,5 @@ export class EnvironmentPrefs {
}
// There is a future potential of exposing this as Marionette.prefs.port
-// if we introduce a Marionette.jsm module.
+// if we introduce a Marionette.sys.mjs module.
export const MarionettePrefs = new MarionetteBranch();
diff --git a/remote/marionette/reftest-content.js b/remote/marionette/reftest-content.js
index 3c0712f232..00be2a73f0 100644
--- a/remote/marionette/reftest-content.js
+++ b/remote/marionette/reftest-content.js
@@ -30,26 +30,19 @@ BrowserDOMWindow.prototype = {
return null;
},
- createContentWindow(
- aURI,
- aOpenWindowInfo,
- aWhere,
- aFlags,
- aTriggeringPrincipal,
- aCsp
- ) {
+ createContentWindow(aURI, aOpenWindowInfo, aWhere) {
return this._maybeOpen(aOpenWindowInfo, aWhere)?.browsingContext;
},
- openURI(aURI, aOpenWindowInfo, aWhere, aFlags, aTriggeringPrincipal, aCsp) {
+ openURI(aURI, aOpenWindowInfo, aWhere) {
return this._maybeOpen(aOpenWindowInfo, aWhere)?.browsingContext;
},
- createContentWindowInFrame(aURI, aParams, aWhere, aFlags, aName) {
+ createContentWindowInFrame(aURI, aParams, aWhere) {
return this._maybeOpen(aParams.openWindowInfo, aWhere);
},
- openURIInFrame(aURI, aParams, aWhere, aFlags, aName) {
+ openURIInFrame(aURI, aParams, aWhere) {
return this._maybeOpen(aParams.openWindowInfo, aWhere);
},
diff --git a/remote/marionette/test/xpcshell/test_cookie.js b/remote/marionette/test/xpcshell/test_cookie.js
index b5ce5e9008..496aafd68b 100644
--- a/remote/marionette/test/xpcshell/test_cookie.js
+++ b/remote/marionette/test/xpcshell/test_cookie.js
@@ -239,7 +239,10 @@ add_task(function test_add() {
equal("value", cookie.manager.cookies[0].value);
equal(".domain", cookie.manager.cookies[0].host);
equal("/", cookie.manager.cookies[0].path);
- ok(cookie.manager.cookies[0].expiry > new Date(Date.now()).getTime() / 1000);
+ Assert.greater(
+ cookie.manager.cookies[0].expiry,
+ new Date(Date.now()).getTime() / 1000
+ );
cookie.add({
name: "name2",
diff --git a/remote/marionette/test/xpcshell/test_sync.js b/remote/marionette/test/xpcshell/test_sync.js
index 87ec44e960..19969f4473 100644
--- a/remote/marionette/test/xpcshell/test_sync.js
+++ b/remote/marionette/test/xpcshell/test_sync.js
@@ -28,7 +28,7 @@ class MessageManager {
this.message = message;
}
- removeMessageListener(message) {
+ removeMessageListener() {
this.func = null;
this.message = null;
}
@@ -55,7 +55,7 @@ class MockTimer {
this.cancelled = false;
}
- initWithCallback(cb, timeout, type) {
+ initWithCallback(cb) {
this.ticks++;
if (this.ticks >= this.goal) {
cb();
@@ -216,7 +216,7 @@ add_task(function test_TimedPromise_timeoutTypes() {
add_task(async function test_TimedPromise_errorMessage() {
try {
- await new TimedPromise(resolve => {}, { timeout: 0 });
+ await new TimedPromise(() => {}, { timeout: 0 });
ok(false, "Expected Timeout error not raised");
} catch (e) {
ok(
@@ -226,7 +226,7 @@ add_task(async function test_TimedPromise_errorMessage() {
}
try {
- await new TimedPromise(resolve => {}, {
+ await new TimedPromise(() => {}, {
errorMessage: "Not found",
timeout: 0,
});