-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prototype of adding AbortController to addEventListener
I2P: https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/9396JedBBOM This feature adds a new AbortSignal option, named "signal", to the options parameter of addEventListener. This new option can be used to remove the event listener with an AbortController by calling abort(). More context: whatwg/dom#911 Bug: 1146467 Change-Id: I8ab1b93ec8be859c6876296fda4a9b808253c7d3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2527343 Commit-Queue: Joey Arhar <[email protected]> Reviewed-by: Mason Freed <[email protected]> Cr-Commit-Position: refs/heads/master@{#826659} GitOrigin-RevId: f0bbc3f3ab2bf91bea606fbc5fda751f5e60a0d3
- Loading branch information
1 parent
8e7a96f
commit 04477fa
Showing
7 changed files
with
64 additions
and
0 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
24 changes: 24 additions & 0 deletions
24
blink/web_tests/external/wpt/dom/abort/addEventListenerAbortController.tentative.html
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> | ||
<meta charset="utf-8"> | ||
<link rel="author" title="Joey Arhar" href="mailto:[email protected]"> | ||
|
||
<!-- This behavior has not been specified yet. See https://github.com/whatwg/dom/issues/911 --> | ||
|
||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
|
||
<body> | ||
|
||
<script> | ||
test(t => { | ||
const target = new EventTarget(); | ||
const controller = new AbortController(); | ||
|
||
target.addEventListener('testevent', t.step_func(() => { | ||
assert_unreached('testevent should have been canceled by AbortController'); | ||
}), {signal: controller.signal}); | ||
|
||
controller.abort(); | ||
target.dispatchEvent(new Event('testevent')); | ||
}, 'Tests support for EventController to cancel event listeners in addEventListener.'); | ||
</script> |