1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

fix: closing / aborting WritableStream is racy (#10982)

This commit is contained in:
Luca Casonato 2021-06-16 02:46:08 +02:00 committed by GitHub
parent d7ce3adc8b
commit ac431ca076
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 14 deletions

View file

@ -2808,7 +2808,7 @@
function writableStreamHasOperationMarkedInFlight(stream) { function writableStreamHasOperationMarkedInFlight(stream) {
if ( if (
stream[_inFlightWriteRequest] === undefined && stream[_inFlightWriteRequest] === undefined &&
stream[_controller][_inFlightCloseRequest] === undefined stream[_inFlightCloseRequest] === undefined
) { ) {
return false; return false;
} }
@ -2857,11 +2857,11 @@
assert(stream[_storedError] === undefined); assert(stream[_storedError] === undefined);
assert(stream[_state] === "writable"); assert(stream[_state] === "writable");
const controller = stream[_controller]; const controller = stream[_controller];
assert(controller); assert(controller !== undefined);
stream[_state] = "erroring"; stream[_state] = "erroring";
stream[_storedError] = reason; stream[_storedError] = reason;
const writer = stream[_writer]; const writer = stream[_writer];
if (writer) { if (writer !== undefined) {
writableStreamDefaultWriterEnsureReadyPromiseRejected(writer, reason); writableStreamDefaultWriterEnsureReadyPromiseRejected(writer, reason);
} }
if ( if (

View file

@ -309,11 +309,6 @@
"queuing-strategies.any.html": true, "queuing-strategies.any.html": true,
"readable-byte-streams": { "readable-byte-streams": {
"bad-buffers-and-views.any.html": [ "bad-buffers-and-views.any.html": [
"ReadableStream with byte source: read()ing from a closed stream still transfers the buffer",
"ReadableStream with byte source: read()ing from a stream with queued chunks still transfers the buffer",
"ReadableStream with byte source: reading into an already-detached buffer rejects",
"ReadableStream with byte source: reading into a zero-length buffer rejects",
"ReadableStream with byte source: reading into a zero-length view on a non-zero-length buffer rejects",
"ReadableStream with byte source: respond() throws if the BYOB request's buffer has been detached (in the readable state)", "ReadableStream with byte source: respond() throws if the BYOB request's buffer has been detached (in the readable state)",
"ReadableStream with byte source: respond() throws if the BYOB request's buffer has been detached (in the closed state)", "ReadableStream with byte source: respond() throws if the BYOB request's buffer has been detached (in the closed state)",
"ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has been detached (in the readable state)", "ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has been detached (in the readable state)",
@ -326,7 +321,12 @@
"ReadableStream with byte source: respondWithNewView() throws if the supplied view is non-zero-length (in the closed state)", "ReadableStream with byte source: respondWithNewView() throws if the supplied view is non-zero-length (in the closed state)",
"ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has a different length (in the closed state)", "ReadableStream with byte source: respondWithNewView() throws if the supplied view's buffer has a different length (in the closed state)",
"ReadableStream with byte source: enqueue() throws if the BYOB request's buffer has been detached (in the readable state)", "ReadableStream with byte source: enqueue() throws if the BYOB request's buffer has been detached (in the readable state)",
"ReadableStream with byte source: enqueue() throws if the BYOB request's buffer has been detached (in the closed state)" "ReadableStream with byte source: enqueue() throws if the BYOB request's buffer has been detached (in the closed state)",
"ReadableStream with byte source: read()ing from a closed stream still transfers the buffer",
"ReadableStream with byte source: read()ing from a stream with queued chunks still transfers the buffer",
"ReadableStream with byte source: reading into an already-detached buffer rejects",
"ReadableStream with byte source: reading into a zero-length buffer rejects",
"ReadableStream with byte source: reading into a zero-length view on a non-zero-length buffer rejects"
], ],
"construct-byob-request.any.html": false, "construct-byob-request.any.html": false,
"general.any.html": [ "general.any.html": [
@ -424,16 +424,16 @@
"properties.any.html": true, "properties.any.html": true,
"reentrant-strategies.any.html": true, "reentrant-strategies.any.html": true,
"strategies.any.html": true, "strategies.any.html": true,
"terminate.any.html": [ "terminate.any.html": true
"controller.terminate() inside flush() should not prevent writer.close() from succeeding"
]
}, },
"writable-streams": { "writable-streams": {
"aborting.any.html": false, "aborting.any.html": true,
"bad-strategies.any.html": true, "bad-strategies.any.html": true,
"bad-underlying-sinks.any.html": true, "bad-underlying-sinks.any.html": true,
"byte-length-queuing-strategy.any.html": true, "byte-length-queuing-strategy.any.html": true,
"close.any.html": false, "close.any.html": [
"when close is called on a WritableStream in waiting state, ready should be fulfilled immediately even if close takes a long time"
],
"constructor.any.html": true, "constructor.any.html": true,
"count-queuing-strategy.any.html": true, "count-queuing-strategy.any.html": true,
"error.any.html": true, "error.any.html": true,