Re: [whatwg/streams] Various fixes for readable byte streams (#1123)

@domenic commented on this pull request.

> I think we will need to turn these checks into asserts inside RespondInternal(), and throw errors in Respond() and RespondWithNewView()?

That does sound nicer. It's possible our original reasoning was that in error states like these, there are no guarantees, but we might as well make it better.

> @@ -38,6 +39,13 @@ exports.implementation = class ReadableByteStreamControllerImpl {
       throw new TypeError(`The stream (in ${state} state) is not in the readable state and cannot be closed`);
     }
 
+    if (this._pendingPullIntos.length > 0) {

Why locate these checks here, instead of e.g. in ReadableByteStreamControllerClose step 4?

>   1. If |view|.\[[ViewedArrayBuffer]].\[[ArrayBufferByteLength]] is 0, throw a {{TypeError}}
     exception.

Yeah, I guess so, although we'd want to update the tests to change the exception type expected.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/1123#pullrequestreview-639059919

Received on Monday, 19 April 2021 16:20:57 UTC