← Back to release summary

Expose ReadableStreamDefaultController interface

Category
Network / Connectivity
Type
Chromium catches up
Status
Enabled by default (Chrome 89)
Intent stage
Shipped

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.

Motivation

WebIDL does not permit a type to have a constructor while not being exposed on the global object, according to https://heycam.github.io/webidl/#NoInterfaceObject. Hence, the feature is essentially to expose ReadableStreamDefaultController on the global object. What is looks like is that evaluating 'ReadableStreamDefaultController' in window goes from false to true. Exposing this symbol does not expose any new functionality, and hence 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 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.

Standards & signals

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

View on chromestatus.com