LibWeb: Use unbuffered network requests for all Fetch requests

Previously, unbuffered requests were only available as a special mode
for EventSource. With this change, they are enabled by default, which
means chunks can be read from the stream as soon as they arrive.

This unlocks some interesting possibilities, such as starting to parse
HTML documents before the entire response has been received (that, in
turn, allows us to initiate subresource fetches earlier or begin
executing scripts sooner), or start rendering videos before they are
fully downloaded.

Co-authored-by: Timothy Flynn <trflynn89@pm.me>
This commit is contained in:
Aliaksandr Kalenik 2025-04-17 07:58:24 -04:00 committed by Tim Flynn
parent f942fef39b
commit 3058274386
Notes: github-actions[bot] 2025-11-20 11:30:52 +00:00
4 changed files with 185 additions and 184 deletions

View file

@ -544,8 +544,9 @@ void ResourceLoader::load_unbuffered(LoadRequest& request, GC::Root<OnHeadersRec
}
if (!url.scheme().is_one_of("http"sv, "https"sv)) {
// FIXME: Non-network requests from fetch should not go through this path.
on_complete->function()(false, {}, "Cannot establish connection non-network scheme"sv);
auto not_implemented_error = ByteString::formatted("Protocol not implemented: {}", url.scheme());
log_failure(request, not_implemented_error);
on_complete->function()(false, {}, not_implemented_error);
return;
}