Skip to content

Commit

Permalink
lib: create weakRef only if any signals provided
Browse files Browse the repository at this point in the history
PR-URL: #48448
Fixes: #48419
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Nitzan Uziely <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
atlowChemi authored and RafaelGSS committed Jul 3, 2023
1 parent 641a2e9 commit 8c2c02d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/internal/abort_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ class AbortSignal extends EventTarget {
static any(signals) {
validateAbortSignalArray(signals, 'signals');
const resultSignal = createAbortSignal({ composite: true });
if (!signals.length) {
return resultSignal;
}
const resultSignalWeakRef = new WeakRef(resultSignal);
resultSignal[kSourceSignals] = new SafeSet();
for (let i = 0; i < signals.length; i++) {
Expand Down

0 comments on commit 8c2c02d

Please sign in to comment.