-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Editorial: Add a non-promise version of "fully reading" a stream #1250
Conversation
This makes it easier for non-JS consumers of streams, like the Fetch specs, to use streams without a JS execution context. See whatwg/fetch#1568
a4a65b9
to
f3ca53f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm but please wait for other editors to look at it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works surprisingly well! I think we should just be a bit more aggressive.
index.bs
Outdated
1. Return |promise|. | ||
1. Let |success steps| given a [=byte sequence=] |data| be to [=resolve=] |promise| with |data|. | ||
1. Let |failure steps| given a JavaScript value |error| be to [=reject=] |promise| with |error|. | ||
1. [=Consume all bytes=] from |reader| given |success steps| and |failure steps|. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to get rid of "read all bytes as a promise". Nobody should use it, for various reasons (e.g. having to deal with then
tampering). https://dontcallmedom.github.io/webdex/r.html#read%20all%20bytes%40%40ReadableStreamDefaultReader%40dfn implies it wouldn't be so bad to break some consumers; I think we could fix Fetch ourselves, file issues on the rest, then move on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good, once this is reviewed I'll post a Fetch patch and issues to the other specs.
No problem for Chrome, we don't do "full reading" at the JavaScript layer anyway. I think you can call us "interested" because it clears up any possible difference between our implementation and the spec. |
I think this is purely editorial anyway.. |
Co-authored-by: Domenic Denicola <d@domenic.me>
Co-authored-by: Domenic Denicola <d@domenic.me>
Co-authored-by: Domenic Denicola <d@domenic.me>
They are not designed for that and don't work well (e.g., resolve expects a JS value). Follows whatwg/streams#1250 and addresses the Fetch part of whatwg/streams#1178. Closes #1568. Co-authored-by: Domenic Denicola <d@domenic.me> Co-authored-by: Anne van Kesteren <annevk@annevk.nl>
This makes it easier for non-JS consumers of streams, like the Fetch specs, to use streams without a JS
execution context.
See whatwg/fetch#1568
(See WHATWG Working Mode: Changes for more details.)
Preview | Diff