Intent to Ship: Expose TransformStreamDefaultController

59 views
Skip to first unread message

Domenic Denicola

unread,
Jul 14, 2022, 12:28:11 AM7/14/22
to blink-dev

Contact emails

dom...@chromium.org

Explainer

None (below "Summary" and "Motivation" should be enough).

Specification

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

Summary

This exposes the TransformStreamDefaultController class on the global scope. This class already exists and can be accessed using code such as let TransformStreamDefaultController; new TransformStream({ start(c) { TransformStreamDefaultController = c.constructor; } }); This change makes such code unnecessary as now TransformStreamDefaultController just exists on the global scope.


Motivation

Possible uses for the exposed class include monkeypatching properties onto TransformStreamDefaultController.prototype, or feature-testing existing properties of it more easily. (Note that the class is not constructible, i.e. new TransformStreamDefaultController() always throws, so that is not a potential use.)

However, these uses are fairly esoteric. In practice this is mostly a spec-conformance fix motivated by consistency.


Blink component

Blink>Network>StreamsAPI


TAG review status

Not applicable

Risks



Interoperability and Compatibility

No interop risk. This is already implemented in all other browsers. Compat risk is minimal. It would be hard for any existing code to take a dependency on this class not being exposed. Other related classes (e.g. TransformStream itself) are already exposed. And we expose lots of classes all the time without issue whenever shipping new features.



Gecko: Shipped/Shipping (https://wpt.fyi/results/streams/idlharness.any.html?label=experimental&label=master&aligned)

WebKit: Shipped/Shipping (https://wpt.fyi/results/streams/idlharness.any.html?label=experimental&label=master&aligned)

Web developers: No signals

Activation

This feature can be polyfilled with the single line of code: new TransformStream({ start(c) { self.TransformStreamDefaultController = c.constructor; } });


WebView application risks

Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?
No



Debuggability

No special DevTools support needed.



Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?

Yes

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

Yes

Requires code in //chrome?

False

Tracking bug

https://bugs.chromium.org/p/chromium/issues/detail?id=1093862

Estimated milestones

M105



Anticipated spec changes

Open questions about a feature may be a source of future web compat or interop issues. Please list open issues (e.g. links to known github issues in the project for the feature specification) whose resolution may introduce web compat/interop risk (e.g., changing to naming or structure of the API in a non-backward-compatible way).

None.

Link to entry on the Chrome Platform Status

https://chromestatus.com/feature/5130793182035968

This intent message was generated by Chrome Platform Status.

slightlyoff via Chromestatus

unread,
Jul 14, 2022, 5:13:36 AM7/14/22
to blin...@chromium.org
Thanks for filing this intent.

Yoav Weiss

unread,
Jul 20, 2022, 5:25:47 AM7/20/22
to blink-dev, dom...@google.com
LGTM1

On Thursday, July 14, 2022 at 6:28:11 AM UTC+2 dom...@google.com wrote:

Contact emails

dom...@chromium.org

Explainer

None (below "Summary" and "Motivation" should be enough).

Specification

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

Summary

This exposes the TransformStreamDefaultController class on the global scope. This class already exists and can be accessed using code such as let TransformStreamDefaultController; new TransformStream({ start(c) { TransformStreamDefaultController = c.constructor; } }); This change makes such code unnecessary as now TransformStreamDefaultController just exists on the global scope.


Motivation

Possible uses for the exposed class include monkeypatching properties onto TransformStreamDefaultController.prototype, or feature-testing existing properties of it more easily. (Note that the class is not constructible, i.e. new TransformStreamDefaultController() always throws, so that is not a potential use.)

However, these uses are fairly esoteric. In practice this is mostly a spec-conformance fix motivated by consistency.


Blink component

Blink>Network>StreamsAPI


TAG review status

Not applicable

Risks



Interoperability and Compatibility

No interop risk. This is already implemented in all other browsers. Compat risk is minimal. It would be hard for any existing code to take a dependency on this class not being exposed. Other related classes (e.g. TransformStream itself) are already exposed. And we expose lots of classes all the time without issue whenever shipping new features.


Scanning the HTTPArchive showed that this string already appears quite a bit in content, but looking at a few examples, it seems unlikely most of them look at this class, let alone rely on its non-existence. So I agree the compat risk here is small. Other browsers already shipping this is also a reassuring factor.

Daniel Bratell

unread,
Jul 20, 2022, 7:34:28 AM7/20/22
to Yoav Weiss, blink-dev, dom...@google.com

LGTM2

/Daniel

--
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/49740f12-6dd4-4ca2-8ee0-038752f04f93n%40chromium.org.

Daniel Bratell

unread,
Jul 20, 2022, 7:39:28 AM7/20/22
to slightlyoff via Chromestatus, blin...@chromium.org

Alex, was this meant to be an approval?

/Daniel

On 2022-07-14 11:13, slightlyoff via Chromestatus wrote:
Thanks for filing this intent.
--
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.

Mike Taylor

unread,
Jul 20, 2022, 9:03:33 AM7/20/22
to Daniel Bratell, Yoav Weiss, blink-dev, dom...@google.com
Reply all
Reply to author
Forward
0 new messages