diff options
author | Marcos Casagrande <marcoscvp90@gmail.com> | 2023-08-08 12:05:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-08 12:05:42 +0200 |
commit | 557b11b7657e1628082c271a9cece550b3c496fc (patch) | |
tree | 70ba134f3396d8d6fff6136592732a26a724c4a6 | |
parent | 7ce8c2a1f1236ed747d989c0ccfd9ea756ef8f2c (diff) |
fix(ext/abort): trigger AbortSignal events in correct order (#20095)
This PR ensures that the original signal event is fired before any
dependent signal events.
---
The enabled tests fail on `main`:
```
assert_array_equals: Abort events fired in correct order expected property 0 to be
"original-aborted" but got "clone-aborted" (expected array ["original-aborted", "clone-aborted"]
got ["clone-aborted", "original-aborted"])
```
-rw-r--r-- | ext/web/03_abort_signal.js | 14 | ||||
-rw-r--r-- | tools/wpt/expectation.json | 8 |
2 files changed, 10 insertions, 12 deletions
diff --git a/ext/web/03_abort_signal.js b/ext/web/03_abort_signal.js index 4c6230e52..2cc64189b 100644 --- a/ext/web/03_abort_signal.js +++ b/ext/web/03_abort_signal.js @@ -86,15 +86,17 @@ class AbortSignal extends EventTarget { return; } this[abortReason] = reason; - if (this[abortAlgos] !== null) { - for (const algorithm of new SafeSetIterator(this[abortAlgos])) { - algorithm(); - } - this[abortAlgos] = null; - } + const algos = this[abortAlgos]; + this[abortAlgos] = null; + const event = new Event("abort"); setIsTrusted(event, true); this.dispatchEvent(event); + if (algos !== null) { + for (const algorithm of new SafeSetIterator(algos)) { + algorithm(); + } + } } [remove](algorithm) { diff --git a/tools/wpt/expectation.json b/tools/wpt/expectation.json index c587062ca..b75183d89 100644 --- a/tools/wpt/expectation.json +++ b/tools/wpt/expectation.json @@ -4944,12 +4944,8 @@ "abort": { "request.any.html": true, "request.any.worker.html": true, - "general.any.html": [ - "Clone aborts with original controller" - ], - "general.any.worker.html": [ - "Clone aborts with original controller" - ], + "general.any.html": true, + "general.any.worker.html": true, "cache.https.any.html": false, "cache.https.any.worker.html": false }, |