- From: Benjamin Gruenbaum <notifications@github.com>
- Date: Wed, 03 May 2023 00:07:37 -0700
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/dom/pull/1152/c1532552185@github.com>
Any chance I can raise the order of signals/event listeners for a minor revision before this lands?
I think it's really confusing adding `"abort"` listeners manually and adding them implicitly through `AbortSignal.any` has different execution order like in this test:
```js
test(t => {
const controller = new controllerInterface();
const signals = [];
// The first event should be dispatched on the originating signal.
signals.push(controller.signal);
// All dependents are linked to `controller.signal` (never to another
// composite signal), so this is the order events should fire.
signals.push(signalInterface.any([controller.signal]));
signals.push(signalInterface.any([controller.signal]));
signals.push(signalInterface.any([signals[0]]));
signals.push(signalInterface.any([signals[1]]));
let result = "";
for (let i = 0; i < signals.length; i++) {
signals[i].addEventListener('abort', () => {
result += i;
});
}
controller.abort();
assert_equals(result, "01234");
}, `Abort events for ${desc} signals fire in the right order ${suffix}`);
```
Which effectively behaves like there is a capability letting you listen to abort in arbitrary order namely: my expectation above is the log to be "41230" and not "01234" since AbortSignal.any "listens" on that signal before the "abort" listener.
So when we do `controller.abort` in the above test I'd expect the AbortSignal.any to get the "abort" listener (conceptually, I get that's not the machinery) first and then to fire any listeners they have attached.
--
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/pull/1152#issuecomment-1532552185
You are receiving this because you are subscribed to this thread.
Message ID: <whatwg/dom/pull/1152/c1532552185@github.com>
Received on Wednesday, 3 May 2023 07:07:42 UTC