1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-25 15:29:32 -05:00

feat(ext/web): implement AbortSignal.prototype.throwIfAborted() (#13044)

See whatwg/dom#1034.
This commit is contained in:
Andreu Botella 2021-12-10 15:12:38 +01:00 committed by GitHub
parent 2926827726
commit 0f0dd5b7ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 10 deletions

View file

@ -85,6 +85,13 @@
webidl.assertBranded(this, AbortSignal);
return this[abortReason];
}
throwIfAborted() {
webidl.assertBranded(this, AbortSignal);
if (this[abortReason] !== undefined) {
throw this[abortReason];
}
}
}
defineEventHandler(AbortSignal.prototype, "abort");

View file

@ -293,6 +293,10 @@ interface AbortSignal extends EventTarget {
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void;
/** Throws this AbortSignal's abort reason, if its AbortController has
* signaled to abort; otherwise, does nothing. */
throwIfAborted(): void;
}
declare var AbortSignal: {

View file

@ -4799,16 +4799,8 @@
"abort": {
"AbortSignal.any.html": true,
"AbortSignal.any.worker.html": true,
"event.any.html": [
"throwIfAborted() should throw abort.reason if signal aborted",
"throwIfAborted() should throw primitive abort.reason if signal aborted",
"throwIfAborted() should not throw if signal not aborted"
],
"event.any.worker.html": [
"throwIfAborted() should throw abort.reason if signal aborted",
"throwIfAborted() should throw primitive abort.reason if signal aborted",
"throwIfAborted() should not throw if signal not aborted"
]
"event.any.html": true,
"event.any.worker.html": true
},
"events": {
"AddEventListenerOptions-once.any.html": [