Skip to content

Commit 7ddee37

Browse files
Reject with a TypeError if atLeast is 0
1 parent bd9b335 commit 7ddee37

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

index.bs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,6 +1449,8 @@ value: newViewOnSameMemory, done: true }</code> for closed streams. If the strea
14491449
[=a promise rejected with=] a {{TypeError}} exception.
14501450
1. Let |minimumFill| be undefined.
14511451
1. If |options|["{{ReadableStreamBYOBReaderReadOptions/atLeast}}"] was given,
1452+
1. If |options|["{{ReadableStreamBYOBReaderReadOptions/atLeast}}"] is 0, return [=a promise
1453+
rejected with=] a {{TypeError}} exception.
14521454
1. If |view| has a \[[TypedArrayName]] internal slot,
14531455
1. If |options|["{{ReadableStreamBYOBReaderReadOptions/atLeast}}"] &gt; |view|.\[[ArrayLength]],
14541456
return [=a promise rejected with=] a {{RangeError}} exception.

reference-implementation/lib/ReadableStreamBYOBReader-impl.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ class ReadableStreamBYOBReaderImpl {
2424

2525
let minimumFill;
2626
if ('atLeast' in options) {
27+
if (options.atLeast === 0) {
28+
return promiseRejectedWith(
29+
new TypeError('options.atLeast must be greater than 0')
30+
);
31+
}
2732
if (view.constructor !== DataView) {
2833
if (options.atLeast > view.length) {
2934
return promiseRejectedWith(

0 commit comments

Comments
 (0)