-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Close watchers: always fire cancel events
Sometimes they will have cancelable = false, but they will now always fire. See whatwg/html#10047. Bug: 41484805, 40054591 Change-Id: Ica682043fb56c729f4c331e9f3bd0590d3b1d088
- Loading branch information
1 parent
bfe3a92
commit fd1eb0c
Showing
39 changed files
with
266 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.