Skip to content

Commit fe5f7bc

Browse files
jazellymarco-ippolito
authored andcommitted
stream: validate undefined sizeAlgorithm in WritableStream
PR-URL: #56067 Fixes: #56014 Refs: whatwg/streams#1333 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
1 parent 5083bbb commit fe5f7bc

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/internal/webstreams/writablestream.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1167,9 +1167,18 @@ function writableStreamDefaultControllerGetDesiredSize(controller) {
11671167
}
11681168

11691169
function writableStreamDefaultControllerGetChunkSize(controller, chunk) {
1170+
const {
1171+
stream,
1172+
sizeAlgorithm,
1173+
} = controller[kState];
1174+
if (sizeAlgorithm === undefined) {
1175+
assert(stream[kState].state === 'errored' || stream[kState].state === 'erroring');
1176+
return 1;
1177+
}
1178+
11701179
try {
11711180
return FunctionPrototypeCall(
1172-
controller[kState].sizeAlgorithm,
1181+
sizeAlgorithm,
11731182
undefined,
11741183
chunk);
11751184
} catch (error) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy