-
-
Notifications
You must be signed in to change notification settings - Fork 991
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 Web::Fetch::Body::fully_read() closer to spec #2162
base: master
Are you sure you want to change the base?
Conversation
01acc3e
to
f5971c5
Compare
0126630
to
0d96ac3
Compare
I had a branch some time ago where I implemented fully reading with streams: I didn't PR that because I ran into: Is that still an issue? I don't remember all the details, but it was really 2 issues: one related to locking the stream here and not unlocking it (there's a workaround in the branch above for that), and another related to fetch requests that have integrity metadata (never came up with a workaround for that one). |
Oof, missed that you worked on this as well. You seem to have the more in-depth approach as well w/ regard to the callbacks.
No idea, did you have a repro? |
Oh no worries, I had completely forgotten about it and that spec issue hasn't gotten any traction recently, so we could definitely use some help coming up with a workaround for the second issue 😅 I found that discord.com uses fetch integrity metadata, and this is indeed still an issue:
|
There is a potentially related crash for this WPT test: https://staging.wpt.fyi/results/streams/piping/multiple-propagation.any.html |
But I may be getting it completely wrong, I only started an initial investigation of that one today, and I thought it might be relating to these unimplemented steps (and FIXME just after): https://github.com/LadybirdBrowser/ladybird/blob/master/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp#L286 Which isn't the most straight forward to implement because it even involves likely GC allocating a bool to be tracked across various callbacks, and lots of callbacks in general |
In particular, the processBody callback here *can't* move the processBodyError callback. It is needed a few lines after. Passing by value is safe and intended here.
The entire purpose of this AO is to avoid handling exceptions, which we can do now that the underlying AOs do not throw exceptions on OOM.
We now do this step asynchronously.
This will be needed once fetched response bodies are read using streams.
This very partially implements the spec's "finalize" steps for piping streams.
By actually using streams, they get marked as disturbed and the `.bodyUsed` API starts to work. Fixes at least 94 subtests in the WPT `fetch/api/request` test suite. Co-authored-by: Timothy Flynn <[email protected]>
We're not converting `WebIDL::DOMException`, but `WebIDL::Exception` instead.
0d96ac3
to
3b7b0a3
Compare
@trflynn89 FWIW, I've reapplied your commits in my branch here. I'll take a shot at the issues. |
It seems to be related, but not caused by any of the changes in this PR. Let's track it as an issue if we did not open one already :) |
Oh definitely, I was just thinking it could be helpful for debooging if it was same root cause for a reduced test case, thats all :^) |
Turns out I did actually open a PR: SerenityOS/serenity#24396 |
By actually using streams, they get marked as disturbed and the
.bodyUsed
API starts to work. Fixes at least 94 subtests in the WPTfetch/api/request
test suite.Pretty far out of my comfort zone for this so a thorough review is appreciated!
WPT results for
fetch/api/request
, before:And after: