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: Integrate TransformStream into fetch_response_handover() and Streams into XHR::send() #24132
LibWeb: Integrate TransformStream into fetch_response_handover() and Streams into XHR::send() #24132
Conversation
could you add a test please? |
f5d6e8e
to
e541b13
Compare
Still struggling a bit with this one. Everything works as it did before this change. I have verified that this branch in |
Drafting this until I can figure out why the callbacks are currently not invoked |
I'm hitting a similar issue trying to get My WIP branch is here: https://github.com/trflynn89/serenity/tree/fetch_stream As far as I can tell, the calls to |
Correct! I have tried in the past to convert Going to re-apply this on top of your changes without the |
Yeah, no. This still doesn't work as expected even with your changes. I don't get why the Btw, your changes even without |
Is it potentially because this step is unimplemented, where it's supposed to enqueue body chunks into the stream?
|
That does indeed seem plausible |
Tried to hack something together in Don't have the time to debug it right now, pushed a messy branch here if anyone is curious: https://github.com/kennethmyhra/serenity/tree/integrate-transformstream-in-fetch_response_handover-3 |
That error turns out to be a bug in auto chunk_steps = [&realm, writer](ByteBuffer buffer) {
auto array_buffer = JS::ArrayBuffer::create(realm, move(buffer));
auto chunk = JS::Uint8Array::create(realm, array_buffer->byte_length(), *array_buffer);
auto promise = writable_stream_default_writer_write(writer, chunk);
WebIDL::resolve_promise(realm, promise, JS::js_undefined());
}; and that error goes away. But things still generally don't work after that 😅 FYI I found the real exception here by calling |
Right, I was going through some hoops in the tests back when I implemented Still, with your changes I am not able to remove the hacks in those tests. EDIT: |
f72972f
to
a916af8
Compare
Tests here will fail for XHR and a few other tests. Still not integrated Implemented the concept Tried to implement as close to spec as I could interpret the missing steps from https://fetch.spec.whatwg.org/#concept-bodyinit-extract, which was suggested by Luke above. Still haven't found a proper way to close the stream as specified, since |
8fd0b14
to
d4fca3b
Compare
This is now ready for review, Updated PR description to describe what is implemented and which bugs have been fixed. |
d4fca3b
to
eca2969
Compare
Userland/Libraries/LibWeb/Fetch/Infrastructure/IncrementalReadLoopReadRequest.cpp
Outdated
Show resolved
Hide resolved
Userland/Libraries/LibWeb/Fetch/Infrastructure/IncrementalReadLoopReadRequest.cpp
Outdated
Show resolved
Hide resolved
eca2969
to
f7c957c
Compare
Fixed up the commits according to the suggestions. As for the requests for tests, I have relied on the existing |
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.
Looks good! Thanks for seeing this through. Just one last dangling comment to fixup
This callback is meant to be triggered by streams, which does not always provide a WebIDL::DOMException. Pass a plain value instead. Of all the users of this callback, only one actually uses the value, and already converts the DOMException to a plain value.
ReadLoopReadRequest::on_chunk expects an UInt8Array, so make sure we convert the passed in ByteBuffer to an UInt8Array before passing it to the AO writable_stream_default_writer_write. Co-authored-by: Timothy Flynn <trflynn89@pm.me>
Also adds a test to prove that the WritableStream's close callback is called.
Co-authored-by: Timothy Flynn <trflynn89@pm.me>
f7c957c
to
8862d26
Compare
8862d26
to
9ace173
Compare
Thanks! Glad to see this through myself, the XHR changes have been stashed around since last summer so pretty glad to finally land this. |
This implements:
Fixes a couple bugs: