diff options
author | Andreu Botella <abb@randomunok.com> | 2021-12-10 15:12:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-10 15:12:38 +0100 |
commit | 0f0dd5b7ec2a7ac95e1b36c866f73b85e4fb4879 (patch) | |
tree | f06c37de813d82a82c556b977f7e5119e827362f /ext/web/03_abort_signal.js | |
parent | 292682772691402bb3c1e4fee554d85746147621 (diff) |
feat(ext/web): implement `AbortSignal.prototype.throwIfAborted()` (#13044)
See whatwg/dom#1034.
Diffstat (limited to 'ext/web/03_abort_signal.js')
-rw-r--r-- | ext/web/03_abort_signal.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/web/03_abort_signal.js b/ext/web/03_abort_signal.js index 6b278ba07..d46291b14 100644 --- a/ext/web/03_abort_signal.js +++ b/ext/web/03_abort_signal.js @@ -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"); |