summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/close-watcher
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/close-watcher')
-rw-r--r--testing/web-platform/tests/close-watcher/abortsignal.html4
-rw-r--r--testing/web-platform/tests/close-watcher/basic.html22
-rw-r--r--testing/web-platform/tests/close-watcher/esc-key/keypress.html2
-rw-r--r--testing/web-platform/tests/close-watcher/esc-key/keyup.html2
-rw-r--r--testing/web-platform/tests/close-watcher/esc-key/not-user-activation.html4
-rw-r--r--testing/web-platform/tests/close-watcher/inside-event-listeners.html24
-rw-r--r--testing/web-platform/tests/close-watcher/resources/helpers.js11
-rw-r--r--testing/web-platform/tests/close-watcher/user-activation/README.md25
-rw-r--r--testing/web-platform/tests/close-watcher/user-activation/n-activate-preventDefault.html4
-rw-r--r--testing/web-platform/tests/close-watcher/user-activation/n-activate.html2
-rw-r--r--testing/web-platform/tests/close-watcher/user-activation/n-closerequest-n.html4
-rw-r--r--testing/web-platform/tests/close-watcher/user-activation/n-destroy-n.html2
-rw-r--r--testing/web-platform/tests/close-watcher/user-activation/n.html2
-rw-r--r--testing/web-platform/tests/close-watcher/user-activation/nn-CloseWatcher.html (renamed from testing/web-platform/tests/close-watcher/user-activation/nn.html)6
-rw-r--r--testing/web-platform/tests/close-watcher/user-activation/nn-activate-CloseWatcher.html6
-rw-r--r--testing/web-platform/tests/close-watcher/user-activation/nn-activate-dialog.html16
-rw-r--r--testing/web-platform/tests/close-watcher/user-activation/nn-dialog.html24
-rw-r--r--testing/web-platform/tests/close-watcher/user-activation/nnn-CloseWatcher-dialog-popover.html2
-rw-r--r--testing/web-platform/tests/close-watcher/user-activation/nnn-CloseWatcher.html25
-rw-r--r--testing/web-platform/tests/close-watcher/user-activation/nnn-dialog.html (renamed from testing/web-platform/tests/close-watcher/user-activation/nnn.html)6
-rw-r--r--testing/web-platform/tests/close-watcher/user-activation/ny-activate-preventDefault.html6
-rw-r--r--testing/web-platform/tests/close-watcher/user-activation/ny.html4
-rw-r--r--testing/web-platform/tests/close-watcher/user-activation/nyn.html4
-rw-r--r--testing/web-platform/tests/close-watcher/user-activation/nynn-destroy.html4
-rw-r--r--testing/web-platform/tests/close-watcher/user-activation/nynn.html4
-rw-r--r--testing/web-platform/tests/close-watcher/user-activation/nyyn-CloseWatcher.html34
-rw-r--r--testing/web-platform/tests/close-watcher/user-activation/nyyn-dialog.html (renamed from testing/web-platform/tests/close-watcher/user-activation/nyyn.html)10
-rw-r--r--testing/web-platform/tests/close-watcher/user-activation/nyyyn-CloseWatcher.html38
-rw-r--r--testing/web-platform/tests/close-watcher/user-activation/nyyyn-dialog.html (renamed from testing/web-platform/tests/close-watcher/user-activation/nyyyn.html)12
-rw-r--r--testing/web-platform/tests/close-watcher/user-activation/y.html2
-rw-r--r--testing/web-platform/tests/close-watcher/user-activation/yn-activate.html4
-rw-r--r--testing/web-platform/tests/close-watcher/user-activation/yn.html4
-rw-r--r--testing/web-platform/tests/close-watcher/user-activation/ynn-CloseWatcher.html29
-rw-r--r--testing/web-platform/tests/close-watcher/user-activation/ynn-dialog.html (renamed from testing/web-platform/tests/close-watcher/user-activation/ynn.html)8
-rw-r--r--testing/web-platform/tests/close-watcher/user-activation/yy.html4
-rw-r--r--testing/web-platform/tests/close-watcher/user-activation/yyn.html6
-rw-r--r--testing/web-platform/tests/close-watcher/user-activation/yyy-CloseWatcher-dialog-popover.html4
-rw-r--r--testing/web-platform/tests/close-watcher/user-activation/yyy-activate-CloseWatcher-dialog-popover.html4
-rw-r--r--testing/web-platform/tests/close-watcher/user-activation/yyy.html6
39 files changed, 266 insertions, 114 deletions
diff --git a/testing/web-platform/tests/close-watcher/abortsignal.html b/testing/web-platform/tests/close-watcher/abortsignal.html
index 9229b37cf6..ec360f483d 100644
--- a/testing/web-platform/tests/close-watcher/abortsignal.html
+++ b/testing/web-platform/tests/close-watcher/abortsignal.html
@@ -49,7 +49,7 @@ test(() => {
watcher.requestClose();
controller.abort();
- assert_equals(oncancel_call_count_, 0);
+ assert_equals(oncancel_call_count_, 1);
assert_equals(onclose_call_count_, 1);
}, "requestClose() then abortController.abort() fires only one close event");
@@ -92,7 +92,7 @@ promise_test(async t => {
await sendCloseRequest();
controller.abort();
- assert_equals(oncancel_call_count_, 0);
+ assert_equals(oncancel_call_count_, 1);
assert_equals(onclose_call_count_, 1);
}, "Esc key then abortController.abort() fires only one close event");
diff --git a/testing/web-platform/tests/close-watcher/basic.html b/testing/web-platform/tests/close-watcher/basic.html
index 9951e54031..79a91e127e 100644
--- a/testing/web-platform/tests/close-watcher/basic.html
+++ b/testing/web-platform/tests/close-watcher/basic.html
@@ -14,8 +14,8 @@ test(t => {
watcher.requestClose();
- assert_array_equals(events, ["close"]);
-}, "requestClose() with no user activation only fires close");
+ assert_array_equals(events, ["cancel[cancelable=false]", "close"]);
+}, "requestClose() with no user activation");
test(t => {
let events = [];
@@ -25,7 +25,7 @@ test(t => {
watcher.requestClose();
assert_array_equals(events, []);
-}, "destroy() then requestClose() fires no events");
+}, "destroy() then requestClose()");
test(t => {
let events = [];
@@ -36,18 +36,18 @@ test(t => {
watcher.requestClose();
assert_array_equals(events, ["close"]);
-}, "close() then requestClose() fires only one close event");
+}, "close() then requestClose()");
test(t => {
let events = [];
let watcher = createRecordingCloseWatcher(t, events);
watcher.requestClose();
- assert_array_equals(events, ["close"]);
+ assert_array_equals(events, ["cancel[cancelable=false]", "close"]);
watcher.destroy();
- assert_array_equals(events, ["close"]);
-}, "requestClose() then destroy() fires only one close event");
+ assert_array_equals(events, ["cancel[cancelable=false]", "close"]);
+}, "requestClose() then destroy()");
test(t => {
let events = [];
@@ -58,7 +58,7 @@ test(t => {
watcher.destroy();
assert_array_equals(events, ["close"]);
-}, "close() then destroy() fires only one close event");
+}, "close() then destroy()");
promise_test(async t => {
let events = [];
@@ -68,7 +68,7 @@ promise_test(async t => {
await sendCloseRequest();
assert_array_equals(events, []);
-}, "destroy() then close request fires no events");
+}, "destroy() then close request");
promise_test(async t => {
let events = [];
@@ -77,6 +77,6 @@ promise_test(async t => {
await sendCloseRequest();
watcher.destroy();
- assert_array_equals(events, ["close"]);
-}, "Close request then destroy() fires only one close event");
+ assert_array_equals(events, ["cancel[cancelable=false]", "close"]);
+}, "Close request then destroy()");
</script>
diff --git a/testing/web-platform/tests/close-watcher/esc-key/keypress.html b/testing/web-platform/tests/close-watcher/esc-key/keypress.html
index 8dd58b064d..c3bfcc0c33 100644
--- a/testing/web-platform/tests/close-watcher/esc-key/keypress.html
+++ b/testing/web-platform/tests/close-watcher/esc-key/keypress.html
@@ -16,6 +16,6 @@ promise_test(async t => {
await sendEscKey();
- assert_array_equals(events, ["close"]);
+ assert_array_equals(events, ["cancel[cancelable=false]", "close"]);
}, "A keypress listener can NOT prevent the Esc keypress from being interpreted as a close request");
</script>
diff --git a/testing/web-platform/tests/close-watcher/esc-key/keyup.html b/testing/web-platform/tests/close-watcher/esc-key/keyup.html
index 341012d6bc..7c75ef7969 100644
--- a/testing/web-platform/tests/close-watcher/esc-key/keyup.html
+++ b/testing/web-platform/tests/close-watcher/esc-key/keyup.html
@@ -16,6 +16,6 @@ promise_test(async t => {
await sendEscKey();
- assert_array_equals(events, ["close"]);
+ assert_array_equals(events, ["cancel[cancelable=false]", "close"]);
}, "A keyup listener can NOT prevent the Esc keypress from being interpreted as a close request");
</script>
diff --git a/testing/web-platform/tests/close-watcher/esc-key/not-user-activation.html b/testing/web-platform/tests/close-watcher/esc-key/not-user-activation.html
index ac29f84f06..a8d5d22fcf 100644
--- a/testing/web-platform/tests/close-watcher/esc-key/not-user-activation.html
+++ b/testing/web-platform/tests/close-watcher/esc-key/not-user-activation.html
@@ -14,6 +14,6 @@ promise_test(async t => {
await sendEscKey();
- assert_array_equals(events, ["close"]);
-}, "Esc key does not count as user activation, so if it is the sole user interaction, that fires close but not cancel");
+ assert_array_equals(events, ["cancel[cancelable=false]", "close"]);
+}, "Esc key does not count as user activation, so if it is the sole user interaction, cancel is cancelable=false");
</script>
diff --git a/testing/web-platform/tests/close-watcher/inside-event-listeners.html b/testing/web-platform/tests/close-watcher/inside-event-listeners.html
index ac037fc147..47f431e250 100644
--- a/testing/web-platform/tests/close-watcher/inside-event-listeners.html
+++ b/testing/web-platform/tests/close-watcher/inside-event-listeners.html
@@ -17,10 +17,10 @@ promise_test(async t => {
await test_driver.bless("give user activation so that cancel will fire", () => {
watcher.requestClose();
});
- assert_array_equals(events, ["cancel"]);
+ assert_array_equals(events, ["cancel[cancelable=true]"]);
watcher.requestClose();
- assert_array_equals(events, ["cancel"], "since it was inactive, no more events fired");
+ assert_array_equals(events, ["cancel[cancelable=true]"], "since it was inactive, no more events fired");
}, "destroy() inside oncancel");
test(t => {
@@ -30,10 +30,10 @@ test(t => {
watcher.onclose = () => { watcher.destroy(); }
watcher.requestClose();
- assert_array_equals(events, ["close"]);
+ assert_array_equals(events, ["cancel[cancelable=false]", "close"]);
watcher.requestClose();
- assert_array_equals(events, ["close"], "since it was inactive, no more events fired");
+ assert_array_equals(events, ["cancel[cancelable=false]", "close"], "since it was inactive, no more events fired");
}, "destroy() inside onclose");
promise_test(async t => {
@@ -45,10 +45,10 @@ promise_test(async t => {
await test_driver.bless("give user activation so that cancel will fire", () => {
watcher.requestClose();
});
- assert_array_equals(events, ["cancel", "close"]);
+ assert_array_equals(events, ["cancel[cancelable=true]", "close"]);
watcher.requestClose();
- assert_array_equals(events, ["cancel", "close"], "since it was inactive, no more events fired");
+ assert_array_equals(events, ["cancel[cancelable=true]", "close"], "since it was inactive, no more events fired");
}, "close() inside oncancel");
test(t => {
@@ -58,10 +58,10 @@ test(t => {
watcher.onclose = () => { watcher.close(); }
watcher.requestClose();
- assert_array_equals(events, ["close"]);
+ assert_array_equals(events, ["cancel[cancelable=false]", "close"]);
watcher.requestClose();
- assert_array_equals(events, ["close"], "since it was inactive, no more events fired");
+ assert_array_equals(events, ["cancel[cancelable=false]", "close"], "since it was inactive, no more events fired");
}, "close() inside onclose");
promise_test(async t => {
@@ -73,10 +73,10 @@ promise_test(async t => {
await test_driver.bless("give user activation so that cancel will fire", () => {
watcher.requestClose();
});
- assert_array_equals(events, ["cancel", "close"]);
+ assert_array_equals(events, ["cancel[cancelable=true]", "close"]);
watcher.requestClose();
- assert_array_equals(events, ["cancel", "close"], "since it was inactive, no more events fired");
+ assert_array_equals(events, ["cancel[cancelable=true]", "close"], "since it was inactive, no more events fired");
}, "requestClose() inside oncancel");
test(t => {
@@ -86,9 +86,9 @@ test(t => {
watcher.onclose = () => { watcher.requestClose(); }
watcher.requestClose();
- assert_array_equals(events, ["close"]);
+ assert_array_equals(events, ["cancel[cancelable=false]", "close"]);
watcher.requestClose();
- assert_array_equals(events, ["close"], "since it was inactive, no more events fired");
+ assert_array_equals(events, ["cancel[cancelable=false]", "close"], "since it was inactive, no more events fired");
}, "requestClose() inside onclose");
</script>
diff --git a/testing/web-platform/tests/close-watcher/resources/helpers.js b/testing/web-platform/tests/close-watcher/resources/helpers.js
index dd9e191c4d..ad80c28847 100644
--- a/testing/web-platform/tests/close-watcher/resources/helpers.js
+++ b/testing/web-platform/tests/close-watcher/resources/helpers.js
@@ -26,9 +26,14 @@ window.createRecordingCloseWatcher = (t, events, name, type, parentWatcher) => {
t.add_cleanup(() => watcher.destroy());
}
- const prefix = name === undefined ? "" : name + " ";
- watcher.addEventListener('cancel', () => events.push(prefix + "cancel"));
- watcher.addEventListener('close', () => events.push(prefix + "close"));
+ const prefix = name === undefined ? '' : name + ' ';
+ watcher.addEventListener('cancel', e => {
+ const cancelable = e.cancelable ? '[cancelable=true]' : '[cancelable=false]';
+ events.push(prefix + 'cancel' + cancelable);
+ });
+ watcher.addEventListener('close', () => {
+ events.push(prefix + 'close');
+ });
return watcher;
};
diff --git a/testing/web-platform/tests/close-watcher/user-activation/README.md b/testing/web-platform/tests/close-watcher/user-activation/README.md
new file mode 100644
index 0000000000..b9aa9a2123
--- /dev/null
+++ b/testing/web-platform/tests/close-watcher/user-activation/README.md
@@ -0,0 +1,25 @@
+# Close watcher user activation tests
+
+These tests are all in separate files (or test variants) because we need to be
+sure we're starting from zero user activation.
+
+## Note on variants vs. `-dialog` and `-CloseWatcher` files
+
+We endeavor to have all the tests in these files cover both `<dialog>` elements
+and the `CloseWatcher` API. (And sometimes the `popover=""` attribute.)
+
+When the test expectations are the same for both `<dialog>` and `CloseWatcher`,
+we use WPT's variants feature.
+
+However, in some cases different expectations are necessary. This is because
+`<dialog>`s queue a task to fire their `close` event, and do not queue a task
+to fire their `cancel` event. Thus, when you have two `<dialog>`s grouped
+together, you get the somewhat-strange behavior of both `cancel`s firing first,
+then both `close`s. Whereas `CloseWatcher`s do not have this issue; both events
+fire synchronously.
+
+(Note that scheduling the `cancel` event for `<dialog>`s is not really possible,
+since it would then fire after the dialog has been closed in the DOM and
+visually. So the only reasonable fix for this would be to stop scheduling the
+`close` event for dialogs. That's risky from a compat standpoint, so for now,
+we test the strange behavior.)
diff --git a/testing/web-platform/tests/close-watcher/user-activation/n-activate-preventDefault.html b/testing/web-platform/tests/close-watcher/user-activation/n-activate-preventDefault.html
index 531ef42599..f413448718 100644
--- a/testing/web-platform/tests/close-watcher/user-activation/n-activate-preventDefault.html
+++ b/testing/web-platform/tests/close-watcher/user-activation/n-activate-preventDefault.html
@@ -22,10 +22,10 @@ promise_test(async t => {
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["cancel"]);
+ assert_array_equals(events, ["cancel[cancelable=true]"]);
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["cancel", "close"]);
+ assert_array_equals(events, ["cancel[cancelable=true]", "cancel[cancelable=false]", "close"]);
}, "Create a close watcher without user activation that preventDefault()s cancel; send user activation");
</script>
diff --git a/testing/web-platform/tests/close-watcher/user-activation/n-activate.html b/testing/web-platform/tests/close-watcher/user-activation/n-activate.html
index babcf54c3c..d8253ba765 100644
--- a/testing/web-platform/tests/close-watcher/user-activation/n-activate.html
+++ b/testing/web-platform/tests/close-watcher/user-activation/n-activate.html
@@ -22,6 +22,6 @@ promise_test(async t => {
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["cancel", "close"]);
+ assert_array_equals(events, ["cancel[cancelable=true]", "close"]);
}, "Create a close watcher without user activation; send user activation");
</script>
diff --git a/testing/web-platform/tests/close-watcher/user-activation/n-closerequest-n.html b/testing/web-platform/tests/close-watcher/user-activation/n-closerequest-n.html
index 2424af7820..54ccdd1abe 100644
--- a/testing/web-platform/tests/close-watcher/user-activation/n-closerequest-n.html
+++ b/testing/web-platform/tests/close-watcher/user-activation/n-closerequest-n.html
@@ -19,12 +19,12 @@ promise_test(async t => {
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher1 close"]);
+ assert_array_equals(events, ["watcher1 cancel[cancelable=false]", "watcher1 close"]);
createRecordingCloseWatcher(t, events, "watcher2", type);
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher1 close", "watcher2 close"]);
+ assert_array_equals(events, ["watcher1 cancel[cancelable=false]", "watcher1 close", "watcher2 cancel[cancelable=false]", "watcher2 close"]);
}, "Create a close watcher without user activation; send a close request; create a close watcher without user activation");
</script>
diff --git a/testing/web-platform/tests/close-watcher/user-activation/n-destroy-n.html b/testing/web-platform/tests/close-watcher/user-activation/n-destroy-n.html
index c26f87dd6f..e0a94f490e 100644
--- a/testing/web-platform/tests/close-watcher/user-activation/n-destroy-n.html
+++ b/testing/web-platform/tests/close-watcher/user-activation/n-destroy-n.html
@@ -26,6 +26,6 @@ promise_test(async t => {
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher2 close"]);
+ assert_array_equals(events, ["watcher2 cancel[cancelable=false]", "watcher2 close"]);
}, "Create a close watcher without user activation; destroy the close watcher; create a close watcher without user activation");
</script>
diff --git a/testing/web-platform/tests/close-watcher/user-activation/n.html b/testing/web-platform/tests/close-watcher/user-activation/n.html
index fe04e0dc1b..af8f972ee6 100644
--- a/testing/web-platform/tests/close-watcher/user-activation/n.html
+++ b/testing/web-platform/tests/close-watcher/user-activation/n.html
@@ -20,6 +20,6 @@ promise_test(async t => {
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["close"]);
+ assert_array_equals(events, ["cancel[cancelable=false]", "close"]);
}, "Create a close watcher without user activation");
</script>
diff --git a/testing/web-platform/tests/close-watcher/user-activation/nn.html b/testing/web-platform/tests/close-watcher/user-activation/nn-CloseWatcher.html
index beb63f1b4f..016745dfbb 100644
--- a/testing/web-platform/tests/close-watcher/user-activation/nn.html
+++ b/testing/web-platform/tests/close-watcher/user-activation/nn-CloseWatcher.html
@@ -1,6 +1,4 @@
<!doctype html>
-<meta name=variant content="?dialog">
-<meta name=variant content="?CloseWatcher">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
@@ -11,7 +9,7 @@
<body>
<script>
-const type = location.search.substring(1);
+const type = "CloseWatcher";
promise_test(async t => {
const events = [];
@@ -21,6 +19,6 @@ promise_test(async t => {
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher2 close", "watcher1 close"]);
+ assert_array_equals(events, ["watcher2 cancel[cancelable=false]", "watcher2 close", "watcher1 cancel[cancelable=false]", "watcher1 close"]);
}, "Create two close watchers without user activation");
</script>
diff --git a/testing/web-platform/tests/close-watcher/user-activation/nn-activate-CloseWatcher.html b/testing/web-platform/tests/close-watcher/user-activation/nn-activate-CloseWatcher.html
index 8045f30b48..45718e51a8 100644
--- a/testing/web-platform/tests/close-watcher/user-activation/nn-activate-CloseWatcher.html
+++ b/testing/web-platform/tests/close-watcher/user-activation/nn-activate-CloseWatcher.html
@@ -7,10 +7,6 @@
<script src="/common/top-layer.js"></script>
<script src="../resources/helpers.js"></script>
-<!--
- See note in sibling -dialog.html file.
--->
-
<body>
<script>
const type = "CloseWatcher";
@@ -25,6 +21,6 @@ promise_test(async t => {
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher2 cancel", "watcher2 close", "watcher1 cancel", "watcher1 close"]);
+ assert_array_equals(events, ["watcher2 cancel[cancelable=true]", "watcher2 close", "watcher1 cancel[cancelable=true]", "watcher1 close"]);
}, "Create two CloseWatchers without user activation; send user activation");
</script>
diff --git a/testing/web-platform/tests/close-watcher/user-activation/nn-activate-dialog.html b/testing/web-platform/tests/close-watcher/user-activation/nn-activate-dialog.html
index 5cc866044c..eaffb4d9a7 100644
--- a/testing/web-platform/tests/close-watcher/user-activation/nn-activate-dialog.html
+++ b/testing/web-platform/tests/close-watcher/user-activation/nn-activate-dialog.html
@@ -7,20 +7,6 @@
<script src="/common/top-layer.js"></script>
<script src="../resources/helpers.js"></script>
-<!--
- This test has different expectations for dialogs vs. CloseWatchers because
- dialogs queue a task to fire their close event, and do not do so for their
- cancel event. Thus, when you have two dialogs grouped together, you get the
- somewhat-strange behavior of both cancels firing first, then both closes.
- Whereas CloseWatchers do not have this issue; both fire synchronously.
-
- Note that scheduling the cancel event for dialogs is not really possible since
- it would then fire after the dialog has been closed in the DOM and visually.
- So the only reasonable fix for this would be to stop scheduling the close
- event for dialogs. That's risky from a compat standpoint, so for now, test the
- strange behavior.
--->
-
<body>
<script>
const type = "dialog";
@@ -35,6 +21,6 @@ promise_test(async t => {
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher2 cancel", "watcher1 cancel", "watcher2 close", "watcher1 close"]);
+ assert_array_equals(events, ["watcher2 cancel[cancelable=true]", "watcher1 cancel[cancelable=true]", "watcher2 close", "watcher1 close"]);
}, "Create two dialogs without user activation; send user activation");
</script>
diff --git a/testing/web-platform/tests/close-watcher/user-activation/nn-dialog.html b/testing/web-platform/tests/close-watcher/user-activation/nn-dialog.html
new file mode 100644
index 0000000000..0d086a525e
--- /dev/null
+++ b/testing/web-platform/tests/close-watcher/user-activation/nn-dialog.html
@@ -0,0 +1,24 @@
+<!doctype html>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resources/testdriver.js"></script>
+<script src="/resources/testdriver-vendor.js"></script>
+<script src="/resources/testdriver-actions.js"></script>
+<script src="/common/top-layer.js"></script>
+<script src="../resources/helpers.js"></script>
+
+<body>
+<script>
+const type = "dialog";
+
+promise_test(async t => {
+ const events = [];
+
+ createRecordingCloseWatcher(t, events, "watcher1", type);
+ createRecordingCloseWatcher(t, events, "watcher2", type);
+
+ await sendCloseRequest();
+ await waitForPotentialCloseEvent();
+ assert_array_equals(events, ["watcher2 cancel[cancelable=false]", "watcher1 cancel[cancelable=false]", "watcher2 close", "watcher1 close"]);
+}, "Create two close watchers without user activation");
+</script>
diff --git a/testing/web-platform/tests/close-watcher/user-activation/nnn-CloseWatcher-dialog-popover.html b/testing/web-platform/tests/close-watcher/user-activation/nnn-CloseWatcher-dialog-popover.html
index f8b9061d01..38dd607312 100644
--- a/testing/web-platform/tests/close-watcher/user-activation/nnn-CloseWatcher-dialog-popover.html
+++ b/testing/web-platform/tests/close-watcher/user-activation/nnn-CloseWatcher-dialog-popover.html
@@ -30,6 +30,6 @@ promise_test(async t => {
assert_false(popover.matches(':popover-open'), 'The popover should be closed.');
assert_false(dialog.hasAttribute('open'), 'The dialog should be closed.');
- assert_array_equals(events, ['CloseWatcher close', 'dialog close']);
+ assert_array_equals(events, ['dialog cancel[cancelable=false]', 'CloseWatcher cancel[cancelable=false]', 'CloseWatcher close', 'dialog close']);
}, 'Create a CloseWatcher without user activation; create a dialog without user activation; create a popover without user activation');
</script>
diff --git a/testing/web-platform/tests/close-watcher/user-activation/nnn-CloseWatcher.html b/testing/web-platform/tests/close-watcher/user-activation/nnn-CloseWatcher.html
new file mode 100644
index 0000000000..5d2f07e617
--- /dev/null
+++ b/testing/web-platform/tests/close-watcher/user-activation/nnn-CloseWatcher.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resources/testdriver.js"></script>
+<script src="/resources/testdriver-vendor.js"></script>
+<script src="/resources/testdriver-actions.js"></script>
+<script src="/common/top-layer.js"></script>
+<script src="../resources/helpers.js"></script>
+
+<body>
+<script>
+const type = "CloseWatcher";
+
+promise_test(async t => {
+ const events = [];
+
+ createRecordingCloseWatcher(t, events, "watcher1", type);
+ createRecordingCloseWatcher(t, events, "watcher2", type);
+ createRecordingCloseWatcher(t, events, "watcher3", type);
+
+ await sendCloseRequest();
+ await waitForPotentialCloseEvent();
+ assert_array_equals(events, ["watcher3 cancel[cancelable=false]", "watcher3 close", "watcher2 cancel[cancelable=false]", "watcher2 close", "watcher1 cancel[cancelable=false]", "watcher1 close"]);
+}, "Create three close watchers without user activation");
+</script>
diff --git a/testing/web-platform/tests/close-watcher/user-activation/nnn.html b/testing/web-platform/tests/close-watcher/user-activation/nnn-dialog.html
index 9b604e91db..f1c071dbb3 100644
--- a/testing/web-platform/tests/close-watcher/user-activation/nnn.html
+++ b/testing/web-platform/tests/close-watcher/user-activation/nnn-dialog.html
@@ -1,6 +1,4 @@
<!doctype html>
-<meta name=variant content="?dialog">
-<meta name=variant content="?CloseWatcher">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
@@ -11,7 +9,7 @@
<body>
<script>
-const type = location.search.substring(1);
+const type = "dialog";
promise_test(async t => {
const events = [];
@@ -22,6 +20,6 @@ promise_test(async t => {
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher3 close", "watcher2 close", "watcher1 close"]);
+ assert_array_equals(events, ["watcher3 cancel[cancelable=false]", "watcher2 cancel[cancelable=false]", "watcher1 cancel[cancelable=false]", "watcher3 close", "watcher2 close", "watcher1 close"]);
}, "Create three close watchers without user activation");
</script>
diff --git a/testing/web-platform/tests/close-watcher/user-activation/ny-activate-preventDefault.html b/testing/web-platform/tests/close-watcher/user-activation/ny-activate-preventDefault.html
index 5ffb64b113..7cd1c2e508 100644
--- a/testing/web-platform/tests/close-watcher/user-activation/ny-activate-preventDefault.html
+++ b/testing/web-platform/tests/close-watcher/user-activation/ny-activate-preventDefault.html
@@ -24,14 +24,14 @@ promise_test(async t => {
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher2 cancel"]);
+ assert_array_equals(events, ["watcher2 cancel[cancelable=true]"]);
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher2 cancel", "watcher2 close"]);
+ assert_array_equals(events, ["watcher2 cancel[cancelable=true]", "watcher2 cancel[cancelable=false]", "watcher2 close"]);
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher2 cancel", "watcher2 close", "watcher1 close"]);
+ assert_array_equals(events, ["watcher2 cancel[cancelable=true]", "watcher2 cancel[cancelable=false]", "watcher2 close", "watcher1 cancel[cancelable=false]", "watcher1 close"]);
}, "Create a close watcher without user activation; create a close watcher with user activation that preventDefault()s cancel; send user activation");
</script>
diff --git a/testing/web-platform/tests/close-watcher/user-activation/ny.html b/testing/web-platform/tests/close-watcher/user-activation/ny.html
index 226912233e..49f50a123e 100644
--- a/testing/web-platform/tests/close-watcher/user-activation/ny.html
+++ b/testing/web-platform/tests/close-watcher/user-activation/ny.html
@@ -21,10 +21,10 @@ promise_test(async t => {
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher2 close"]);
+ assert_array_equals(events, ["watcher2 cancel[cancelable=false]", "watcher2 close"]);
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher2 close", "watcher1 close"]);
+ assert_array_equals(events, ["watcher2 cancel[cancelable=false]", "watcher2 close", "watcher1 cancel[cancelable=false]", "watcher1 close"]);
}, "Create a close watcher without user activation; create a close watcher with user activation");
</script>
diff --git a/testing/web-platform/tests/close-watcher/user-activation/nyn.html b/testing/web-platform/tests/close-watcher/user-activation/nyn.html
index ec5153c767..b227d566d4 100644
--- a/testing/web-platform/tests/close-watcher/user-activation/nyn.html
+++ b/testing/web-platform/tests/close-watcher/user-activation/nyn.html
@@ -21,10 +21,10 @@ promise_test(async t => {
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher3 close", "watcher2 close"]);
+ assert_array_equals(events, ["watcher3 cancel[cancelable=false]", "watcher3 close", "watcher2 cancel[cancelable=false]", "watcher2 close"]);
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher3 close", "watcher2 close", "watcher1 close"]);
+ assert_array_equals(events, ["watcher3 cancel[cancelable=false]", "watcher3 close", "watcher2 cancel[cancelable=false]", "watcher2 close", "watcher1 cancel[cancelable=false]", "watcher1 close"]);
}, "Create a close watcher without user activation; create a close watcher with user activation; create a close watcher without user activation");
</script>
diff --git a/testing/web-platform/tests/close-watcher/user-activation/nynn-destroy.html b/testing/web-platform/tests/close-watcher/user-activation/nynn-destroy.html
index 8519c8a2a9..fb04109994 100644
--- a/testing/web-platform/tests/close-watcher/user-activation/nynn-destroy.html
+++ b/testing/web-platform/tests/close-watcher/user-activation/nynn-destroy.html
@@ -24,10 +24,10 @@ promise_test(async t => {
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher4 close", "watcher3 close"]);
+ assert_array_equals(events, ["watcher4 cancel[cancelable=false]", "watcher4 close", "watcher3 cancel[cancelable=false]", "watcher3 close"]);
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher4 close", "watcher3 close", "watcher1 close"]);
+ assert_array_equals(events, ["watcher4 cancel[cancelable=false]", "watcher4 close", "watcher3 cancel[cancelable=false]", "watcher3 close", "watcher1 cancel[cancelable=false]", "watcher1 close"]);
}, "Create a close watcher without user activation; create a close watcher with user activation; create two close watchers without user activation; remove the second close watcher");
</script>
diff --git a/testing/web-platform/tests/close-watcher/user-activation/nynn.html b/testing/web-platform/tests/close-watcher/user-activation/nynn.html
index f6e74a0ba1..ed9203db66 100644
--- a/testing/web-platform/tests/close-watcher/user-activation/nynn.html
+++ b/testing/web-platform/tests/close-watcher/user-activation/nynn.html
@@ -22,10 +22,10 @@ promise_test(async t => {
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher4 close", "watcher3 close", "watcher2 close"]);
+ assert_array_equals(events, ["watcher4 cancel[cancelable=false]", "watcher4 close", "watcher3 cancel[cancelable=false]", "watcher3 close", "watcher2 cancel[cancelable=false]", "watcher2 close"]);
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher4 close", "watcher3 close", "watcher2 close", "watcher1 close"]);
+ assert_array_equals(events, ["watcher4 cancel[cancelable=false]", "watcher4 close", "watcher3 cancel[cancelable=false]", "watcher3 close", "watcher2 cancel[cancelable=false]", "watcher2 close", "watcher1 cancel[cancelable=false]", "watcher1 close"]);
}, "Create a close watcher without user activation; create a close watcher with user activation; create two close watchers without user activation");
</script>
diff --git a/testing/web-platform/tests/close-watcher/user-activation/nyyn-CloseWatcher.html b/testing/web-platform/tests/close-watcher/user-activation/nyyn-CloseWatcher.html
new file mode 100644
index 0000000000..4f60ef3c4b
--- /dev/null
+++ b/testing/web-platform/tests/close-watcher/user-activation/nyyn-CloseWatcher.html
@@ -0,0 +1,34 @@
+<!doctype html>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resources/testdriver.js"></script>
+<script src="/resources/testdriver-vendor.js"></script>
+<script src="/resources/testdriver-actions.js"></script>
+<script src="/common/top-layer.js"></script>
+<script src="../resources/helpers.js"></script>
+
+<body>
+<script>
+const type = "CloseWatcher";
+
+promise_test(async t => {
+ const events = [];
+
+ const watcher1 = createRecordingCloseWatcher(t, events, "watcher1", type);
+ const watcher2 = await createBlessedRecordingCloseWatcher(t, events, "watcher2", type, watcher1);
+ const watcher3 = await createBlessedRecordingCloseWatcher(t, events, "watcher3", type, watcher2);
+ createRecordingCloseWatcher(t, events, "watcher4", type);
+
+ await sendCloseRequest();
+ await waitForPotentialCloseEvent();
+ assert_array_equals(events, ["watcher4 cancel[cancelable=false]", "watcher4 close", "watcher3 cancel[cancelable=false]", "watcher3 close"]);
+
+ await sendCloseRequest();
+ await waitForPotentialCloseEvent();
+ assert_array_equals(events, ["watcher4 cancel[cancelable=false]", "watcher4 close", "watcher3 cancel[cancelable=false]", "watcher3 close", "watcher2 cancel[cancelable=false]", "watcher2 close"]);
+
+ await sendCloseRequest();
+ await waitForPotentialCloseEvent();
+ assert_array_equals(events, ["watcher4 cancel[cancelable=false]", "watcher4 close", "watcher3 cancel[cancelable=false]", "watcher3 close", "watcher2 cancel[cancelable=false]", "watcher2 close", "watcher1 cancel[cancelable=false]", "watcher1 close"]);
+}, "Create a close watcher without user activation; create two close watchers with user activation; create a close watcher without user activation");
+</script>
diff --git a/testing/web-platform/tests/close-watcher/user-activation/nyyn.html b/testing/web-platform/tests/close-watcher/user-activation/nyyn-dialog.html
index f3987c1a21..44926fd5c3 100644
--- a/testing/web-platform/tests/close-watcher/user-activation/nyyn.html
+++ b/testing/web-platform/tests/close-watcher/user-activation/nyyn-dialog.html
@@ -1,6 +1,4 @@
<!doctype html>
-<meta name=variant content="?dialog">
-<meta name=variant content="?CloseWatcher">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
@@ -11,7 +9,7 @@
<body>
<script>
-const type = location.search.substring(1);
+const type = "dialog";
promise_test(async t => {
const events = [];
@@ -23,14 +21,14 @@ promise_test(async t => {
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher4 close", "watcher3 close"]);
+ assert_array_equals(events, ["watcher4 cancel[cancelable=false]", "watcher3 cancel[cancelable=false]", "watcher4 close", "watcher3 close"]);
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher4 close", "watcher3 close", "watcher2 close"]);
+ assert_array_equals(events, ["watcher4 cancel[cancelable=false]", "watcher3 cancel[cancelable=false]", "watcher4 close", "watcher3 close", "watcher2 cancel[cancelable=false]", "watcher2 close"]);
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher4 close", "watcher3 close", "watcher2 close", "watcher1 close"]);
+ assert_array_equals(events, ["watcher4 cancel[cancelable=false]", "watcher3 cancel[cancelable=false]", "watcher4 close", "watcher3 close", "watcher2 cancel[cancelable=false]", "watcher2 close", "watcher1 cancel[cancelable=false]", "watcher1 close"]);
}, "Create a close watcher without user activation; create two close watchers with user activation; create a close watcher without user activation");
</script>
diff --git a/testing/web-platform/tests/close-watcher/user-activation/nyyyn-CloseWatcher.html b/testing/web-platform/tests/close-watcher/user-activation/nyyyn-CloseWatcher.html
new file mode 100644
index 0000000000..e2565a82a3
--- /dev/null
+++ b/testing/web-platform/tests/close-watcher/user-activation/nyyyn-CloseWatcher.html
@@ -0,0 +1,38 @@
+<!doctype html>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resources/testdriver.js"></script>
+<script src="/resources/testdriver-vendor.js"></script>
+<script src="/resources/testdriver-actions.js"></script>
+<script src="/common/top-layer.js"></script>
+<script src="../resources/helpers.js"></script>
+
+<body>
+<script>
+const type = "CloseWatcher";
+
+promise_test(async t => {
+ const events = [];
+ const watcher1 = createRecordingCloseWatcher(t, events, "watcher1", type);
+ const watcher2 = await createBlessedRecordingCloseWatcher(t, events, "watcher2", type, watcher1);
+ const watcher3 = await createBlessedRecordingCloseWatcher(t, events, "watcher3", type, watcher2);
+ await createBlessedRecordingCloseWatcher(t, events, "watcher4", type, watcher3);
+ createRecordingCloseWatcher(t, events, "watcher5", type);
+
+ await sendCloseRequest();
+ await waitForPotentialCloseEvent();
+ assert_array_equals(events, ["watcher5 cancel[cancelable=false]", "watcher5 close", "watcher4 cancel[cancelable=false]", "watcher4 close"]);
+
+ await sendCloseRequest();
+ await waitForPotentialCloseEvent();
+ assert_array_equals(events, ["watcher5 cancel[cancelable=false]", "watcher5 close", "watcher4 cancel[cancelable=false]", "watcher4 close", "watcher3 cancel[cancelable=false]", "watcher3 close"]);
+
+ await sendCloseRequest();
+ await waitForPotentialCloseEvent();
+ assert_array_equals(events, ["watcher5 cancel[cancelable=false]", "watcher5 close", "watcher4 cancel[cancelable=false]", "watcher4 close", "watcher3 cancel[cancelable=false]", "watcher3 close", "watcher2 cancel[cancelable=false]", "watcher2 close"]);
+
+ await sendCloseRequest();
+ await waitForPotentialCloseEvent();
+ assert_array_equals(events, ["watcher5 cancel[cancelable=false]", "watcher5 close", "watcher4 cancel[cancelable=false]", "watcher4 close", "watcher3 cancel[cancelable=false]", "watcher3 close", "watcher2 cancel[cancelable=false]", "watcher2 close", "watcher1 cancel[cancelable=false]", "watcher1 close"]);
+}, "Create a close watcher without user activation; create three close watchers with user activation; create a close watcher without user activation");
+</script>
diff --git a/testing/web-platform/tests/close-watcher/user-activation/nyyyn.html b/testing/web-platform/tests/close-watcher/user-activation/nyyyn-dialog.html
index 6cb8f3a445..86361124d3 100644
--- a/testing/web-platform/tests/close-watcher/user-activation/nyyyn.html
+++ b/testing/web-platform/tests/close-watcher/user-activation/nyyyn-dialog.html
@@ -1,6 +1,4 @@
<!doctype html>
-<meta name=variant content="?dialog">
-<meta name=variant content="?CloseWatcher">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
@@ -11,7 +9,7 @@
<body>
<script>
-const type = location.search.substring(1);
+const type = "dialog";
promise_test(async t => {
const events = [];
@@ -23,18 +21,18 @@ promise_test(async t => {
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher5 close", "watcher4 close"]);
+ assert_array_equals(events, ["watcher5 cancel[cancelable=false]", "watcher4 cancel[cancelable=false]", "watcher5 close", "watcher4 close"]);
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher5 close", "watcher4 close", "watcher3 close"]);
+ assert_array_equals(events, ["watcher5 cancel[cancelable=false]", "watcher4 cancel[cancelable=false]", "watcher5 close", "watcher4 close", "watcher3 cancel[cancelable=false]", "watcher3 close"]);
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher5 close", "watcher4 close", "watcher3 close", "watcher2 close"]);
+ assert_array_equals(events, ["watcher5 cancel[cancelable=false]", "watcher4 cancel[cancelable=false]", "watcher5 close", "watcher4 close", "watcher3 cancel[cancelable=false]", "watcher3 close", "watcher2 cancel[cancelable=false]", "watcher2 close"]);
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher5 close", "watcher4 close", "watcher3 close", "watcher2 close", "watcher1 close"]);
+ assert_array_equals(events, ["watcher5 cancel[cancelable=false]", "watcher4 cancel[cancelable=false]", "watcher5 close", "watcher4 close", "watcher3 cancel[cancelable=false]", "watcher3 close", "watcher2 cancel[cancelable=false]", "watcher2 close", "watcher1 cancel[cancelable=false]", "watcher1 close"]);
}, "Create a close watcher without user activation; create three close watchers with user activation; create a close watcher without user activation");
</script>
diff --git a/testing/web-platform/tests/close-watcher/user-activation/y.html b/testing/web-platform/tests/close-watcher/user-activation/y.html
index ee58a92293..78c432de38 100644
--- a/testing/web-platform/tests/close-watcher/user-activation/y.html
+++ b/testing/web-platform/tests/close-watcher/user-activation/y.html
@@ -20,6 +20,6 @@ promise_test(async t => {
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["cancel", "close"]);
+ assert_array_equals(events, ["cancel[cancelable=true]", "close"]);
}, "Create a close watcher with user activation");
</script>
diff --git a/testing/web-platform/tests/close-watcher/user-activation/yn-activate.html b/testing/web-platform/tests/close-watcher/user-activation/yn-activate.html
index af7289aa28..d62b4df425 100644
--- a/testing/web-platform/tests/close-watcher/user-activation/yn-activate.html
+++ b/testing/web-platform/tests/close-watcher/user-activation/yn-activate.html
@@ -23,10 +23,10 @@ promise_test(async t => {
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher2 cancel", "watcher2 close"]);
+ assert_array_equals(events, ["watcher2 cancel[cancelable=true]", "watcher2 close"]);
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher2 cancel", "watcher2 close", "watcher1 cancel", "watcher1 close"]);
+ assert_array_equals(events, ["watcher2 cancel[cancelable=true]", "watcher2 close", "watcher1 cancel[cancelable=true]", "watcher1 close"]);
}, "Create a close watcher with user activation; create a close watcher without user activation; send user activation");
</script>
diff --git a/testing/web-platform/tests/close-watcher/user-activation/yn.html b/testing/web-platform/tests/close-watcher/user-activation/yn.html
index 8f7e90e2d8..578f43de25 100644
--- a/testing/web-platform/tests/close-watcher/user-activation/yn.html
+++ b/testing/web-platform/tests/close-watcher/user-activation/yn.html
@@ -21,10 +21,10 @@ promise_test(async t => {
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher2 close"]);
+ assert_array_equals(events, ["watcher2 cancel[cancelable=false]", "watcher2 close"]);
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher2 close", "watcher1 close"]);
+ assert_array_equals(events, ["watcher2 cancel[cancelable=false]", "watcher2 close", "watcher1 cancel[cancelable=false]", "watcher1 close"]);
}, "Create a close watcher with user activation; create a close watcher without user activation");
</script>
diff --git a/testing/web-platform/tests/close-watcher/user-activation/ynn-CloseWatcher.html b/testing/web-platform/tests/close-watcher/user-activation/ynn-CloseWatcher.html
new file mode 100644
index 0000000000..50b5a8131d
--- /dev/null
+++ b/testing/web-platform/tests/close-watcher/user-activation/ynn-CloseWatcher.html
@@ -0,0 +1,29 @@
+<!doctype html>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resources/testdriver.js"></script>
+<script src="/resources/testdriver-vendor.js"></script>
+<script src="/resources/testdriver-actions.js"></script>
+<script src="/common/top-layer.js"></script>
+<script src="../resources/helpers.js"></script>
+
+<body>
+<script>
+const type = "CloseWatcher";
+
+promise_test(async t => {
+ const events = [];
+
+ await createBlessedRecordingCloseWatcher(t, events, "watcher1", type);
+ createRecordingCloseWatcher(t, events, "watcher2", type);
+ createRecordingCloseWatcher(t, events, "watcher3", type);
+
+ await sendCloseRequest();
+ await waitForPotentialCloseEvent();
+ assert_array_equals(events, ["watcher3 cancel[cancelable=false]", "watcher3 close", "watcher2 cancel[cancelable=false]", "watcher2 close"]);
+
+ await sendCloseRequest();
+ await waitForPotentialCloseEvent();
+ assert_array_equals(events, ["watcher3 cancel[cancelable=false]", "watcher3 close", "watcher2 cancel[cancelable=false]", "watcher2 close", "watcher1 cancel[cancelable=false]", "watcher1 close"]);
+}, "Create a close watcher with user activation; create two close watchers without user activation");
+</script>
diff --git a/testing/web-platform/tests/close-watcher/user-activation/ynn.html b/testing/web-platform/tests/close-watcher/user-activation/ynn-dialog.html
index 8cc7f5bfb6..c10e94dc73 100644
--- a/testing/web-platform/tests/close-watcher/user-activation/ynn.html
+++ b/testing/web-platform/tests/close-watcher/user-activation/ynn-dialog.html
@@ -1,6 +1,4 @@
<!doctype html>
-<meta name=variant content="?dialog">
-<meta name=variant content="?CloseWatcher">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
@@ -11,7 +9,7 @@
<body>
<script>
-const type = location.search.substring(1);
+const type = "dialog";
promise_test(async t => {
const events = [];
@@ -22,10 +20,10 @@ promise_test(async t => {
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher3 close", "watcher2 close"]);
+ assert_array_equals(events, ["watcher3 cancel[cancelable=false]", "watcher2 cancel[cancelable=false]", "watcher3 close", "watcher2 close"]);
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher3 close", "watcher2 close", "watcher1 close"]);
+ assert_array_equals(events, ["watcher3 cancel[cancelable=false]", "watcher2 cancel[cancelable=false]", "watcher3 close", "watcher2 close", "watcher1 cancel[cancelable=false]", "watcher1 close"]);
}, "Create a close watcher with user activation; create two close watchers without user activation");
</script>
diff --git a/testing/web-platform/tests/close-watcher/user-activation/yy.html b/testing/web-platform/tests/close-watcher/user-activation/yy.html
index 0aa03cdd05..9c0f21be22 100644
--- a/testing/web-platform/tests/close-watcher/user-activation/yy.html
+++ b/testing/web-platform/tests/close-watcher/user-activation/yy.html
@@ -21,10 +21,10 @@ promise_test(async t => {
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher2 cancel", "watcher2 close"]);
+ assert_array_equals(events, ["watcher2 cancel[cancelable=true]", "watcher2 close"]);
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher2 cancel", "watcher2 close", "watcher1 cancel", "watcher1 close"]);
+ assert_array_equals(events, ["watcher2 cancel[cancelable=true]", "watcher2 close", "watcher1 cancel[cancelable=true]", "watcher1 close"]);
}, "Create two close watchers with user activation");
</script>
diff --git a/testing/web-platform/tests/close-watcher/user-activation/yyn.html b/testing/web-platform/tests/close-watcher/user-activation/yyn.html
index b87cf7a7e3..2f75377444 100644
--- a/testing/web-platform/tests/close-watcher/user-activation/yyn.html
+++ b/testing/web-platform/tests/close-watcher/user-activation/yyn.html
@@ -22,14 +22,14 @@ promise_test(async t => {
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher3 close"]);
+ assert_array_equals(events, ["watcher3 cancel[cancelable=false]", "watcher3 close"]);
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher3 close", "watcher2 close"]);
+ assert_array_equals(events, ["watcher3 cancel[cancelable=false]", "watcher3 close", "watcher2 cancel[cancelable=false]", "watcher2 close"]);
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher3 close", "watcher2 close", "watcher1 close"]);
+ assert_array_equals(events, ["watcher3 cancel[cancelable=false]", "watcher3 close", "watcher2 cancel[cancelable=false]", "watcher2 close", "watcher1 cancel[cancelable=false]", "watcher1 close"]);
}, "Create two close watchers with user activation; create a close watcher without user activation");
</script>
diff --git a/testing/web-platform/tests/close-watcher/user-activation/yyy-CloseWatcher-dialog-popover.html b/testing/web-platform/tests/close-watcher/user-activation/yyy-CloseWatcher-dialog-popover.html
index f0a1cb06d1..8650fb3b7c 100644
--- a/testing/web-platform/tests/close-watcher/user-activation/yyy-CloseWatcher-dialog-popover.html
+++ b/testing/web-platform/tests/close-watcher/user-activation/yyy-CloseWatcher-dialog-popover.html
@@ -35,12 +35,12 @@ promise_test(async t => {
await waitForPotentialCloseEvent();
assert_false(popover.matches(':popover-open'), 'Second close request: The popover should be closed.');
assert_false(dialog.hasAttribute('open'), 'Second close request: The dialog should be closed.');
- assert_array_equals(events, ['dialog cancel', 'dialog close']);
+ assert_array_equals(events, ['dialog cancel[cancelable=true]', 'dialog close']);
await sendCloseRequest();
await waitForPotentialCloseEvent();
assert_false(popover.matches(':popover-open'), 'Third close request: The popover should be closed.');
assert_false(dialog.hasAttribute('open'), 'Third close request: The dialog should be closed.');
- assert_array_equals(events, ['dialog cancel', 'dialog close', 'CloseWatcher cancel', 'CloseWatcher close']);
+ assert_array_equals(events, ['dialog cancel[cancelable=true]', 'dialog close', 'CloseWatcher cancel[cancelable=true]', 'CloseWatcher close']);
}, 'Create a CloseWatcher with user activation; create a dialog with user activation; create a popover with user activation');
</script>
diff --git a/testing/web-platform/tests/close-watcher/user-activation/yyy-activate-CloseWatcher-dialog-popover.html b/testing/web-platform/tests/close-watcher/user-activation/yyy-activate-CloseWatcher-dialog-popover.html
index ed41d1bc32..a58dd0751b 100644
--- a/testing/web-platform/tests/close-watcher/user-activation/yyy-activate-CloseWatcher-dialog-popover.html
+++ b/testing/web-platform/tests/close-watcher/user-activation/yyy-activate-CloseWatcher-dialog-popover.html
@@ -37,13 +37,13 @@ promise_test(async t => {
await waitForPotentialCloseEvent();
assert_false(popover.matches(':popover-open'), 'Second close request: The popover should be closed.');
assert_false(dialog.hasAttribute('open'), 'Second close request: The dialog should be closed.');
- assert_array_equals(events, ['dialog cancel', 'dialog close']);
+ assert_array_equals(events, ['dialog cancel[cancelable=true]', 'dialog close']);
await test_driver.bless();
await sendCloseRequest();
await waitForPotentialCloseEvent();
assert_false(popover.matches(':popover-open'), 'Third close request: The popover should be closed.');
assert_false(dialog.hasAttribute('open'), 'Third close request: The dialog should be closed.');
- assert_array_equals(events, ['dialog cancel', 'dialog close', 'CloseWatcher cancel', 'CloseWatcher close']);
+ assert_array_equals(events, ['dialog cancel[cancelable=true]', 'dialog close', 'CloseWatcher cancel[cancelable=true]', 'CloseWatcher close']);
}, 'Create a CloseWatcher with user activation; create a dialog with user activation; create a popover with user activation; sending user activation before each close request');
</script>
diff --git a/testing/web-platform/tests/close-watcher/user-activation/yyy.html b/testing/web-platform/tests/close-watcher/user-activation/yyy.html
index f16767a86b..eaf8944bce 100644
--- a/testing/web-platform/tests/close-watcher/user-activation/yyy.html
+++ b/testing/web-platform/tests/close-watcher/user-activation/yyy.html
@@ -22,14 +22,14 @@ promise_test(async t => {
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher3 cancel", "watcher3 close"]);
+ assert_array_equals(events, ["watcher3 cancel[cancelable=true]", "watcher3 close"]);
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher3 cancel", "watcher3 close", "watcher2 cancel", "watcher2 close"]);
+ assert_array_equals(events, ["watcher3 cancel[cancelable=true]", "watcher3 close", "watcher2 cancel[cancelable=true]", "watcher2 close"]);
await sendCloseRequest();
await waitForPotentialCloseEvent();
- assert_array_equals(events, ["watcher3 cancel", "watcher3 close", "watcher2 cancel", "watcher2 close", "watcher1 cancel", "watcher1 close"]);
+ assert_array_equals(events, ["watcher3 cancel[cancelable=true]", "watcher3 close", "watcher2 cancel[cancelable=true]", "watcher2 close", "watcher1 cancel[cancelable=true]", "watcher1 close"]);
}, "Create three close watchers with user activation");
</script>