GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — stream: fix pipeTo to defer writes per WHATWG spec · nodejs/node@ea2df2a

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/webstreams
    • readablestream.js
  • test/wpt/status
    • streams.json
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/webstreams/readablestream.js‎

Copy file name to clipboardExpand all lines: lib/internal/webstreams/readablestream.js
+8-3Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1662,9 +1662,14 @@ class PipeToReadableStreamReadRequest {
16621662
}
16631663

16641664
[kChunk](chunk) {
1665-
this.state.currentWrite = writableStreamDefaultWriterWrite(this.writer, chunk);
1666-
setPromiseHandled(this.state.currentWrite);
1667-
this.promise.resolve(false);
1665+
// Per spec, pipeTo must queue a microtask for the write to avoid
1666+
// synchronous write during enqueue(). See WHATWG Streams spec
1667+
// "ReadableStreamPipeTo" step 15's "chunk steps".
1668+
queueMicrotask(() => {
1669+
this.state.currentWrite = writableStreamDefaultWriterWrite(this.writer, chunk);
1670+
setPromiseHandled(this.state.currentWrite);
1671+
this.promise.resolve(false);
1672+
});
16681673
}
16691674

16701675
[kClose]() {
Collapse file

‎test/wpt/status/streams.json‎

Copy file name to clipboardExpand all lines: test/wpt/status/streams.json
-8Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@
22
"idlharness-shadowrealm.window.js": {
33
"skip": "ShadowRealm support is not enabled"
44
},
5-
"piping/general-addition.any.js": {
6-
"fail": {
7-
"note": "Blocked on https://github.com/whatwg/streams/issues/1243",
8-
"expected": [
9-
"enqueue() must not synchronously call write algorithm"
10-
]
11-
}
12-
},
135
"queuing-strategies-size-function-per-global.window.js": {
146
"skip": "Browser-specific test"
157
},

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.