Re: [whatwg/streams] Throw type error in ReadableStreamBYOBRequest ctor if view isn't a non-detached ArrayBuffer view object (#870)

I think the IsDetachedBuffer() check is unnecessary, because the ReadableByteStreamController doesn't actually care about the view contained inside the ReadableStreamBYOBRequest, and respond() will simply throw if IsDetachedBuffer() is true.

However, we have bigger problems if user code creates a ReadableStreamBYOBRequest. ReadableByteStreamControllerRespond does 

> Assert: controller.[[pendingPullIntos]] is not empty.

I suspect there are other, less obvious problems that could occur. I propose we change the constructor to always throw so that user code cannot create a ReadableStreamBYOBRequest for which  IsReadableStreamBYOBRequest() is true. Then we can have an abstract op we use internally to create one.

What do you think?

-- 
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/870#issuecomment-359330039

Received on Monday, 22 January 2018 05:39:30 UTC