-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
LibWeb: Implement Blob::text and Blob::array_buffer to spec #19404
Conversation
Userland/Libraries/LibWeb/Streams/ReadableStreamDefaultReader.cpp
Outdated
Show resolved
Hide resolved
Userland/Libraries/LibWeb/Streams/ReadableStreamDefaultReader.cpp
Outdated
Show resolved
Hide resolved
@mattco98 just in case you know, would you have any idea what may be resulting in needing this FIXME?
I've been looking through the spec, and haven't found anything yet for that. I'm thinking there is a possibility of it being a spec issue, but am not confident in that at all. |
I agree, this does seem like a spec issue. It looks like JSC also does this, though of course they're doing it asynchronously. |
Thanks @mattco98 for the review, think I should have hopefully addressed everything 😀 |
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!
I also just now realized that hitting "Comment" in the review box instead of "Request Changes" makes the comments non-collapsable, sorry for spamming up your PR 😅
No worries! |
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.
Some nit on east const, other than that looks good
I found myself needing to call this method when attempting to implement Blob::text and Blob::array_buffer. Turns out that the only caller outside of the Detail namespace already had a FIXME to make this a public API - so let's do that.
This algorithm is used by ReadableStreamDefaultReader to read all bytes from a given stream. Currently the algorithm used is somewhat naive as it is recursive, but given the initial use of this reader, it should not be a problem.
This is not to the specification, but as the FIXME comment for the function states, we need it to be able to properly interface with the FileAPI spcification, which seems to have not been updated to the non promise based API.
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, nice work!
After adding ReadableStreamDefaultReader::read_all_bytes, all of the
pieces are in place to implement these functions to spec!