Intent to Prototype: AbortSignal.prototype.throwIfAborted

77 views
Skip to first unread message

Scott Haseley

unread,
Jan 24, 2022, 2:16:39 PMJan 24
to blink-dev

Contact emails

shas...@chromium.org

Explainer

Discussion: https://github.com/whatwg/dom/issues/927
Examples/use cases: https://developer.mozilla.org/enUS/docs/Web/API/AbortSignal/throwIfAborted

Specification

https://dom.spec.whatwg.org/#dom-abortsignal-throwifaborted

Summary

Throws an AbortSignal's reason if the signal is aborted. This convenience method can be used by signal-handling functions to check a signal's abort status and propagate the abort reason, e.g. after async operations that might change a signal's state.



Blink component

Blink>DOM

Motivation

AbortSignal-handling functions often need to check the signal's status and propagate the error if the signal has been aborted. AbortSignal.throwIfAborted provides a convenient and consistent way to do this.



Initial public proposal



TAG review

N/A: the feature has been merged into the DOM standard and has been shipped in at least one other browser, in line with the criteria in https://groups.google.com/a/chromium.org/g/blink-dev/c/naqmDmy1iM8/m/lQAJ17CRAQAJ.

TAG review status

Not applicable

Risks



Interoperability and Compatibility



Gecko: Shipped/Shipping (https://bugzilla.mozilla.org/show_bug.cgi?id=1745372)

WebKit: Shipped/Shipping (https://bugs.webkit.org/show_bug.cgi?id=234127)

Web developers: No signals

Other signals:

Ergonomics

No risk; this feature is an ergonomic improvement for AbortSignal users.



Activation

The feature has already been implemented in both Safari and Firefox, but it would benefit from a polyfill for use in older browser versions.



Security

None.



Debuggability

Basic tooling only, i.e. autocomplete support for the new AbortSignal method will be provided.



Is this feature fully tested by web-platform-tests?

Yes.
Reply all
Reply to author
Forward
0 new messages