mirror of
https://github.com/denoland/deno.git
synced 2024-12-24 08:09:08 -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,
|
||||
} = 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<void>>} */
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -5787,28 +5787,8 @@
|
|||
"idlharness.any.html": true,
|
||||
"idlharness.any.worker.html": true,
|
||||
"piping": {
|
||||
"abort.any.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"
|
||||
],
|
||||
"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"
|
||||
],
|
||||
"abort.any.html": true,
|
||||
"abort.any.worker.html": true,
|
||||
"close-propagation-backward.any.html": true,
|
||||
"close-propagation-backward.any.worker.html": true,
|
||||
"close-propagation-forward.any.html": true,
|
||||
|
@ -5907,12 +5887,8 @@
|
|||
"terminate.any.worker.html": true
|
||||
},
|
||||
"writable-streams": {
|
||||
"aborting.any.html": [
|
||||
"WritableStreamDefaultController.signal"
|
||||
],
|
||||
"aborting.any.worker.html": [
|
||||
"WritableStreamDefaultController.signal"
|
||||
],
|
||||
"aborting.any.html": true,
|
||||
"aborting.any.worker.html": true,
|
||||
"bad-strategies.any.html": true,
|
||||
"bad-strategies.any.worker.html": true,
|
||||
"bad-underlying-sinks.any.html": true,
|
||||
|
|
Loading…
Reference in a new issue