- From: James Browning <notifications@github.com>
- Date: Mon, 29 Nov 2021 23:10:58 -0800
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/dom/issues/948/982347132@github.com>
With the new `abortSignal.reason` synchronous observation doesn't really make sense anymore as one also needs to send the reason across the thread which is considerably less simple than the setting of a boolean cross-thread, however the asynchronous part of the API still would make sense.
For this we could have a design more like:
```txt
AbortSignal serialization steps given _abortSignal_ and _serialized_:
1. If _abortSignal_ is **aborted**.
a. Set _serialized_.[[AbortReason]] to _abortSignal_'s **abort reason**.
b. Set _serialized_.[[MessagePort]] to **undefined**.
2. Else.
a. Let _port1_ be a new MessagePort in the current realm.
b. Let _port2_ be a new MessagePort in the current realm.
c. Entangle _port1_ and _port2_.
d. Set _serialized_.[[AbortReason]] to **undefined**.
e. Set _serialized_.[[MessagePort]] to the **sub-serialization** of **port2**.
f. Add the following **abort algorithm** to _abortSignal_:
a. Post a message consisting of _abortSignal_'s **abort reason** to _port1_.
b. Disentangle _port1_.
AbortSignal deserialization steps given _dataHolder_ and _value_:
1. If _dataHolder_.[[AbortReason]] is not **undefined**:
a. Abort _value_ with _dataHolder_.[[AbortReason]].
2. Else.
a. Assert _serialized_.[[MessagePort]] is a MessagePort.
b. Add a handler for _serialized_.[[MessagePort]]'s "message" event with the following steps:
i. **abort** _value_ with the *data* of the message.
ii. Disentangle _serialized_.[[MessagePort]]
```
--
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/dom/issues/948#issuecomment-982347132
Received on Tuesday, 30 November 2021 07:11:11 UTC