LibWeb: Remove exception throwing from Fetch

These were only here to manage OOMs, but there's not really any way to
recover from small OOMs in Fetch especially with its async nature.
This commit is contained in:
Luke Wilde 2025-09-30 17:15:55 +01:00 committed by Alexander Kalenik
parent baa9b6cc34
commit 167de08c81
Notes: github-actions[bot] 2025-11-07 03:09:49 +00:00
22 changed files with 96 additions and 111 deletions

View file

@ -325,7 +325,7 @@ String resolve_a_module_integrity_metadata(URL::URL const& url, EnvironmentSetti
}
// https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-classic-script
WebIDL::ExceptionOr<void> fetch_classic_script(GC::Ref<HTMLScriptElement> element, URL::URL const& url, EnvironmentSettingsObject& settings_object, ScriptFetchOptions options, CORSSettingAttribute cors_setting, String character_encoding, OnFetchScriptComplete on_complete)
void fetch_classic_script(GC::Ref<HTMLScriptElement> element, URL::URL const& url, EnvironmentSettingsObject& settings_object, ScriptFetchOptions options, CORSSettingAttribute cors_setting, String character_encoding, OnFetchScriptComplete on_complete)
{
auto& realm = element->realm();
auto& vm = realm.vm();
@ -385,8 +385,7 @@ WebIDL::ExceptionOr<void> fetch_classic_script(GC::Ref<HTMLScriptElement> elemen
on_complete->function()(script);
};
TRY(Fetch::Fetching::fetch(element->realm(), request, Fetch::Infrastructure::FetchAlgorithms::create(vm, move(fetch_algorithms_input))));
return {};
Fetch::Fetching::fetch(element->realm(), request, Fetch::Infrastructure::FetchAlgorithms::create(vm, move(fetch_algorithms_input)));
}
// https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-classic-worker-script
@ -464,7 +463,7 @@ WebIDL::ExceptionOr<void> fetch_classic_worker_script(URL::URL const& url, Envir
else {
Fetch::Infrastructure::FetchAlgorithms::Input fetch_algorithms_input {};
fetch_algorithms_input.process_response_consume_body = move(process_response_consume_body);
TRY(Fetch::Fetching::fetch(realm, request, Fetch::Infrastructure::FetchAlgorithms::create(vm, move(fetch_algorithms_input))));
Fetch::Fetching::fetch(realm, request, Fetch::Infrastructure::FetchAlgorithms::create(vm, move(fetch_algorithms_input)));
}
return {};
}
@ -507,7 +506,7 @@ WebIDL::ExceptionOr<GC::Ref<ClassicScript>> fetch_a_classic_worker_imported_scri
else {
Fetch::Infrastructure::FetchAlgorithms::Input fetch_algorithms_input {};
fetch_algorithms_input.process_response_consume_body = move(process_response_consume_body);
TRY(Fetch::Fetching::fetch(realm, request, Fetch::Infrastructure::FetchAlgorithms::create(vm, move(fetch_algorithms_input))));
Fetch::Fetching::fetch(realm, request, Fetch::Infrastructure::FetchAlgorithms::create(vm, move(fetch_algorithms_input)));
}
// 5. Pause until response is not null.
@ -728,7 +727,7 @@ void fetch_single_module_script(JS::Realm& realm,
} else {
Fetch::Infrastructure::FetchAlgorithms::Input fetch_algorithms_input {};
fetch_algorithms_input.process_response_consume_body = move(process_response_consume_body);
Fetch::Fetching::fetch(realm, request, Fetch::Infrastructure::FetchAlgorithms::create(realm.vm(), move(fetch_algorithms_input))).release_value_but_fixme_should_propagate_errors();
Fetch::Fetching::fetch(realm, request, Fetch::Infrastructure::FetchAlgorithms::create(realm.vm(), move(fetch_algorithms_input)));
}
}