Use async_sequence in ReadableStream.from - #1372
Conversation
|
The spec text doesn't build yet, because I'm waiting for a new release of Bikeshed that includes speced/bikeshed#3297. You can already build it locally by manually updating the pipx install bikeshed
pipx inject bikeshed --force widlparser==1.5.0
make local |
d78c683 to
c7762c2
Compare
| their constructor steps. | ||
|
|
||
| <div algorithm="create a ReadableStream from an async sequence"> | ||
| To <dfn export lt="create from async sequence|create from an async sequence" for="ReadableStream">create</dfn> |
There was a problem hiding this comment.
@lucacasonato Would this work for whatwg/fetch#1291?
c7762c2 to
68ae88a
Compare
8bb3507 to
68ae88a
Compare
68ae88a to
7511a41
Compare
68ae88a to
5ca9d87
Compare
|
CI is (finally) green. Turns out Bikeshed needed to be updated across quite a few tools and services. 😅 Does Chromium and/or Gecko support this change? @ricea perhaps? |
|
@ricea for chromium |
|
Chromium supports this. I haven't had time to check in detail whether this has any unexpected semantic side effects, but the approach looks fine. |
|
Thanks for the responses. I'll start opening implementation bugs.
The |
… a=testonly Automatic update from web-platform-tests Streams: reject strings in `ReadableStream.from` (#59594) Follows whatwg/streams#1372. -- wpt-commits: 78df415978b3a770efa7da946cc212902c07cb38 wpt-pr: 59594
async_sequence in ReadableStream.fromasync_sequence<T> in ReadableStream.from
async_sequence<T> in ReadableStream.fromasync_sequence in ReadableStream.from
Replace the ad-hoc async iterable converter with Web IDL async_sequence conversion (GetMethod, Object-only, CreateAsyncFromSyncIterator) and wire ReadableStream.from to async_sequence<any>, per whatwg/streams#1372. Closes denoland#35777
Replace our manual async iterator logic with the new Web IDL
async_sequence<T>type and its associated operations (added in whatwg/webidl#1397).This comes with one behavioral change:
ReadableStream.from("abc")used to iterate over the Unicode code points of the string (perString.prototype[Symbol.iterator]), but this will now throw aTypeErrorinstead. This is covered by the new WPTs.Developers who want to create a
ReadableStreamfrom a string should update their code to either:ReadableStream.from(["abc"])for a stream with a single chunk"abc"ReadableStream.from([..."abc"])for a stream with three chunks"a","b","c"Supersedes #1310. (Thanks to @lucacasonato for getting this started!)
async_sequenceinReadableStream.from#1372 (review)async_sequenceinReadableStream.from#1372 (review)async_sequenceinReadableStream.from#1372 (comment)ReadableStream.fromweb-platform-tests/wpt#59594async_sequenceinReadableStream.fromdenoland/deno#35777async_sequenceinReadableStream.fromnodejs/node#64288(See WHATWG Working Mode: Changes for more details.)
Preview | Diff