commit 7d581ca98697f963bbf45a55c6db8a45bbbeb355
parent b38ebfaf2dd24b1e210c4fee5a92c89f5d49e8c0
Author: Mike Conley <mconley@mozilla.com>
Date: Mon, 20 Oct 2025 14:56:53 +0000
Bug 1983936 - Remove EventUtils.js newtab train-hop compatibility shims now that Firefox 144 has shipped to release. r=edgar
Differential Revision: https://phabricator.services.mozilla.com/D269099
Diffstat:
1 file changed, 14 insertions(+), 89 deletions(-)
diff --git a/testing/mochitest/tests/SimpleTest/EventUtils.js b/testing/mochitest/tests/SimpleTest/EventUtils.js
@@ -219,22 +219,6 @@ function computeButton(aEvent) {
return aEvent.type == "contextmenu" ? 2 : 0;
}
-function computeButtons(aEvent, utils) {
- if (typeof aEvent.buttons != "undefined") {
- return aEvent.buttons;
- }
-
- if (typeof aEvent.button != "undefined") {
- return utils.MOUSE_BUTTONS_NOT_SPECIFIED;
- }
-
- if (typeof aEvent.type != "undefined" && aEvent.type != "mousedown") {
- return utils.MOUSE_BUTTONS_NO_BUTTON;
- }
-
- return utils.MOUSE_BUTTONS_NOT_SPECIFIED;
-}
-
/**
* Send a mouse event to the node aTarget (aTarget can be an id, or an
* actual node) . The "event" passed in to aEvent is just a JavaScript
@@ -771,56 +755,28 @@ function synthesizeMouseAtPoint(
const isAsyncEnabled =
"asyncEnabled" in aEvent ? aEvent.asyncEnabled : false;
- // The following blocks check for the existence of synthesizeMouseEvent on
- // the Window wrapper, which was added in 144 via bug 1977774. As EventUtils
- // is used by mochitest-browser, and is part of the newtab train-hop
- // compatibility testing mechanism, we need to ensure that this is still
- // compatible with 143 and 142. We fallback to the old nsIDOMWindowUtils
- // mechanism if we cannot find the synthesizeMouseEvent on the Window.
- //
- // This newtab train-hop compatibility shim can be removed once Firefox 144
- // makes it to the release channel (bug 1983936).
-
if ("type" in aEvent && aEvent.type) {
- if (_EU_maybeWrap(aWindow).synthesizeMouseEvent) {
- defaultPrevented = _EU_maybeWrap(aWindow).synthesizeMouseEvent(
- aEvent.type,
- aLeft,
- aTop,
- {
- identifier: id,
- button,
- buttons: aEvent.buttons,
- clickCount,
- modifiers,
- pressure,
- inputSource,
- },
- {
- isDOMEventSynthesized,
- isWidgetEventSynthesized,
- isAsyncEnabled,
- },
- aCallback
- );
- } else {
- defaultPrevented = utils.sendMouseEvent(
- aEvent.type,
- aLeft,
- aTop,
+ defaultPrevented = _EU_maybeWrap(aWindow).synthesizeMouseEvent(
+ aEvent.type,
+ aLeft,
+ aTop,
+ {
+ identifier: id,
button,
+ buttons: aEvent.buttons,
clickCount,
modifiers,
- false,
pressure,
inputSource,
+ },
+ {
isDOMEventSynthesized,
isWidgetEventSynthesized,
- computeButtons(aEvent, utils),
- id
- );
- }
- } else if (_EU_maybeWrap(aWindow).synthesizeMouseEvent) {
+ isAsyncEnabled,
+ },
+ aCallback
+ );
+ } else {
_EU_maybeWrap(aWindow).synthesizeMouseEvent(
"mousedown",
aLeft,
@@ -861,37 +817,6 @@ function synthesizeMouseAtPoint(
},
aCallback
);
- } else {
- utils.sendMouseEvent(
- "mousedown",
- aLeft,
- aTop,
- button,
- clickCount,
- modifiers,
- false,
- pressure,
- inputSource,
- isDOMEventSynthesized,
- isWidgetEventSynthesized,
- computeButtons(Object.assign({ type: "mousedown" }, aEvent), utils),
- id
- );
- utils.sendMouseEvent(
- "mouseup",
- aLeft,
- aTop,
- button,
- clickCount,
- modifiers,
- false,
- pressure,
- inputSource,
- isDOMEventSynthesized,
- isWidgetEventSynthesized,
- computeButtons(Object.assign({ type: "mouseup" }, aEvent), utils),
- id
- );
}
}