diff --git a/lib/internal/abort_controller.js b/lib/internal/abort_controller.js index 6aa013b5894e89..108bdbe0504fcc 100644 --- a/lib/internal/abort_controller.js +++ b/lib/internal/abort_controller.js @@ -11,9 +11,9 @@ const { PromiseResolve, SafeFinalizationRegistry, SafeSet, + SafeWeakRef, Symbol, SymbolToStringTag, - WeakRef, } = primordials; const { @@ -188,7 +188,7 @@ class AbortSignal extends EventTarget { signal[kTimeout] = true; clearTimeoutRegistry.register( signal, - setWeakAbortSignalTimeout(new WeakRef(signal), delay)); + setWeakAbortSignalTimeout(new SafeWeakRef(signal), delay)); return signal; } @@ -202,7 +202,7 @@ class AbortSignal extends EventTarget { if (!signals.length) { return resultSignal; } - const resultSignalWeakRef = new WeakRef(resultSignal); + const resultSignalWeakRef = new SafeWeakRef(resultSignal); resultSignal[kSourceSignals] = new SafeSet(); for (let i = 0; i < signals.length; i++) { const signal = signals[i]; @@ -212,7 +212,7 @@ class AbortSignal extends EventTarget { } signal[kDependantSignals] ??= new SafeSet(); if (!signal[kComposite]) { - resultSignal[kSourceSignals].add(new WeakRef(signal)); + resultSignal[kSourceSignals].add(new SafeWeakRef(signal)); signal[kDependantSignals].add(resultSignalWeakRef); } else if (!signal[kSourceSignals]) { continue;