Skip to content

Commit

Permalink
Bug 1676801 [wpt PR 26462] - Prototype of adding AbortController to a…
Browse files Browse the repository at this point in the history
…ddEventListener, a=testonly

Automatic update from web-platform-tests
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 <jarhar@chromium.org>
Reviewed-by: Mason Freed <masonfreed@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826659}

--

wpt-commits: 612b2ed03c8e59bcdbde7dea44bc467ca0623b44
wpt-pr: 26462
  • Loading branch information
josepharhar authored and moz-wptsync-bot committed Nov 13, 2020
1 parent a195d69 commit 6d8fa0e
Showing 1 changed file with 24 additions and 0 deletions.
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:jarhar@chromium.org">

<!-- 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>

0 comments on commit 6d8fa0e

Please sign in to comment.