Skip to content
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

Merged
merged 6 commits into from
Jun 18, 2023

Conversation

shannonbooth
Copy link
Member

@shannonbooth shannonbooth commented Jun 15, 2023

After adding ReadableStreamDefaultReader::read_all_bytes, all of the
pieces are in place to implement these functions to spec!

@github-actions github-actions bot added the 👀 pr-needs-review PR needs review from a maintainer or community member label Jun 15, 2023
@shannonbooth shannonbooth changed the title LibWeb: Make Bindings::dom_exception_to_throw_completion public API LibWeb:Implement Blob::text and Blob::array_buffer to spec Jun 15, 2023
@shannonbooth
Copy link
Member Author

@mattco98 just in case you know, would you have any idea what may be resulting in needing this FIXME?

// FIXME: Close the stream now that we have finished enqueuing all chunks to the stream. Without this, ReadableStream.read will never resolve the second time around with 'done' set.

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.

@mattco98
Copy link
Collaborator

mattco98 commented Jun 15, 2023

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.

@shannonbooth shannonbooth changed the title LibWeb:Implement Blob::text and Blob::array_buffer to spec LibWeb: Implement Blob::text and Blob::array_buffer to spec Jun 17, 2023
@shannonbooth
Copy link
Member Author

shannonbooth commented Jun 17, 2023

Thanks @mattco98 for the review, think I should have hopefully addressed everything 😀

Copy link
Collaborator

@mattco98 mattco98 left a 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 😅

@shannonbooth
Copy link
Member Author

No worries!

Copy link
Member

@kennethmyhra kennethmyhra left a 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

Userland/Libraries/LibWeb/FileAPI/Blob.cpp Outdated Show resolved Hide resolved
Userland/Libraries/LibWeb/FileAPI/Blob.cpp Outdated Show resolved Hide resolved
Userland/Libraries/LibWeb/FileAPI/Blob.cpp Outdated Show resolved Hide resolved
Userland/Libraries/LibWeb/FileAPI/Blob.cpp Outdated Show resolved Hide resolved
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.
Copy link
Member

@kennethmyhra kennethmyhra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nice work!

@kennethmyhra kennethmyhra added the ✅ pr-community-approved PR has been approved by a community member label Jun 18, 2023
@awesomekling awesomekling merged commit ef391de into SerenityOS:master Jun 18, 2023
14 checks passed
@github-actions github-actions bot removed 👀 pr-needs-review PR needs review from a maintainer or community member ✅ pr-community-approved PR has been approved by a community member labels Jun 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants