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 Jun 15, 2023
1 parent c760ff2 commit f3ee4e2
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 f3ee4e2

Please sign in to comment.