0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-03 17:34:47 -05:00

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"])
```
This commit is contained in:
Marcos Casagrande 2023-08-08 12:05:42 +02:00 committed by GitHub
parent 7ce8c2a1f1
commit 557b11b765
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 12 deletions

View file

@ -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) {

View file

@ -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
},