LibWeb: Remove OOM propagation from Fetch::Infrastructure::Requests

This commit is contained in:
Timothy Flynn 2024-04-26 13:35:10 -04:00 committed by Andreas Kling
commit 5a4f13dcd4
Notes: sideshowbarker 2024-07-17 02:28:18 +09:00
5 changed files with 24 additions and 28 deletions

View file

@ -994,13 +994,13 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> http_fetch(JS::Realm& rea
// NOTE: As the CORS check is not to be applied to responses whose status is 304 or 407, or responses from
// a service worker for that matter, it is applied here.
if (request->response_tainting() == Infrastructure::Request::ResponseTainting::CORS
&& !TRY_OR_IGNORE(cors_check(request, *response))) {
&& !cors_check(request, *response)) {
returned_pending_response->resolve(Infrastructure::Response::network_error(vm, "Request with 'cors' response tainting failed CORS check"_string));
return;
}
// 5. If the TAO check for request and response returns failure, then set requests timing allow failed flag.
if (!TRY_OR_IGNORE(tao_check(request, *response)))
if (!tao_check(request, *response))
request->set_timing_allow_failed(true);
}
@ -1353,7 +1353,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> http_network_or_cache_fet
}
// 12. Append a request `Origin` header for httpRequest.
TRY_OR_THROW_OOM(vm, http_request->add_origin_header());
http_request->add_origin_header();
// FIXME: 13. Append the Fetch metadata headers for httpRequest.
@ -1876,7 +1876,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> cors_preflight_fetch(JS::
// 7. If a CORS check for request and response returns success and responses status is an ok status, then:
// NOTE: The CORS check is done on request rather than preflight to ensure the correct credentials mode is used.
if (TRY_OR_IGNORE(cors_check(request, response)) && Infrastructure::is_ok_status(response->status())) {
if (cors_check(request, response) && Infrastructure::is_ok_status(response->status())) {
// 1. Let methods be the result of extracting header list values given `Access-Control-Allow-Methods` and responses header list.
auto methods_or_failure = Infrastructure::extract_header_list_values("Access-Control-Allow-Methods"sv.bytes(), response->header_list());