[whatwg/streams] Initialize ReadableByteStreamController.[[byobRequest]] to undefined (#990)

`SetUpReadableByteStreamController` calls `ReadableByteStreamControllerClearPendingPullIntos`, which in turn calls `ReadableByteStreamControllerInvalidateBYOBRequest`. This last function returns early if `controller.[[byobRequest]]` is already `undefined`, which holds **even if we don't explicitly set it** to `undefined`. This means the internal slot is never really "initialized" to `undefined`, so if I understand correctly looking up the slot's value would mean going through the prototype chain to find out that the slot does not exist. (At least, until the first BYOB request comes in and gives it an actual value.)

This change explicitly initializes `ReadableByteStreamController.[[byobRequest]]` to `undefined`. We already do this for other internal slots (such as `ReadableStream.[[storedError]]` or `WritableStream.[[closeRequest]]`), so it seemed appropriate to also do it for `[[byobRequest]]`.
You can view, comment on, or merge this pull request online at:

  https://github.com/whatwg/streams/pull/990

-- Commit Summary --

  * Initialize ReadableByteStreamController.[[byobRequest]] to undefined

-- File Changes --

    M index.bs (4)
    M reference-implementation/lib/readable-stream.js (1)

-- Patch Links --

https://github.com/whatwg/streams/pull/990.patch
https://github.com/whatwg/streams/pull/990.diff

-- 
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/990

Received on Monday, 18 February 2019 23:25:31 UTC