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
parent 2303142386
commit 32299e74cb
5 changed files with 32 additions and 16 deletions

View File

@@ -121,8 +121,8 @@ RefPtr<Resource> ResourceLoader::load_resource(Resource::Type type, LoadRequest&
[=](auto data, auto& headers, auto status_code) {
const_cast<Resource&>(*resource).did_load({}, data, headers, status_code);
},
[=](auto& error, auto status_code, auto, auto) {
const_cast<Resource&>(*resource).did_fail({}, error, status_code);
[=](auto& error, auto status_code, auto data, auto& headers) {
const_cast<Resource&>(*resource).did_fail({}, error, data, headers, status_code);
});
return resource;