зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1691622 - part 6: Merge `synthesizeNativeMouseClick*` with `synthesizeNativeMouseEvent*` r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D105760
This commit is contained in:
Родитель
293d2541c8
Коммит
44ff291cb4
|
@ -36,7 +36,8 @@ add_task(async function test_PanelMultiView_toggle_with_other_popup() {
|
||||||
// 3. Click the button to which the main menu is anchored. We need a native
|
// 3. Click the button to which the main menu is anchored. We need a native
|
||||||
// mouse event to simulate the exact platform behavior with popups.
|
// mouse event to simulate the exact platform behavior with popups.
|
||||||
let clickFn = () =>
|
let clickFn = () =>
|
||||||
EventUtils.promiseNativeMouseClickAndWaitForEvent({
|
EventUtils.promiseNativeMouseEventAndWaitForEvent({
|
||||||
|
type: "click",
|
||||||
target: document.getElementById("PanelUI-button"),
|
target: document.getElementById("PanelUI-button"),
|
||||||
atCenter: true,
|
atCenter: true,
|
||||||
eventTypeToWait: "mouseup",
|
eventTypeToWait: "mouseup",
|
||||||
|
|
|
@ -135,7 +135,8 @@ add_task(async function open_empty() {
|
||||||
promise = promiseEvent(searchPopup, "popuphidden");
|
promise = promiseEvent(searchPopup, "popuphidden");
|
||||||
|
|
||||||
info("Hiding popup");
|
info("Hiding popup");
|
||||||
await EventUtils.promiseNativeMouseClickAndWaitForEvent({
|
await EventUtils.promiseNativeMouseEventAndWaitForEvent({
|
||||||
|
type: "click",
|
||||||
target: searchIcon,
|
target: searchIcon,
|
||||||
atCenter: true,
|
atCenter: true,
|
||||||
eventTypeToWait: "mouseup",
|
eventTypeToWait: "mouseup",
|
||||||
|
@ -229,7 +230,8 @@ add_task(async function open_empty_hiddenOneOffs() {
|
||||||
promise = promiseEvent(searchPopup, "popuphidden");
|
promise = promiseEvent(searchPopup, "popuphidden");
|
||||||
|
|
||||||
info("Hiding popup");
|
info("Hiding popup");
|
||||||
await EventUtils.promiseNativeMouseClickAndWaitForEvent({
|
await EventUtils.promiseNativeMouseEventAndWaitForEvent({
|
||||||
|
type: "click",
|
||||||
target: searchIcon,
|
target: searchIcon,
|
||||||
atCenter: true,
|
atCenter: true,
|
||||||
eventTypeToWait: "mouseup",
|
eventTypeToWait: "mouseup",
|
||||||
|
@ -572,7 +574,8 @@ add_task(async function dont_consume_clicks() {
|
||||||
is(textbox.selectionEnd, 3, "Should have selected all of the text");
|
is(textbox.selectionEnd, 3, "Should have selected all of the text");
|
||||||
|
|
||||||
promise = promiseEvent(searchPopup, "popuphidden");
|
promise = promiseEvent(searchPopup, "popuphidden");
|
||||||
await EventUtils.promiseNativeMouseClickAndWaitForEvent({
|
await EventUtils.promiseNativeMouseEventAndWaitForEvent({
|
||||||
|
type: "click",
|
||||||
target: gURLBar.inputField,
|
target: gURLBar.inputField,
|
||||||
atCenter: true,
|
atCenter: true,
|
||||||
eventTypeToWait: "mouseup",
|
eventTypeToWait: "mouseup",
|
||||||
|
|
|
@ -23,7 +23,11 @@ add_task(async function() {
|
||||||
// Must have at least one test.
|
// Must have at least one test.
|
||||||
Assert.ok(!!elt, "Found a valid element: " + (elt.id || elt.localName));
|
Assert.ok(!!elt, "Found a valid element: " + (elt.id || elt.localName));
|
||||||
await UrlbarTestUtils.promisePopupClose(window, () =>
|
await UrlbarTestUtils.promisePopupClose(window, () =>
|
||||||
EventUtils.synthesizeNativeMouseClick({ target: elt, atCenter: true })
|
EventUtils.synthesizeNativeMouseEvent({
|
||||||
|
type: "click",
|
||||||
|
target: elt,
|
||||||
|
atCenter: true,
|
||||||
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -74,7 +74,7 @@ function runTests() {
|
||||||
synthesizeNativeMouseMove(target0, 10, 10, () => {
|
synthesizeNativeMouseMove(target0, 10, 10, () => {
|
||||||
synthesizeNativeMouseMove(target0, 15, 15, () => {
|
synthesizeNativeMouseMove(target0, 15, 15, () => {
|
||||||
synthesizeNativeMouseMove(target0, 20, 20, () => {
|
synthesizeNativeMouseMove(target0, 20, 20, () => {
|
||||||
synthesizeNativeMouseClick({ target: target0, offsetX: 20, offsetY: 20 });
|
synthesizeNativeMouseEvent({ type: "click", target: target0, offsetX: 20, offsetY: 20 });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -59,10 +59,11 @@ add_task(async () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
// NOTE: synthesizeMouseAtCenter doesn't work for OOP iframes (bug 1528935),
|
// NOTE: synthesizeMouseAtCenter doesn't work for OOP iframes (bug 1528935),
|
||||||
// so we use promiseNativeMouseClick instead.
|
// so we use promiseNativeMouseEvent instead.
|
||||||
const [expectedScreenXInSameOrigin, expectedScreenYInSameOrigin] =
|
const [expectedScreenXInSameOrigin, expectedScreenYInSameOrigin] =
|
||||||
getScreenPosition(iframes[0], 10, 10);
|
getScreenPosition(iframes[0], 10, 10);
|
||||||
await promiseNativeMouseClick({
|
await promiseNativeMouseEvent({
|
||||||
|
type: "click",
|
||||||
target: iframes[0],
|
target: iframes[0],
|
||||||
screenX: expectedScreenXInSameOrigin,
|
screenX: expectedScreenXInSameOrigin,
|
||||||
screenY: expectedScreenYInSameOrigin,
|
screenY: expectedScreenYInSameOrigin,
|
||||||
|
@ -76,7 +77,8 @@ add_task(async () => {
|
||||||
|
|
||||||
const [expectedScreenXInCrossOrigin, expectedScreenYInCrossOrigin] =
|
const [expectedScreenXInCrossOrigin, expectedScreenYInCrossOrigin] =
|
||||||
getScreenPosition(iframes[1], 10, 10);
|
getScreenPosition(iframes[1], 10, 10);
|
||||||
await promiseNativeMouseClick({
|
await promiseNativeMouseEvent({
|
||||||
|
type: "click",
|
||||||
target: iframes[0],
|
target: iframes[0],
|
||||||
screenX: expectedScreenXInCrossOrigin,
|
screenX: expectedScreenXInCrossOrigin,
|
||||||
screenY: expectedScreenYInCrossOrigin,
|
screenY: expectedScreenYInCrossOrigin,
|
||||||
|
|
|
@ -47,7 +47,7 @@ add_task(async () => {
|
||||||
await promiseApzFlushedRepaints();
|
await promiseApzFlushedRepaints();
|
||||||
|
|
||||||
// NOTE: synthesizeMouseAtCenter doesn't work for OOP iframes (bug 1528935),
|
// NOTE: synthesizeMouseAtCenter doesn't work for OOP iframes (bug 1528935),
|
||||||
// so we use synthesizeNativeMouseClick instead.
|
// so we use promiseNativeMouseEventWithAPZ instead.
|
||||||
const [expectedScreenX, expectedScreenY] =
|
const [expectedScreenX, expectedScreenY] =
|
||||||
getScreenPosition(iframe, 10, 10);
|
getScreenPosition(iframe, 10, 10);
|
||||||
|
|
||||||
|
@ -78,7 +78,8 @@ add_task(async () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
await promiseNativeMouseClick({
|
await promiseNativeMouseEventWithAPZ({
|
||||||
|
type: "click",
|
||||||
target: iframe,
|
target: iframe,
|
||||||
screenX: expectedScreenX,
|
screenX: expectedScreenX,
|
||||||
screenY: expectedScreenY,
|
screenY: expectedScreenY,
|
||||||
|
@ -104,7 +105,8 @@ add_task(async () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
await promiseNativeMouseClick({
|
await promiseNativeMouseEventWithAPZ({
|
||||||
|
type: "click",
|
||||||
target: iframe,
|
target: iframe,
|
||||||
screenX: expectedScreenX,
|
screenX: expectedScreenX,
|
||||||
screenY: expectedScreenY,
|
screenY: expectedScreenY,
|
||||||
|
|
|
@ -52,7 +52,7 @@ add_task(async () => {
|
||||||
await promiseApzFlushedRepaints();
|
await promiseApzFlushedRepaints();
|
||||||
|
|
||||||
// NOTE: synthesizeMouseAtCenter doesn't work for OOP iframes (bug 1528935),
|
// NOTE: synthesizeMouseAtCenter doesn't work for OOP iframes (bug 1528935),
|
||||||
// so we use promiseNativeMouseClick instead.
|
// so we use promiseNativeMouseEventWithAPZ instead.
|
||||||
const [expectedScreenX, expectedScreenY] =
|
const [expectedScreenX, expectedScreenY] =
|
||||||
getScreenPosition(iframe, 10, 10);
|
getScreenPosition(iframe, 10, 10);
|
||||||
|
|
||||||
|
@ -85,7 +85,8 @@ add_task(async () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
await promiseNativeMouseClick({
|
await promiseNativeMouseEventWithAPZ({
|
||||||
|
type: "click",
|
||||||
target: iframe,
|
target: iframe,
|
||||||
screenX: expectedScreenX,
|
screenX: expectedScreenX,
|
||||||
screenY: expectedScreenY + 110,
|
screenY: expectedScreenY + 110,
|
||||||
|
@ -131,7 +132,8 @@ add_task(async () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
await promiseNativeMouseClick({
|
await promiseNativeMouseEventWithAPZ({
|
||||||
|
type: "click",
|
||||||
target: iframe,
|
target: iframe,
|
||||||
screenX: expectedScreenX,
|
screenX: expectedScreenX,
|
||||||
screenY: expectedScreenY,
|
screenY: expectedScreenY,
|
||||||
|
|
|
@ -36,7 +36,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1224790
|
||||||
synthesizeMouseAtCenter(button, { type: 'mousemove' }, window);
|
synthesizeMouseAtCenter(button, { type: 'mousemove' }, window);
|
||||||
function click() {
|
function click() {
|
||||||
// The bug is not reproducible with synthesizeMouseAtCenter.
|
// The bug is not reproducible with synthesizeMouseAtCenter.
|
||||||
synthesizeNativeMouseClick({ target: button, atCenter: true });
|
synthesizeNativeMouseEvent({ type: "click", target: button, atCenter: true });
|
||||||
}
|
}
|
||||||
click();
|
click();
|
||||||
// On debug build, it's possible that the click event handler is not
|
// On debug build, it's possible that the click event handler is not
|
||||||
|
|
|
@ -37,7 +37,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1224790
|
||||||
synthesizeMouseAtCenter(button, { type: 'mousemove' }, window);
|
synthesizeMouseAtCenter(button, { type: 'mousemove' }, window);
|
||||||
function click() {
|
function click() {
|
||||||
// The bug is not reproducible with synthesizeMouseAtCenter.
|
// The bug is not reproducible with synthesizeMouseAtCenter.
|
||||||
synthesizeNativeMouseClick({ target: button, atCenter: true });
|
synthesizeNativeMouseEvent({ type: "click", target: button, atCenter: true });
|
||||||
}
|
}
|
||||||
click();
|
click();
|
||||||
// On debug build, it's possible that the click event handler is not
|
// On debug build, it's possible that the click event handler is not
|
||||||
|
|
|
@ -885,36 +885,26 @@ function promiseNativeMouseEventWithAPZ(aParams) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function synthesizeNativeMouseClickWithAPZ(aParams, aObserver = null) {
|
// See synthesizeNativeMouseEventWithAPZ for the detail of aParams.
|
||||||
aParams.type = "click";
|
function synthesizeNativeMouseEventWithAPZAndWaitForWaitForEvent(
|
||||||
return synthesizeNativeMouseEventWithAPZ(aParams, aObserver);
|
|
||||||
}
|
|
||||||
|
|
||||||
function promiseNativeMouseClickWithAPZ(aParams) {
|
|
||||||
aParams.type = "click";
|
|
||||||
return promiseNativeMouseEventWithAPZ(aParams);
|
|
||||||
}
|
|
||||||
|
|
||||||
// See synthesizeNativeMouseClickWithAPZ for the detail of aParams.
|
|
||||||
function synthesizeNativeMouseClickWithAPZAndWaitForClickEvent(
|
|
||||||
aParams,
|
aParams,
|
||||||
aCallback = null
|
aCallback = null
|
||||||
) {
|
) {
|
||||||
const targetWindow = windowForTarget(aParams.target);
|
const targetWindow = windowForTarget(aParams.target);
|
||||||
|
const eventType = aParams.eventTypeToWait || aParams.type;
|
||||||
targetWindow.addEventListener(
|
targetWindow.addEventListener(
|
||||||
"click",
|
eventType,
|
||||||
function(e) {
|
function(e) {
|
||||||
setTimeout(aCallback, 0);
|
setTimeout(aCallback, 0);
|
||||||
},
|
},
|
||||||
{ capture: true, once: true }
|
{ capture: true, once: true }
|
||||||
);
|
);
|
||||||
return synthesizeNativeMouseClickWithAPZ(aParams);
|
return synthesizeNativeMouseEventWithAPZ(aParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Promise-returning variant of synthesizeNativeMouseClickWithAPZAndWaitForClickEvent
|
function promiseNativeMouseEventWithAPZAndWaitForEvent(aParams) {
|
||||||
function promiseNativeMouseClickWithAPZAndClickEvent(aParams) {
|
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
synthesizeNativeMouseClickWithAPZAndWaitForClickEvent(aParams, resolve);
|
synthesizeNativeMouseEventWithAPZAndWaitForWaitForEvent(aParams, resolve);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,12 @@ async function test() {
|
||||||
var subframe = document.getElementById('subframe');
|
var subframe = document.getElementById('subframe');
|
||||||
|
|
||||||
// layerize subframe
|
// layerize subframe
|
||||||
await promiseNativeMouseClickWithAPZAndClickEvent({ target: subframe, offsetX: 10, offsetY: 10 });
|
await promiseNativeMouseEventWithAPZAndWaitForEvent({
|
||||||
|
type: "click",
|
||||||
|
target: subframe,
|
||||||
|
offsetX: 10,
|
||||||
|
offsetY: 10,
|
||||||
|
});
|
||||||
|
|
||||||
// verify layerization
|
// verify layerization
|
||||||
await promiseAllPaintsDone();
|
await promiseAllPaintsDone();
|
||||||
|
|
|
@ -20,7 +20,12 @@ async function test() {
|
||||||
var subframe = document.getElementById('bugzilla-body');
|
var subframe = document.getElementById('bugzilla-body');
|
||||||
|
|
||||||
// layerize subframe
|
// layerize subframe
|
||||||
await promiseNativeMouseClickWithAPZAndClickEvent({ target: subframe, offsetX: 10, offsetY: 10 });
|
await promiseNativeMouseEventWithAPZAndWaitForEvent({
|
||||||
|
type: "click",
|
||||||
|
target: subframe,
|
||||||
|
offsetX: 10,
|
||||||
|
offsetY: 10,
|
||||||
|
});
|
||||||
|
|
||||||
// verify layerization
|
// verify layerization
|
||||||
await promiseAllPaintsDone();
|
await promiseAllPaintsDone();
|
||||||
|
|
|
@ -21,8 +21,8 @@ async function clickButton() {
|
||||||
await promiseApzRepaintsFlushed();
|
await promiseApzRepaintsFlushed();
|
||||||
}
|
}
|
||||||
|
|
||||||
synthesizeNativeMouseClickWithAPZ(
|
synthesizeNativeMouseEventWithAPZ(
|
||||||
{ target: document.getElementById("b"), offsetX: 5, offsetY: 5 },
|
{ type: "click", target: document.getElementById("b"), offsetX: 5, offsetY: 5 },
|
||||||
() => dump("Finished synthesizing click, waiting for button to be clicked...\n")
|
() => dump("Finished synthesizing click, waiting for button to be clicked...\n")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,12 @@ async function test() {
|
||||||
// Click at the bottom of the scrollbar track to trigger a page-down kind of
|
// Click at the bottom of the scrollbar track to trigger a page-down kind of
|
||||||
// scroll. This should use "desktop zooming" scrollbar code which should
|
// scroll. This should use "desktop zooming" scrollbar code which should
|
||||||
// trigger an APZ scroll animation.
|
// trigger an APZ scroll animation.
|
||||||
await promiseNativeMouseClickWithAPZ({ target: anchor, offsetX: xoffset, offsetY: yoffset });
|
await promiseNativeMouseEventWithAPZ({
|
||||||
|
type: "click",
|
||||||
|
target: anchor,
|
||||||
|
offsetX: xoffset,
|
||||||
|
offsetY: yoffset,
|
||||||
|
});
|
||||||
|
|
||||||
// Run a few frames, that should be enough to let the scroll animation
|
// Run a few frames, that should be enough to let the scroll animation
|
||||||
// start. We check to make sure the scroll position has changed.
|
// start. We check to make sure the scroll position has changed.
|
||||||
|
@ -55,7 +60,12 @@ async function test() {
|
||||||
|
|
||||||
// Now we click on the content, which should cancel the animation. Run
|
// Now we click on the content, which should cancel the animation. Run
|
||||||
// everything to reach a stable state.
|
// everything to reach a stable state.
|
||||||
await promiseNativeMouseClickWithAPZ({ target: anchor, offsetX: -5, offsetY: -5 });
|
await promiseNativeMouseEventWithAPZ({
|
||||||
|
type: "click",
|
||||||
|
target: anchor,
|
||||||
|
offsetX: -5,
|
||||||
|
offsetY: -5,
|
||||||
|
});
|
||||||
for (let i = 0; i < 1000; i++) {
|
for (let i = 0; i < 1000; i++) {
|
||||||
utils.advanceTimeAndRefresh(16);
|
utils.advanceTimeAndRefresh(16);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,8 +32,8 @@ let code_for_oopif_to_run = function() {
|
||||||
|
|
||||||
async function clickOnIframe(x, y) {
|
async function clickOnIframe(x, y) {
|
||||||
let iframePromise = promiseOneEvent(window, "OOPIF:ClickData", null);
|
let iframePromise = promiseOneEvent(window, "OOPIF:ClickData", null);
|
||||||
synthesizeNativeMouseClickWithAPZ(
|
synthesizeNativeMouseEventWithAPZ(
|
||||||
{ target: document.body, offsetX: x, offsetY: y },
|
{ type: "click", target: document.body, offsetX: x, offsetY: y },
|
||||||
() => dump("Finished synthesizing click, waiting for OOPIF message...\n")
|
() => dump("Finished synthesizing click, waiting for OOPIF message...\n")
|
||||||
);
|
);
|
||||||
let iframeResponse = await iframePromise;
|
let iframeResponse = await iframePromise;
|
||||||
|
|
|
@ -49,8 +49,8 @@ async function test() {
|
||||||
ok(iframeResponse, "code_for_oopif_to_run successfully installed");
|
ok(iframeResponse, "code_for_oopif_to_run successfully installed");
|
||||||
|
|
||||||
iframePromise = promiseOneEvent(window, "OOPIF:ClickData", null);
|
iframePromise = promiseOneEvent(window, "OOPIF:ClickData", null);
|
||||||
synthesizeNativeMouseClickWithAPZ(
|
synthesizeNativeMouseEventWithAPZ(
|
||||||
{ target: document.body, offsetX: 400, offsetY: 400 },
|
{ type: "click", target: document.body, offsetX: 400, offsetY: 400 },
|
||||||
() => dump("Finished synthesizing click, waiting for OOPIF message...\n")
|
() => dump("Finished synthesizing click, waiting for OOPIF message...\n")
|
||||||
);
|
);
|
||||||
iframeResponse = await iframePromise;
|
iframeResponse = await iframePromise;
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
window.addEventListener("click", resolve);
|
window.addEventListener("click", resolve);
|
||||||
});
|
});
|
||||||
let input = document.querySelector("input");
|
let input = document.querySelector("input");
|
||||||
synthesizeNativeMouseClickWithAPZ({ target: input, offsetX: 10, offsetY: 10 });
|
synthesizeNativeMouseEventWithAPZ({ type: "click", target: input, offsetX: 10, offsetY: 10 });
|
||||||
let e = await clickPromise;
|
let e = await clickPromise;
|
||||||
is(e.target, input, "got click");
|
is(e.target, input, "got click");
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,12 @@ async function test() {
|
||||||
// Click at the bottom of the scrollbar track to trigger a page-down kind of
|
// Click at the bottom of the scrollbar track to trigger a page-down kind of
|
||||||
// scroll. This should use "desktop zooming" scrollbar code which should
|
// scroll. This should use "desktop zooming" scrollbar code which should
|
||||||
// trigger an APZ scroll animation.
|
// trigger an APZ scroll animation.
|
||||||
await promiseNativeMouseClickWithAPZ({ target: anchor, offsetX: xoffset, offsetY: yoffset });
|
await promiseNativeMouseEventWithAPZ({
|
||||||
|
type: "click",
|
||||||
|
target: anchor,
|
||||||
|
offsetX: xoffset,
|
||||||
|
offsetY: yoffset,
|
||||||
|
});
|
||||||
|
|
||||||
// Run 1000 frames, that should be enough to let the scroll animation start
|
// Run 1000 frames, that should be enough to let the scroll animation start
|
||||||
// and run to completion. We check that it scrolled at least half the visible
|
// and run to completion. We check that it scrolled at least half the visible
|
||||||
|
@ -57,7 +62,12 @@ async function test() {
|
||||||
// Now we do two clicks in quick succession, but with a few frames in between
|
// Now we do two clicks in quick succession, but with a few frames in between
|
||||||
// to verify the scroll animation from the first click is active before the
|
// to verify the scroll animation from the first click is active before the
|
||||||
// second click happens.
|
// second click happens.
|
||||||
await promiseNativeMouseClickWithAPZ({ target: anchor, offsetX: xoffset, offsetY: yoffset });
|
await promiseNativeMouseEventWithAPZ({
|
||||||
|
type: "click",
|
||||||
|
target: anchor,
|
||||||
|
offsetX: xoffset,
|
||||||
|
offsetY: yoffset,
|
||||||
|
});
|
||||||
for (let i = 0; i < 5; i++) {
|
for (let i = 0; i < 5; i++) {
|
||||||
utils.advanceTimeAndRefresh(16);
|
utils.advanceTimeAndRefresh(16);
|
||||||
}
|
}
|
||||||
|
@ -65,7 +75,12 @@ async function test() {
|
||||||
let curPos = scroller.scrollTop;
|
let curPos = scroller.scrollTop;
|
||||||
ok(curPos > pageScrollAmount, `Scroll offset has increased to ${curPos}`);
|
ok(curPos > pageScrollAmount, `Scroll offset has increased to ${curPos}`);
|
||||||
ok(curPos < pageScrollAmount * 2, "Second page-scroll is not yet complete");
|
ok(curPos < pageScrollAmount * 2, "Second page-scroll is not yet complete");
|
||||||
await promiseNativeMouseClickWithAPZ({ target: anchor, offsetX: xoffset, offsetY: yoffset });
|
await promiseNativeMouseEventWithAPZ({
|
||||||
|
type: "click",
|
||||||
|
target: anchor,
|
||||||
|
offsetX: xoffset,
|
||||||
|
offsetY: yoffset,
|
||||||
|
});
|
||||||
|
|
||||||
// Run to completion and check that we are around 3x pageScrollAmount, with
|
// Run to completion and check that we are around 3x pageScrollAmount, with
|
||||||
// some allowance for fractional rounding.
|
// some allowance for fractional rounding.
|
||||||
|
|
|
@ -81,7 +81,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=987230
|
||||||
let popupHasShown = false;
|
let popupHasShown = false;
|
||||||
function onMyPopupShown(e) {
|
function onMyPopupShown(e) {
|
||||||
popupHasShown = true;
|
popupHasShown = true;
|
||||||
synthesizeNativeMouseClick({ target: outerAnchor, offsetX: 5, offsetY: 5 });
|
synthesizeNativeMouseEvent({ type: "click", target: outerAnchor, offsetX: 5, offsetY: 5 });
|
||||||
}
|
}
|
||||||
|
|
||||||
function onAnchorClick(e) {
|
function onAnchorClick(e) {
|
||||||
|
|
|
@ -146,7 +146,8 @@ function starttest() {
|
||||||
}
|
}
|
||||||
events = [];
|
events = [];
|
||||||
info(`testSynthesizeNativeMouseClick: sending native mouse click (${test.description})`);
|
info(`testSynthesizeNativeMouseClick: sending native mouse click (${test.description})`);
|
||||||
await promiseNativeMouseClickAndWaitForEvent({
|
await promiseNativeMouseEventAndWaitForEvent({
|
||||||
|
type: "click",
|
||||||
target: $("testMouseEvent"),
|
target: $("testMouseEvent"),
|
||||||
atCenter: true,
|
atCenter: true,
|
||||||
modifiers: test.modifiers,
|
modifiers: test.modifiers,
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
* synthesizeMouseAtCenter
|
* synthesizeMouseAtCenter
|
||||||
* synthesizeNativeMouseMove
|
* synthesizeNativeMouseMove
|
||||||
* synthesizeNativeMouseEvent
|
* synthesizeNativeMouseEvent
|
||||||
* synthesizeNativeMouseClick
|
|
||||||
* synthesizeWheel
|
* synthesizeWheel
|
||||||
* synthesizeWheelAtPoint
|
* synthesizeWheelAtPoint
|
||||||
* synthesizeKey
|
* synthesizeKey
|
||||||
|
@ -1190,29 +1189,19 @@ function promiseNativeMouseEvent(aParams) {
|
||||||
return new Promise(resolve => synthesizeNativeMouseEvent(aParams, resolve));
|
return new Promise(resolve => synthesizeNativeMouseEvent(aParams, resolve));
|
||||||
}
|
}
|
||||||
|
|
||||||
function synthesizeNativeMouseClick(aParams, aObserver = null) {
|
function synthesizeNativeMouseEventAndWaitForEvent(aParams, aCallback) {
|
||||||
aParams.type = "click";
|
|
||||||
return synthesizeNativeMouseEvent(aParams, aObserver);
|
|
||||||
}
|
|
||||||
|
|
||||||
function promiseNativeMouseClick(aParams) {
|
|
||||||
aParams.type = "click";
|
|
||||||
return promiseNativeMouseEvent(aParams);
|
|
||||||
}
|
|
||||||
|
|
||||||
function synthesizeNativeMouseClickAndWaitForEvent(aParams, aCallback) {
|
|
||||||
const listener = aParams.eventTargetToListen || aParams.target;
|
const listener = aParams.eventTargetToListen || aParams.target;
|
||||||
const eventType = aParams.eventTypeToWait || "click";
|
const eventType = aParams.eventTypeToWait || aParams.type;
|
||||||
listener.addEventListener(eventType, aCallback, {
|
listener.addEventListener(eventType, aCallback, {
|
||||||
capture: true,
|
capture: true,
|
||||||
once: true,
|
once: true,
|
||||||
});
|
});
|
||||||
synthesizeNativeMouseClick(aParams);
|
synthesizeNativeMouseEvent(aParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
function promiseNativeMouseClickAndWaitForEvent(aParams) {
|
function promiseNativeMouseEventAndWaitForEvent(aParams) {
|
||||||
return new Promise(resolve =>
|
return new Promise(resolve =>
|
||||||
synthesizeNativeMouseClickAndWaitForEvent(aParams, resolve)
|
synthesizeNativeMouseEventAndWaitForEvent(aParams, resolve)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,8 @@ add_task(async function TestMouseClickWithControl() {
|
||||||
["contextmenu", 0, true],
|
["contextmenu", 0, true],
|
||||||
["mouseup", 0, true],
|
["mouseup", 0, true],
|
||||||
["click", 0, true]]);
|
["click", 0, true]]);
|
||||||
synthesizeNativeMouseClick({
|
synthesizeNativeMouseEvent({
|
||||||
|
type: "click",
|
||||||
target,
|
target,
|
||||||
offsetX: 10,
|
offsetX: 10,
|
||||||
offsetY: 10,
|
offsetY: 10,
|
||||||
|
@ -94,7 +95,8 @@ add_task(async function TestOldBehavior() {
|
||||||
["contextmenu", 2, true],
|
["contextmenu", 2, true],
|
||||||
["mouseup", 2, true],
|
["mouseup", 2, true],
|
||||||
["auxclick", 2, true]]);
|
["auxclick", 2, true]]);
|
||||||
synthesizeNativeMouseClick({
|
synthesizeNativeMouseEvent({
|
||||||
|
type: "click",
|
||||||
target,
|
target,
|
||||||
offsetX: 10,
|
offsetX: 10,
|
||||||
offsetY: 10,
|
offsetY: 10,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче