PSA: Readable Byte Streams updates in Blink Implementation

Skip to first unread message

Nidhi Jaju

Oct 13, 2021, 10:29:35 AM10/13/21
to blink-dev, Adam Rice
Hi all,

(If you do not work with readable byte streams, you can ignore this.)

We have recently submitted some CLs for updating readable byte streams in the Blink Implementation based on the latest spec changes in the Streams API standard. These updates fix various issues related to readable byte streams and improve standards compliance.

These changes include:
- respondWithNewView(newView) can now be called with a new view that is smaller than the BYOB request's view
- respondWithNewView() cannot be called with a non-empty view when the stream is closed
- respondWithNewView(newView) must now be called with a view whose buffer has the same length as that of the BYOB request
- enqueue(chunk) and respondWithNewView(newView) now checks that the given view's buffer is actually transferable
- enqueue() and respond() now checks that the BYOB request's view has not been transferred
- enqueue(), respond() and respondWithNewView() immediately invalidates the BYOB request
- Any pending BYOB reads are now resolved immediately on cancel()
- enqueue() now discards the BYOB request if it was auto-allocated

(For reference:,, and

Nidhi Jaju

Reilly Grant

Oct 13, 2021, 12:59:44 PM10/13/21
to Nidhi Jaju, blink-dev, Adam Rice
This is somewhat of a tangent but I'm curious what the use case for respondWithNewView() is when it seems like the "new" view can only be the existing view but shorter. It seems equivalent to calling respondWith(newView.byteLength).
Reilly Grant | Software Engineer | | Google Chrome

You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Adam Rice

Oct 13, 2021, 1:06:09 PM10/13/21
to Reilly Grant, Nidhi Jaju, blink-dev
Yes. The only use case of respondWithNewView() is when you've transferred the ArrayBuffer and so you can't use respond(). Most people will never need it.
Reply all
Reply to author
0 new messages