- From: Domenic Denicola <notifications@github.com>
- Date: Wed, 15 Sep 2021 08:17:58 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/streams/issues/1165/920114795@github.com>
I think if this is properly integrated into all calling specifications, such that calling `.abort(x)` causes methods like `fetch()` to reject with `x` instead of with an `"AbortError"` `DOMException`, then it would be good.
It would also solve the issue discussed in https://github.com/whatwg/dom/issues/951 about `"TimeoutError"` `DOMException` being most appropriate. /cc @annevk. We would make `AbortSignal.timeout()` call the spec equivalent of `controller.abort(new DOMException("...", "TimeoutError"))`.
The spec changes would probably be something like:
- Easy changes to the base primitives:
- Each `AbortSignal` gets an **abort reason** JavaScript value, initially undefined (or null?).
- `AbortSignal` gets a `reason` getter that returns this's abort reason.
- `AbortController`'s `abort()` gets an `optional any reason` property. If it is not passed, it creates a new `"AbortError"` `DOMException`. It stores the `reason` in the abort reason for the created signal.
- Changes to all the callers:
- Fetch:
- all calls to "Abort fetch" which are triggered by an `AbortSignal` need to use the signal's abort reason, instead of creating a new "AbortError"
- maybe also the stream erroring step?
- Streams:
- ReadableStreamPipeTo needs to consult the signal's abort reason
- Remove `abortReason` stuff
- Need to also update per https://dontcallmedom.github.io/webidlpedia/names/AbortSignal.html:
- Web NFC
- Web Bluetooth
- App History
- EyeDropper
- Idle Detection
- Prioritized Task Scheduling
- Web Locks
- Credential Management
- Geolocation Sensor
This is a good amount of work, especially updating all the dependent specs/implementations/tests. But I think if we want to do this, we need to go the extra mile and update those too; being in an inconsistent halfway state where `.abort(reason)` only works with Streams would be bad.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/1165#issuecomment-920114795
Received on Wednesday, 15 September 2021 15:18:11 UTC