From 318f48f9adc486e95dcc5f86fd0a1848c6df51f6 Mon Sep 17 00:00:00 2001 From: Andreu Botella Date: Wed, 8 Dec 2021 23:31:22 +0100 Subject: feat(streams): support abort reasons in streams (#12991) --- ext/web/06_streams.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'ext/web') diff --git a/ext/web/06_streams.js b/ext/web/06_streams.js index 15f51ca7a..ed77dde66 100644 --- a/ext/web/06_streams.js +++ b/ext/web/06_streams.js @@ -55,7 +55,6 @@ WeakMapPrototypeSet, } = globalThis.__bootstrap.primordials; const consoleInternal = window.__bootstrap.console; - const { DOMException } = window.__bootstrap.domException; class AssertionError extends Error { constructor(msg) { @@ -1872,7 +1871,7 @@ let abortAlgorithm; if (signal) { abortAlgorithm = () => { - const error = new DOMException("Aborted", "AbortError"); + const error = signal.reason; /** @type {Array<() => Promise>} */ const actions = []; if (preventAbort === false) { @@ -3343,7 +3342,7 @@ if (state === "closed" || state === "errored") { return resolvePromiseWith(undefined); } - stream[_controller][_signal][signalAbort](); + stream[_controller][_signal][signalAbort](reason); if (state === "closed" || state === "errored") { return resolvePromiseWith(undefined); } -- cgit v1.2.3