mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 00:29:15 +00:00
LibWeb: Propagate OOM in Body::fully_read() through its error callback
Fetched bodies can be on the order of gigabytes, so rather than crashing when we hit OOM here, we can simply invoke the error callback with a DOM exception. We use "UnknownError" here as the spec directly supports this for OOM errors: UnknownError: The operation failed for an unknown transient reason (e.g. out of memory). This is still an ad-hoc implementation. We should be using streams, and we do have the AOs available to do so. But they need to be massaged to be compatible with callers of Body::fully_read. And once we do use streams, this function will become infallible - so making it infallible here is at least a step in the right direction.
This commit is contained in:
parent
ec5988d56b
commit
1ffda6a805
Notes:
sideshowbarker
2024-07-16 18:03:21 +09:00
Author: https://github.com/trflynn89
Commit: 1ffda6a805
Pull-request: https://github.com/SerenityOS/serenity/pull/24124
10 changed files with 39 additions and 42 deletions
|
@ -539,7 +539,7 @@ WebIDL::ExceptionOr<void> HTMLLinkElement::load_fallback_favicon_if_needed(JS::N
|
|||
|
||||
// 3. Use response's unsafe response as an icon as if it had been declared using the icon keyword.
|
||||
if (auto body = response->unsafe_response()->body())
|
||||
body->fully_read(realm, process_body, process_body_error, global).release_value_but_fixme_should_propagate_errors();
|
||||
body->fully_read(realm, process_body, process_body_error, global);
|
||||
};
|
||||
|
||||
TRY(Fetch::Fetching::fetch(realm, request, Fetch::Infrastructure::FetchAlgorithms::create(vm, move(fetch_algorithms_input))));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue