Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions lib/internal/webstreams/readablestream.js
Original file line number Diff line number Diff line change
Expand Up @@ -1584,9 +1584,14 @@ class PipeToReadableStreamReadRequest {
}

[kChunk](chunk) {
this.state.currentWrite = writableStreamDefaultWriterWrite(this.writer, chunk);
setPromiseHandled(this.state.currentWrite);
this.promise.resolve(false);
// Per spec, pipeTo must queue a microtask for the write to avoid
// synchronous write during enqueue(). See WHATWG Streams spec
// "ReadableStreamPipeTo" step 15's "chunk steps".
queueMicrotask(() => {
this.state.currentWrite = writableStreamDefaultWriterWrite(this.writer, chunk);
setPromiseHandled(this.state.currentWrite);
this.promise.resolve(false);
});
}

[kClose]() {
Expand Down
8 changes: 0 additions & 8 deletions test/wpt/status/streams.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@
"idlharness-shadowrealm.window.js": {
"skip": "ShadowRealm support is not enabled"
},
"piping/general-addition.any.js": {
"fail": {
"note": "Blocked on https://github.com/whatwg/streams/issues/1243",
"expected": [
"enqueue() must not synchronously call write algorithm"
]
}
},
Comment on lines -5 to -12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even the reference implementation skips this test. 😅

Is this extra microtask now a "de facto" standard? Looking at wpt.fyi, all major browsers are already passing this test, even though the spec text doesn't require it...

"queuing-strategies-size-function-per-global.window.js": {
"skip": "Browser-specific test"
},
Expand Down
Loading