Commit 4bdcaf2
stream: improve Web Compression spec compliance
Pass rejectGarbageAfterEnd: true to createInflateRaw() and
createBrotliDecompress(), matching the behavior already in place
for deflate and gzip. The Compression Streams spec treats any
data following a valid compressed payload as an error.
When the underlying Node.js stream throws synchronously from
write() (e.g. zlib rejects an invalid chunk type), destroy the
stream so that the readable side is also errored. Without this,
the readable side hangs forever waiting for data that will never
arrive.
Introduce a kValidateChunk callback option in the webstreams
adapter layer. Compression streams use this to validate that
chunks are BufferSource instances not backed by SharedArrayBuffer,
replacing the previous monkey-patching of the underlying
handle's write method.
Unskip WPT compression bad-chunks tests which now run instead of
hang and mark the remaining expected failures.
PR-URL: #62107
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Mattias Buelens <mattias@buelens.com>
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>1 parent 82770cb commit 4bdcaf2Copy full SHA for 4bdcaf2
6 files changed
+302-23Lines changed: 302 additions & 23 deletions
File tree
Expand file treeCollapse file tree
Open diff view settings
Filter options
- lib/internal/webstreams
- test
- parallel
- wpt/status
Expand file treeCollapse file tree
Open diff view settings
Collapse file
lib/internal/webstreams/adapters.js
Copy file name to clipboardExpand all lines: lib/internal/webstreams/adapters.js+36-8Lines changed: 36 additions & 8 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
11 | 11 | |
12 | 12 | |
13 | 13 | |
| 14 | + |
| 15 | + |
14 | 16 | |
15 | 17 | |
16 | 18 | |
| ||
94 | 96 | |
95 | 97 | |
96 | 98 | |
| 99 | + |
| 100 | + |
| 101 | + |
97 | 102 | |
98 | 103 | |
99 | 104 | |
| ||
139 | 144 | |
140 | 145 | |
141 | 146 | |
| 147 | + |
142 | 148 | |
143 | 149 | |
144 | | - |
| 150 | + |
145 | 151 | |
146 | 152 | |
147 | 153 | |
| ||
220 | 226 | |
221 | 227 | |
222 | 228 | |
223 | | - |
224 | | - |
225 | | - |
226 | | - |
227 | | - |
228 | | - |
| 229 | + |
| 230 | + |
| 231 | + |
| 232 | + |
| 233 | + |
| 234 | + |
| 235 | + |
| 236 | + |
| 237 | + |
| 238 | + |
| 239 | + |
| 240 | + |
| 241 | + |
| 242 | + |
| 243 | + |
| 244 | + |
| 245 | + |
| 246 | + |
| 247 | + |
| 248 | + |
229 | 249 | |
230 | 250 | |
231 | 251 | |
| ||
662 | 682 | |
663 | 683 | |
664 | 684 | |
| 685 | + |
| 686 | + |
| 687 | + |
| 688 | + |
| 689 | + |
| 690 | + |
665 | 691 | |
666 | 692 | |
667 | | - |
| 693 | + |
668 | 694 | |
669 | 695 | |
670 | 696 | |
| ||
1064 | 1090 | |
1065 | 1091 | |
1066 | 1092 | |
| 1093 | + |
| 1094 | + |
1067 | 1095 | |
Collapse file
lib/internal/webstreams/compression.js
Copy file name to clipboardExpand all lines: lib/internal/webstreams/compression.js+38-11Lines changed: 38 additions & 11 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
7 | 7 | |
8 | 8 | |
9 | 9 | |
| 10 | + |
| 11 | + |
10 | 12 | |
11 | 13 | |
12 | 14 | |
13 | 15 | |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
14 | 21 | |
15 | 22 | |
16 | 23 | |
17 | 24 | |
18 | 25 | |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
19 | 32 | |
20 | 33 | |
21 | 34 | |
| ||
24 | 37 | |
25 | 38 | |
26 | 39 | |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
27 | 52 | |
28 | 53 | |
29 | 54 | |
| ||
62 | 87 | |
63 | 88 | |
64 | 89 | |
65 | | - |
| 90 | + |
| 91 | + |
| 92 | + |
| 93 | + |
66 | 94 | |
67 | 95 | |
68 | 96 | |
| ||
108 | 136 | |
109 | 137 | |
110 | 138 | |
111 | | - |
| 139 | + |
| 140 | + |
| 141 | + |
112 | 142 | |
113 | 143 | |
114 | 144 | |
115 | 145 | |
116 | 146 | |
117 | 147 | |
118 | 148 | |
119 | | - |
| 149 | + |
| 150 | + |
| 151 | + |
120 | 152 | |
121 | 153 | |
122 | | - |
123 | | - |
124 | | - |
125 | | - |
126 | | - |
127 | | - |
128 | | - |
129 | | - |
| 154 | + |
| 155 | + |
| 156 | + |
130 | 157 | |
131 | 158 | |
132 | 159 | |
|
Collapse file
test/parallel/test-webstreams-adapters-sync-write-error.js
Copy file name to clipboard+79Lines changed: 79 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 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 | + |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | + |
Collapse file
test/parallel/test-webstreams-compression-bad-chunks.js
Copy file name to clipboard+57Lines changed: 57 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | + |
0 commit comments