Skip to content

Commit

Permalink
fix: use weak listener for fetch abort
Browse files Browse the repository at this point in the history
Fixes: #939
  • Loading branch information
ronag committed Nov 18, 2021
1 parent 3b1b03c commit 94ba37e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/fetch/request.js
Expand Up @@ -328,13 +328,12 @@ class Request {
if (signal.aborted) {
ac.abort()
} else {
// TODO: Remove this listener on failure/success.
signal.addEventListener(
'abort',
function () {
ac.abort()
},
{ once: true }
{ once: true, weak: true }
)
}
}
Expand Down Expand Up @@ -700,7 +699,7 @@ class Request {
function () {
ac.abort()
},
{ once: true }
{ once: true, weak: true }
)
}
clonedRequestObject[kSignal] = ac.signal
Expand Down

0 comments on commit 94ba37e

Please sign in to comment.