Skip to content

Commit

Permalink
Require autoAllocateChunkSize to be non-zero in SetUpReadableByteStre…
Browse files Browse the repository at this point in the history
…amController

Ported from whatwg/streams@0397808
  • Loading branch information
MattiasBuelens committed Feb 9, 2021
1 parent f3323ca commit a42b0d3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lib/readable-stream/byte-stream-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,9 @@ export function SetUpReadableByteStreamControllerFromUnderlyingSource(
}

const autoAllocateChunkSize = underlyingByteSource.autoAllocateChunkSize;
if (autoAllocateChunkSize === 0) {
throw new TypeError('autoAllocateChunkSize must be greater than 0');
}

SetUpReadableByteStreamController(
stream, controller, startAlgorithm, pullAlgorithm, cancelAlgorithm, highWaterMark, autoAllocateChunkSize
Expand Down

0 comments on commit a42b0d3

Please sign in to comment.