Content-Length: 280987 | pFad | https://github.com/nodejs/node/commit/3a3f5c9a64

65 stream: validate undefined sizeAlgorithm in WritableStream · nodejs/node@3a3f5c9 · GitHub
Skip to content

Commit 3a3f5c9

Browse files
jazellyaduh95
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 4930244 commit 3a3f5c9

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
@@ -1176,9 +1176,18 @@ function writableStreamDefaultControllerGetDesiredSize(controller) {
11761176
}
11771177

11781178
function writableStreamDefaultControllerGetChunkSize(controller, chunk) {
1179+
const {
1180+
stream,
1181+
sizeAlgorithm,
1182+
} = controller[kState];
1183+
if (sizeAlgorithm === undefined) {
1184+
assert(stream[kState].state === 'errored' || stream[kState].state === 'erroring');
1185+
return 1;
1186+
}
1187+
11791188
try {
11801189
return FunctionPrototypeCall(
1181-
controller[kState].sizeAlgorithm,
1190+
sizeAlgorithm,
11821191
undefined,
11831192
chunk);
11841193
} catch (error) {

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/nodejs/node/commit/3a3f5c9a64

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy