diff --git a/lib/internal/abort_controller.js b/lib/internal/abort_controller.js index c7b380b49d368f..3f234d38dae940 100644 --- a/lib/internal/abort_controller.js +++ b/lib/internal/abort_controller.js @@ -309,7 +309,7 @@ function abortSignal(signal, reason) { } class AbortController { - #signal = undefined; + #signal; /** * @type {AbortSignal} @@ -323,7 +323,7 @@ class AbortController { * @param {any} reason */ abort(reason = new DOMException('This operation was aborted', 'AbortError')) { - abortSignal(this.signal, reason); + abortSignal(this.#signal ?? createAbortSignal(), reason); } [customInspectSymbol](depth, options) { @@ -334,7 +334,7 @@ class AbortController { static [kMakeTransferable]() { const controller = new AbortController(); - controller.#signal = transferableAbortSignal(controller.#signal); + controller.#signal = createAbortSignal({ transferable: true }); return controller; } }