diff options
Diffstat (limited to 'ext/web/03_abort_signal.js')
-rw-r--r-- | ext/web/03_abort_signal.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/ext/web/03_abort_signal.js b/ext/web/03_abort_signal.js index 2fa3c4bcf..70511a934 100644 --- a/ext/web/03_abort_signal.js +++ b/ext/web/03_abort_signal.js @@ -9,6 +9,8 @@ const { Event, setIsTrusted, defineEventHandler } = window.__bootstrap.event; const { EventTarget, listenerCount } = window.__bootstrap.eventTarget; const { + SafeArrayIterator, + SafeSetIterator, Set, SetPrototypeAdd, SetPrototypeDelete, @@ -76,7 +78,7 @@ } this[abortReason] = reason; if (this[abortAlgos] !== null) { - for (const algorithm of this[abortAlgos]) { + for (const algorithm of new SafeSetIterator(this[abortAlgos])) { algorithm(); } this[abortAlgos] = null; @@ -124,14 +126,14 @@ // only be used by Deno internals, which use it to essentially cancel async // ops which would block the event loop. addEventListener(...args) { - super.addEventListener(...args); + super.addEventListener(...new SafeArrayIterator(args)); if (this[timerId] !== null && listenerCount(this, "abort") > 0) { refTimer(this[timerId]); } } removeEventListener(...args) { - super.removeEventListener(...args); + super.removeEventListener(...new SafeArrayIterator(args)); if (this[timerId] !== null && listenerCount(this, "abort") === 0) { unrefTimer(this[timerId]); } |