LibWeb: Make CSS font loader tolerate WPT web server shenanigans

The web server for WPT has a tendency to just disconnect after sending
us a resource. This makes curl think an error occurred, but it's
actually still recoverable and we have the data.

So instead of just bailing, do what we already do for other kinds of
resources and try to parse the data we got. If it works out, great!

It would be nice to solve this in the networking layer instead, but
I'll leave that as an exercise for our future selves.
This commit is contained in:
Andreas Kling 2024-09-21 18:35:31 +02:00 committed by Andreas Kling
commit 32299e74cb
Notes: github-actions[bot] 2024-09-21 17:21:21 +00:00
5 changed files with 32 additions and 16 deletions

View file

@ -120,9 +120,11 @@ void Resource::did_load(Badge<ResourceLoader>, ReadonlyBytes data, HTTP::HeaderM
});
}
void Resource::did_fail(Badge<ResourceLoader>, ByteString const& error, Optional<u32> status_code)
void Resource::did_fail(Badge<ResourceLoader>, ByteString const& error, ReadonlyBytes data, HTTP::HeaderMap const& headers, Optional<u32> status_code)
{
m_error = error;
m_encoded_data = ByteBuffer::copy(data).release_value_but_fixme_should_propagate_errors();
m_response_headers = headers;
m_status_code = move(status_code);
m_state = State::Failed;