-
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.
AbortSignal.timeout is a static method that creates a new AbortSignal that is automatically aborted after a specified duration. The implementation is essentially PostDelayedTask(SignalAbort, ms). Throttling: this API is specced to use the timer task source, but there are three internally due to our throttling implementation. We use immediate for the timeout == 0 case and high nesting for timeount > 0 (the typical case), i.e. all non-zero timeouts are eligible for throttling (Note: this matches scheduler.postTask()). Spec PR: whatwg/dom#1032 I2P: https://groups.google.com/a/chromium.org/g/blink-dev/c/9Y290P1WimY/m/bru989iAAgAJ Bug: 1181925 Change-Id: I192d82a8bf12c368abcd47ae6c50e80f50654cf9
- Loading branch information
1 parent
8ad3b53
commit 726ac4b
Showing
2 changed files
with
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE HTML> | ||
<meta charset=utf-8> | ||
<title>AbortSignal.timeout frame detach</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<iframe id="iframe"></iframe> | ||
<script> | ||
async_test(t => { | ||
const signal = iframe.contentWindow.AbortSignal.timeout(5); | ||
signal.onabort = t.unreached_func("abort must not fire"); | ||
|
||
iframe.remove(); | ||
|
||
t.step_timeout(() => { | ||
assert_false(signal.aborted); | ||
t.done(); | ||
}, 10); | ||
}, "Signal returned by AbortSignal.timeout() is not aborted after frame detach"); | ||
</script> |