Commit ea2df2a
stream: fix pipeTo to defer writes per WHATWG spec
The WHATWG Streams spec requires that pipeTo's chunk handling must
queue a microtask before calling the write algorithm. This ensures
that enqueue() does not synchronously trigger writes.
Previously, PipeToReadableStreamReadRequest[kChunk] would synchronously
call writableStreamDefaultWriterWrite(), which violated the spec and
caused the WPT test "enqueue() must not synchronously call write
algorithm" to fail.
Fix by wrapping the write operation in queueMicrotask(), which defers
it to the next microtask as required by the spec.
Refs: whatwg/streams#1243
PR-URL: #61800
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Mattias Buelens <mattias@buelens.com>1 parent 9ddd1a9 commit ea2df2aCopy full SHA for ea2df2a
2 files changed
+8-11Lines changed: 8 additions & 11 deletions
File tree
Expand file treeCollapse file tree
Open diff view settings
Filter options
- lib/internal/webstreams
- test/wpt/status
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 number | Diff line number | Diff line change |
|---|---|---|
| ||
1662 | 1662 | |
1663 | 1663 | |
1664 | 1664 | |
1665 | | - |
1666 | | - |
1667 | | - |
| 1665 | + |
| 1666 | + |
| 1667 | + |
| 1668 | + |
| 1669 | + |
| 1670 | + |
| 1671 | + |
| 1672 | + |
1668 | 1673 | |
1669 | 1674 | |
1670 | 1675 | |
|
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 number | Diff line number | Diff line change |
|---|---|---|
| ||
2 | 2 | |
3 | 3 | |
4 | 4 | |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | | - |
12 | | - |
13 | 5 | |
14 | 6 | |
15 | 7 | |
|
0 commit comments