mirror of
https://github.com/denoland/deno.git
synced 2025-01-12 00:54:02 -05:00
feat(streams): support abort reasons in streams (#12991)
This commit is contained in:
parent
b51b0c834b
commit
318f48f9ad
2 changed files with 6 additions and 31 deletions
|
@ -55,7 +55,6 @@
|
||||||
WeakMapPrototypeSet,
|
WeakMapPrototypeSet,
|
||||||
} = globalThis.__bootstrap.primordials;
|
} = globalThis.__bootstrap.primordials;
|
||||||
const consoleInternal = window.__bootstrap.console;
|
const consoleInternal = window.__bootstrap.console;
|
||||||
const { DOMException } = window.__bootstrap.domException;
|
|
||||||
|
|
||||||
class AssertionError extends Error {
|
class AssertionError extends Error {
|
||||||
constructor(msg) {
|
constructor(msg) {
|
||||||
|
@ -1872,7 +1871,7 @@
|
||||||
let abortAlgorithm;
|
let abortAlgorithm;
|
||||||
if (signal) {
|
if (signal) {
|
||||||
abortAlgorithm = () => {
|
abortAlgorithm = () => {
|
||||||
const error = new DOMException("Aborted", "AbortError");
|
const error = signal.reason;
|
||||||
/** @type {Array<() => Promise<void>>} */
|
/** @type {Array<() => Promise<void>>} */
|
||||||
const actions = [];
|
const actions = [];
|
||||||
if (preventAbort === false) {
|
if (preventAbort === false) {
|
||||||
|
@ -3343,7 +3342,7 @@
|
||||||
if (state === "closed" || state === "errored") {
|
if (state === "closed" || state === "errored") {
|
||||||
return resolvePromiseWith(undefined);
|
return resolvePromiseWith(undefined);
|
||||||
}
|
}
|
||||||
stream[_controller][_signal][signalAbort]();
|
stream[_controller][_signal][signalAbort](reason);
|
||||||
if (state === "closed" || state === "errored") {
|
if (state === "closed" || state === "errored") {
|
||||||
return resolvePromiseWith(undefined);
|
return resolvePromiseWith(undefined);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5787,28 +5787,8 @@
|
||||||
"idlharness.any.html": true,
|
"idlharness.any.html": true,
|
||||||
"idlharness.any.worker.html": true,
|
"idlharness.any.worker.html": true,
|
||||||
"piping": {
|
"piping": {
|
||||||
"abort.any.html": [
|
"abort.any.html": true,
|
||||||
"(reason: 'null') all the error objects should be the same object",
|
"abort.any.worker.html": true,
|
||||||
"(reason: 'undefined') all the error objects should be the same object",
|
|
||||||
"(reason: 'error1: error1') all the error objects should be the same object",
|
|
||||||
"(reason: 'null') abort should prevent further reads",
|
|
||||||
"(reason: 'undefined') abort should prevent further reads",
|
|
||||||
"(reason: 'error1: error1') abort should prevent further reads",
|
|
||||||
"(reason: 'null') all pending writes should complete on abort",
|
|
||||||
"(reason: 'undefined') all pending writes should complete on abort",
|
|
||||||
"(reason: 'error1: error1') all pending writes should complete on abort"
|
|
||||||
],
|
|
||||||
"abort.any.worker.html": [
|
|
||||||
"(reason: 'null') all the error objects should be the same object",
|
|
||||||
"(reason: 'undefined') all the error objects should be the same object",
|
|
||||||
"(reason: 'error1: error1') all the error objects should be the same object",
|
|
||||||
"(reason: 'null') abort should prevent further reads",
|
|
||||||
"(reason: 'undefined') abort should prevent further reads",
|
|
||||||
"(reason: 'error1: error1') abort should prevent further reads",
|
|
||||||
"(reason: 'null') all pending writes should complete on abort",
|
|
||||||
"(reason: 'undefined') all pending writes should complete on abort",
|
|
||||||
"(reason: 'error1: error1') all pending writes should complete on abort"
|
|
||||||
],
|
|
||||||
"close-propagation-backward.any.html": true,
|
"close-propagation-backward.any.html": true,
|
||||||
"close-propagation-backward.any.worker.html": true,
|
"close-propagation-backward.any.worker.html": true,
|
||||||
"close-propagation-forward.any.html": true,
|
"close-propagation-forward.any.html": true,
|
||||||
|
@ -5907,12 +5887,8 @@
|
||||||
"terminate.any.worker.html": true
|
"terminate.any.worker.html": true
|
||||||
},
|
},
|
||||||
"writable-streams": {
|
"writable-streams": {
|
||||||
"aborting.any.html": [
|
"aborting.any.html": true,
|
||||||
"WritableStreamDefaultController.signal"
|
"aborting.any.worker.html": true,
|
||||||
],
|
|
||||||
"aborting.any.worker.html": [
|
|
||||||
"WritableStreamDefaultController.signal"
|
|
||||||
],
|
|
||||||
"bad-strategies.any.html": true,
|
"bad-strategies.any.html": true,
|
||||||
"bad-strategies.any.worker.html": true,
|
"bad-strategies.any.worker.html": true,
|
||||||
"bad-underlying-sinks.any.html": true,
|
"bad-underlying-sinks.any.html": true,
|
||||||
|
|
Loading…
Reference in a new issue