stream: reject strings in ReadableStream.from#64465
Conversation
Use Web IDL async_sequence semantics for ReadableStream.from(), which require the input to be an object. This causes primitive strings to throw a TypeError instead of being iterated by code point. Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com> Assisted-by: openai:gpt-5.6-sol
|
Review requested:
|
|
I'd rather go a different way with this... while it is not strictly spec compliant, |
|
Tests have been merged in web-platform-tests/wpt@99d74f9, so you can do a proper
@jasnell Sure, we can discuss. For reference, the original decision for throwing on |
Refs: #64288
Depends on: web-platform-tests/wpt#59594
Use Web IDL
async_sequence<any>semantics forReadableStream.from().This changes
ReadableStream.from('abc')to throw aTypeErrorinsteadof iterating over the string's Unicode code points. Web IDL async
sequences require the input value to be an ECMAScript object.
The corresponding WPT change is included provisionally. This PR should
not land until the upstream WPT PR is merged. Afterward, the Streams WPT
fixtures will be regenerated with
git node wpt streams.Assisted-by: openai:gpt-5.6-sol