Skip to content

Commit ac1d3f1

Browse files
committed
Add cleanup so that lone pointerdown events do get a pointerup
This is a workaround for https://bugs.webkit.org/show_bug.cgi?id=213060, a long-standing WebKit bug affecting the WebDriver Release Actions command.
1 parent 7705f9c commit ac1d3f1

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

event-timing/interactionid-aux-pointerdown-and-pointerdown.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
// pointerdown entry with a valid/non-trivial interactionId.
2222
promise_test(async t => {
2323
assert_implements(window.PerformanceEventTiming, 'Event Timing is not supported.');
24+
// Workaround https://bugs.webkit.org/show_bug.cgi?id=213060, which causes
25+
// WebKit-based browsers to never release the pointerdown, breaking
26+
// subsequent tests.
27+
t.add_cleanup(() => orphanAuxPointerup(document.getElementById('target')).catch(() => {}));
2428
// This test is not applicable to platforms like Windows where contextmenu
2529
// is triggered on aux pointerup. So we do a platform behavior test first to
2630
// distinguish and skip those platforms who do not dispatch contextmenu on

event-timing/interactionid-aux-pointerdown.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
// pointerdown entry with a valid/non-trivial interactionId.
2222
promise_test(async t => {
2323
assert_implements(window.PerformanceEventTiming, 'Event Timing is not supported.');
24+
// Workaround https://bugs.webkit.org/show_bug.cgi?id=213060, which causes
25+
// WebKit-based browsers to never release the pointerdown, breaking
26+
// subsequent tests.
27+
t.add_cleanup(() => orphanAuxPointerup(document.getElementById('target')).catch(() => {}));
2428
// This test is not applicable to platforms like Windows where contextmenu
2529
// is triggered on aux pointerup. So we do a platform behavior test first to
2630
// distinguish and skip those platforms who do not dispatch contextmenu on

event-timing/resources/event-timing-test-utils.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,20 @@ async function auxPointerdown(target) {
381381
.send();
382382
}
383383

384+
async function orphanAuxPointerup(target) {
385+
const actions = new test_driver.Actions();
386+
await actions.addPointer("mousePointer", "mouse")
387+
.pointerMove(0, 0, { origin: target })
388+
.pointerUp({ button: actions.ButtonType.RIGHT })
389+
.send();
390+
391+
// Orphan pointerup doesn't get triggered in some browsers. Sending a
392+
// non-pointer related event to make sure that at least an event gets handled.
393+
// If a browsers sends an orphan pointerup, it will always be before the
394+
// keydown, so the test will correctly handle it.
395+
await pressKey(target, 'a');
396+
}
397+
384398
// The testdriver.js, testdriver-vendor.js need to be included to use this
385399
// function.
386400
async function pressKey(target, key) {

0 commit comments

Comments
 (0)