Skip to content

Commit

Permalink
fix(fetch): weaker refs
Browse files Browse the repository at this point in the history
Refs: #1823
  • Loading branch information
ronag committed Dec 21, 2022
1 parent 9f6c592 commit 84c501c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/fetch/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,10 @@ class Request {
if (signal.aborted) {
ac.abort(signal.reason)
} else {
const abort = () => ac.abort(signal.reason)
const acRef = new WeakRef(ac)
const abort = function () {
acRef.deref()?.abort(this.reason)
}
signal.addEventListener('abort', abort, { once: true })
requestFinalizer.register(this, { signal, abort })
}
Expand Down

0 comments on commit 84c501c

Please sign in to comment.