Skip to content

Commit

Permalink
fix: remove unnecessary WeakRef
Browse files Browse the repository at this point in the history
It's sufficient that the finalizer removes the closure.

Fixes: #1926
  • Loading branch information
ronag committed Mar 10, 2023
1 parent 3606c35 commit 571d1da
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/fetch/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,8 @@ class Request {
if (signal.aborted) {
ac.abort(signal.reason)
} else {
const acRef = new WeakRef(ac)
const abort = function () {
acRef.deref()?.abort(this.reason)
ac.abort(this.reason)
}

if (getEventListeners(signal, 'abort').length >= defaultMaxListeners) {
Expand Down

0 comments on commit 571d1da

Please sign in to comment.