- From: Kagami Sascha Rosylight <notifications@github.com>
- Date: Thu, 08 Jun 2023 08:16:32 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/streams/pull/1145/review/1469995978@github.com>
@saschanaz commented on this pull request.
LGTM, some comments:
> undefined releaseLock();
};
ReadableStreamBYOBReader includes ReadableStreamGenericReader;
+
+dictionary ReadableStreamBYOBReaderReadOptions {
+ [EnforceRange] unsigned long long min;
Maybe we can set the default value to `1` here?
> method steps are:
1. If |view|.\[[ByteLength]] is 0, return [=a promise rejected with=] a {{TypeError}} exception.
1. If |view|.\[[ViewedArrayBuffer]].\[[ArrayBufferByteLength]] is 0, return [=a promise rejected
with=] a {{TypeError}} exception.
1. If ! [$IsDetachedBuffer$](|view|.\[[ViewedArrayBuffer]]) is true, return
[=a promise rejected with=] a {{TypeError}} exception.
+ 1. Let |minimumFill| be undefined.
+ 1. If |options|["{{ReadableStreamBYOBReaderReadOptions/min}}"] was given,
+ 1. If |options|["{{ReadableStreamBYOBReaderReadOptions/min}}"] is 0, return [=a promise
+ rejected with=] a {{TypeError}} exception.
+ 1. If |view| has a \[[TypedArrayName]] internal slot,
+ 1. If |options|["{{ReadableStreamBYOBReaderReadOptions/min}}"] > |view|.\[[ArrayLength]],
+ return [=a promise rejected with=] a {{RangeError}} exception.
+ 1. Let |elementSize| be the element size specified in [=the typed array constructors table=] for
+ |view|.\[[TypedArrayName]].
+ 1. Set |minimumFill| to |options|["{{ReadableStreamBYOBReaderReadOptions/min}}"] *
+ |elementSize|.
+ 1. Otherwise (i.e., it is a {{DataView}}),
+ 1. If |options|["{{ReadableStreamBYOBReaderReadOptions/min}}"] > |view|.\[[ByteLength]],
+ return [=a promise rejected with=] a {{RangeError}} exception.
+ 1. Set |minimumFill| to |options|["{{ReadableStreamBYOBReaderReadOptions/min}}"].
This computation is a bit duplicated with `ReadableStreamBYOBReaderRead`, could there be some helper steps?
> @@ -3151,7 +3197,8 @@ The following abstract operations support the implementation of the
1. If |controller|.[=ReadableByteStreamController/[[pendingPullIntos]]=] is not empty,
1. Let |firstPendingPullInto| be
|controller|.[=ReadableByteStreamController/[[pendingPullIntos]]=][0].
- 1. If |firstPendingPullInto|'s [=pull-into descriptor/bytes filled=] > 0,
+ 1. If |firstPendingPullInto|'s [=pull-into descriptor/bytes filled=]
+ mod |firstPendingPullInto|'s [=pull-into descriptor/element size=] is not 0,
This does not change the behavior in non-min case as there can't be a case that the mod result is 0 while the bytes filled count is not 0, right?
--
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/1145#pullrequestreview-1469995978
You are receiving this because you are subscribed to this thread.
Message ID: <whatwg/streams/pull/1145/review/1469995978@github.com>
Received on Thursday, 8 June 2023 15:16:39 UTC