Intent to Ship: Expose ReadableStreamDefaultController interface

113 views
Skip to first unread message

Nidhi Jaju

unread,
Dec 8, 2020, 4:10:59 AM12/8/20
to blink-dev, Adam Rice

Contact emails

nidh...@google.comri...@chromium.org

Explainer

https://github.com/whatwg/streams/issues/963
https://github.com/whatwg/streams/pull/1035

Specification

https://streams.spec.whatwg.org/#rs-default-controller-class-definition

API spec

Yes

Summary

The Streams APIs provide ubiquitous, interoperable primitives for creating, composing, and consuming streams of data. We will expose the ReadableStreamDefaultController interface on the global object, as with the other ReadableStream-related classes. This will align Blink with the current version of the Streams API Standard and consensus among the developer community. See https://github.com/whatwg/streams/issues/963.


Blink component

Blink>Network>StreamsAPI

TAG review

There is no TAG review for this since: 
 - It is a tiny change to the interface
 - It does not expose any new functionality 
 - It is already possible to call the ReadableStreamDefaultController constructor explicitly

TAG review status

Not applicable

Risks

Interoperability and Compatibility

Low risk because the Streams API spec has already been standardised for a long time (since around 2014).


Gecko: No signal Jason Orendorff (@jorendorff) reviewed the original PR and gave positive feedback.
WebKit: No signal
Web developers: No signals

Ergonomics

This will move us in line with the standard behaviour for WebIDL-defined classes that are part of the web platform. See https://heycam.github.io/webidl/#NoInterfaceObject and https://heycam.github.io/webidl/#Exposed. This should reduce developer surprise.


Activation

Developers can use this feature immediately, as it does not change the behaviour of existing code. The feature can be polyfilled with one line of JavaScript: new ReadableStream({start(controller) {self.ReadableStreamDefaultController = controller.constructor; }});



Debuggability

No special support needed.


Is this feature fully tested by web-platform-tests?

Yes

Link to entry on the Chrome Platform Status

https://chromestatus.com/feature/5711333280448512

yo...@yoav.ws

unread,
Dec 10, 2020, 3:12:11 AM12/10/20
to blink-dev, Nidhi Jaju, Adam Rice
On Tuesday, December 8, 2020 at 10:10:59 AM UTC+1 Nidhi Jaju wrote:

Could you provide an inline explanation of what the feature is, what it looks like and how developers are supposed to use it?

Nidhi Jaju

unread,
Dec 10, 2020, 10:00:01 PM12/10/20
to yo...@yoav.ws, blink-dev, Adam Rice
Hi Yoav,

The feature is essentially just exposing the ReadableStreamDefaultController on the global object. This means that evaluating 'ReadableStreamDefaultController' in window goes from false to true. Exposing it does not expose any new functionality, so developers are not really affected in any way.


Currently, developers need to write:
new ReadableStream({start(controller) { self.ReadableStreamDefaultController = controller.constructor; }});
to call the ReadableStreamDefaultController constructor.

However, most do not use this anyway, except for maybe in web platform tests, or if they want to wrap the methods for debugging purposes for example. By exposing the interface globally, there is no need to explicitly write this one line of Javascript code anymore.

I've also added this information to the 'Motivation' section to the ChromeStatus entry, so hopefully that helps provide some more clarity/context. Thank you!

Best regards,
Nidhi

Yoav Weiss

unread,
Dec 15, 2020, 1:51:12 AM12/15/20
to Nidhi Jaju, blink-dev, Adam Rice
LGTM1



On Fri, Dec 11, 2020 at 3:59 AM Nidhi Jaju <nidh...@google.com> wrote:
Hi Yoav,

The feature is essentially just exposing the ReadableStreamDefaultController on the global object. This means that evaluating 'ReadableStreamDefaultController' in window goes from false to true. Exposing it does not expose any new functionality, so developers are not really affected in any way.

Currently, developers need to write:
new ReadableStream({start(controller) { self.ReadableStreamDefaultController = controller.constructor; }});
to call the ReadableStreamDefaultController constructor.

However, most do not use this anyway, except for maybe in web platform tests, or if they want to wrap the methods for debugging purposes for example. By exposing the interface globally, there is no need to explicitly write this one line of Javascript code anymore.

I've also added this information to the 'Motivation' section to the ChromeStatus entry, so hopefully that helps provide some more clarity/context. Thank you!

OK, so this is just aligning our behavior to the spec. Got it! :)

TAMURA, Kent

unread,
Dec 15, 2020, 2:33:44 AM12/15/20
to Yoav Weiss, Nidhi Jaju, blink-dev, Adam Rice
LGTM2


--
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 blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CACj%3DBEgYDW-TV-pFXhqxvsAVeJdDxmPMbziMND%3D6KtZg-373KA%40mail.gmail.com.


--
TAMURA Kent
Software Engineer, Google


Daniel Bratell

unread,
Dec 15, 2020, 4:32:26 AM12/15/20
to TAMURA, Kent, Yoav Weiss, Nidhi Jaju, blink-dev, Adam Rice
Reply all
Reply to author
Forward
0 new messages