Commit eedd317
committed
stream: narrow pipeTo guard to writer release check
The state.shuttingDown guard introduced in the previous commit is too
broad: it skips writes even when the destination is still writable.
The WHATWG Streams spec requires that already-read chunks are written
to a still-writable destination during shutdown (step 15, shutdown
substeps 3.1-3.2).
Replace the guard with a check for writer[kState].stream === undefined
which is only true after finalize() has released the writer. This
precisely targets the crash condition without violating the spec
requirement.
Restore shuttingDown as a closure-local variable since it no longer
needs to be shared with PipeToReadableStreamReadRequest.
Add a test case verifying that an already-read chunk is written when
an AbortSignal fires after enqueue while the destination is still
writable.
Signed-off-by: Qingyu Wang <wangqingyu.c0l1n@bytedance.com>1 parent a546fba commit eedd317
2 files changed
Lines changed: 41 additions & 9 deletions
File tree
- lib/internal/webstreams
- test/parallel
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1424 | 1424 | | |
1425 | 1425 | | |
1426 | 1426 | | |
| 1427 | + | |
| 1428 | + | |
1427 | 1429 | | |
1428 | 1430 | | |
1429 | 1431 | | |
| |||
1436 | 1438 | | |
1437 | 1439 | | |
1438 | 1440 | | |
1439 | | - | |
1440 | 1441 | | |
1441 | 1442 | | |
1442 | 1443 | | |
| |||
1461 | 1462 | | |
1462 | 1463 | | |
1463 | 1464 | | |
1464 | | - | |
1465 | | - | |
| 1465 | + | |
| 1466 | + | |
1466 | 1467 | | |
1467 | 1468 | | |
1468 | 1469 | | |
| |||
1482 | 1483 | | |
1483 | 1484 | | |
1484 | 1485 | | |
1485 | | - | |
1486 | | - | |
| 1486 | + | |
| 1487 | + | |
1487 | 1488 | | |
1488 | 1489 | | |
1489 | 1490 | | |
| |||
1545 | 1546 | | |
1546 | 1547 | | |
1547 | 1548 | | |
1548 | | - | |
| 1549 | + | |
1549 | 1550 | | |
1550 | 1551 | | |
1551 | 1552 | | |
1552 | | - | |
| 1553 | + | |
1553 | 1554 | | |
1554 | 1555 | | |
1555 | 1556 | | |
| |||
1562 | 1563 | | |
1563 | 1564 | | |
1564 | 1565 | | |
1565 | | - | |
| 1566 | + | |
1566 | 1567 | | |
1567 | 1568 | | |
1568 | 1569 | | |
| |||
1677 | 1678 | | |
1678 | 1679 | | |
1679 | 1680 | | |
1680 | | - | |
| 1681 | + | |
1681 | 1682 | | |
1682 | 1683 | | |
1683 | 1684 | | |
| |||
Lines changed: 31 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
0 commit comments