?ue/p1-90`This proposal brings a subset of WHATWG DOM's AbortController and AbortSignal into ECMAScript, so that ECMAScript (and other specifications) can use them without depending on the rest of the web platform (in particular EventTarget and DOMException).
For AbortSignal.prototype.addAbortCallback (see whatwg/dom#1425). Web-platform-specific behaviour is provided through
DOMException whose name is abort event).onabort and AbortSignal.timeout. See
Atomics.waitAsync now accepts an options object with optional timeout and signal properties, allowing an asynchronous wait to be aborted. In addition, Atomics.wait and Atomics.waitAsync now throw a
See the proposal repository for background material and discussion.
Open questions and known deviations from the DOM specification:
addAbortCallback returns a disposable registration object whose remove and [Symbol.dispose] properties initially refer to the same method for unregistering the callback. In whatwg/dom#1425, addAbortCallback currently returns addAbortCallback calls the callback and then throws the signal's abort reason. In whatwg/dom#1425, it calls the callback and returns normally.AbortSignal.any closes its argument's abort event listener when it adopts these operations. Both rules are consistent with this specification, but neither is needed for aborts to be delivered correctly: when a timeout expires, its signal must be aborted whenever that would be observable, including through abort callbacks or dependent signals.| Intrinsic Name | Global Name | ECMAScript Language Association |
|---|---|---|
| The prototype of |
||
The AbortController |
||
The AbortSignal |
See
See
An
As with any other object, an implementation may reclaim the memory used by an
If a signal can still be aborted, the implementation must preserve every observable effect of that abort. Even if user code has dropped its last reference to the signal, a later abort must still run its registered abort algorithms and, on the web, dispatch its abort event. For example:
AbortSignal.any([longLived, perRequest]) is called once per request. Each resulting longLived.[[DependentSignals]], even while longLived is still in use. Otherwise a long-lived signal would accumulate every addAbortCallback, aborting one of its sources must still invoke that callback.The DOM garbage collection rule for dependent signals is one way to implement this.
Unlike other built-in objects in this specification, every function-valued
This matches the Web IDL conventions which existing implementations of these classes follow.
The abstract operation CreateAbortSignal takes argument realm (a
The abstract operation IsAborted takes argument signal (an
An Abort Algorithm Registration Record represents a registration of an algorithm on an
Abort Algorithm Registration Records have the fields listed in
| Field Name | Value | Meaning |
|---|---|---|
| [[Signal]] | an |
The signal on which the algorithm is registered, or |
| [[Algorithm]] | an |
The algorithm to perform when [[Signal]] is aborted, or |
The abstract operation AddAbortAlgorithm takes arguments signal (an
If signal is already aborted, algorithm is not registered and will never be performed. Callers usually need to handle that case, either by checking
The abstract operation RemoveAbortAlgorithm takes argument entry (an
The abstract operation SignalAbort takes arguments signal (an
A
The abstract operation RunAbortSteps takes argument signal (an
By the time a source signal's first abort algorithm runs, every previously unaborted signal that depends on it already has the same abort reason.
Callbacks registered with addAbortCallback and abort algorithms added by
Each algorithm is removed before it is performed, so an algorithm removed by an earlier one (for example, by disposing an
The abstract operation CreateDependentAbortSignal takes arguments signals (a TaskSignal. This operation may be invoked by other specifications. It performs the following steps when called:
A
For when an implementation can discard dependent signals and the links between signals, see the note in
The [[Prototype]] internal slots of
A
On the web platform, AbortSignal.prototype.onabort and AbortSignal.timeout.
The
An implementation of HostCreateAbortCallbackAlgorithm must not evaluate any ECMAScript code. Each time the returned closure is performed, it must synchronously call callback once with
The default implementation of HostCreateAbortCallbackAlgorithm performs the following steps when called:
On the web platform, the
The
An implementation of HostCreateAbortError must conform to the following requirements:
The default implementation of HostCreateAbortError performs the following steps when called:
On the web platform, the DOMException. Accessors on DOMException.prototype expose those values.
The
An implementation of HostInitializeAbortController must not evaluate any ECMAScript code or modify the internal slots specified by ECMAScript.
The default implementation of HostInitializeAbortController is to return
Web IDL can use
The
An implementation of HostInitializeAbortSignal must not evaluate any ECMAScript code or modify the internal slots specified by ECMAScript.
The default implementation of HostInitializeAbortSignal is to return
Web IDL can use Request.prototype.clone creates its EventTarget, including its event listener list.
The
The default implementation of HostAbortSignalAborted is to return
On the web platform, this fires an event named abort at signal. Listeners for that event run after all abort algorithms (including callbacks registered with addAbortCallback), as they do today.
The AbortController
extends clause of a class definition. Subclass AbortController behaviour must include a super call to the AbortController AbortController.prototype.This function performs the following steps when called:
The
The initial value of AbortController.prototype is the
This property has the attributes { [[Writable]]:
The AbortController prototype object:
This method performs the following steps when called:
If reason is
The initial value of AbortController.prototype.constructor is
AbortController.prototype.signal is an
The initial value of the
This property has the attributes { [[Writable]]:
| Internal Slot | Type | Description |
|---|---|---|
| [[Signal]] | an |
The signal which this controller aborts. |
The AbortSignal
AbortController, AbortSignal.abort, AbortSignal.any, or by the This function performs the following steps when called:
The
This function returns a new
This function returns a new
The initial value of AbortSignal.prototype is the
This property has the attributes { [[Writable]]:
The AbortSignal prototype object:
This method registers callback to be called when the signal is aborted, and returns an
The callback is called with
When the signal is already aborted, the callback is called before the abort reason is thrown, so that cleanup the callback performs (such as releasing a resource acquired just before registering it) still happens. An exception thrown by the callback is handled as described in
Unlike with addEventListener, registering the same function multiple times causes it to be called multiple times. The signal retains the callback until it runs or is unregistered, but does not retain the public registration object, so that object can be collected while the callback is still pending.
AbortSignal.prototype.aborted is an
The initial value of AbortSignal.prototype.constructor is
AbortSignal.prototype.reason is an
This method performs the following steps when called:
The initial value of the
This property has the attributes { [[Writable]]:
| Internal Slot | Type | Description |
|---|---|---|
| [[AbortReason]] | an |
The reason the signal was aborted, or |
| [[AbortAlgorithms]] | a |
The registrations to run in insertion order when the signal is aborted. |
| [[SourceSignals]] | a |
|
| [[DependentSignals]] | a |
The dependent signals which depend on this signal. |
An abort callback registration is an object returned by AbortSignal.prototype.addAbortCallback. Disposing it unregisters the corresponding callback. There is no
The %AbortCallbackRegistrationPrototype% object:
This method unregisters the callback if it has not yet been called. It performs the following steps when called:
The initial value of the %Symbol.dispose% property is %AbortCallbackRegistrationPrototype.remove%, defined in
This allows using declarations to scope a callback registration to a block. If signal is already aborted, addAbortCallback closes the connection and throws the abort reason, so the request is never sent:
async function doWork(signal, connection, request) {
using _ = signal.addAbortCallback(() => connection.close());
await connection.send(request);
} // the callback is unregistered here
The initial value of the
This property has the attributes { [[Writable]]:
| Internal Slot | Type | Description |
|---|---|---|
| [[AbortRegistration]] | an |
The entry returned by |
| Field Name | Value | Meaning |
|---|---|---|
| [[AbortRegistration]] | an |
The registration for an abortable asynchronous wait. Only the waiting |
The abstract operation NotifyWaiter takes arguments waiterList (a
The abstract operation EnqueueResolveInAgentJob takes arguments agentSignifier (an , promiseCapability (a , resolution (, and waiterRecord (a
The abstract operation ResolveAsyncWaiter takes argument waiterRecord (a
The abstract operation DoWait takes arguments mode (
Aborting, notifying, and timing out compete to remove the same waiter from its waiter list. For example, if another Atomics.notify, aborting the signal leaves the queued resolution with
additionalTimeout allows implementations to pad timeouts as necessary, such as for reducing power consumption or coarsening timer resolution to mitigate timing attacks. This value may differ from call to call of DoWait.
This function puts the
An omitted or
It performs the following steps when called:
This function returns an Object with async and value properties. If async is value is a Promise that is fulfilled with either async is value is either
The fourth argument may be
It performs the following steps when called:
© 2026 Ron Buckton, Kevin Gibbons
All Software contained in this document ("Software") is protected by copyright and is being made available under the "BSD License", included below. This Software may be subject to third party rights (rights from parties other than Ecma International), including patent rights, and no licenses under such third party rights are granted under this license even if the third party concerned is a member of Ecma International. SEE THE ECMA CODE OF CONDUCT IN PATENT MATTERS AVAILABLE AT https://ecma-international.org/memento/codeofconduct.htm FOR INFORMATION REGARDING THE LICENSING OF PATENT CLAIMS THAT ARE REQUIRED TO IMPLEMENT ECMA INTERNATIONAL STANDARDS.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE ECMA INTERNATIONAL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ECMA INTERNATIONAL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.