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

@ -12,7 +12,7 @@
namespace Web::Fetch::Fetching {
// https://fetch.spec.whatwg.org/#concept-cors-check
ErrorOr<bool> cors_check(Infrastructure::Request const& request, Infrastructure::Response const& response)
bool cors_check(Infrastructure::Request const& request, Infrastructure::Response const& response)
{
// 1. Let origin be the result of getting `Access-Control-Allow-Origin` from responses header list.
auto origin = response.header_list()->get("Access-Control-Allow-Origin"sv.bytes());
@ -27,7 +27,7 @@ ErrorOr<bool> cors_check(Infrastructure::Request const& request, Infrastructure:
return true;
// 4. If the result of byte-serializing a request origin with request is not origin, then return failure.
if (TRY(request.byte_serialize_origin()) != *origin)
if (request.byte_serialize_origin() != *origin)
return false;
// 5. If requests credentials mode is not "include", then return success.
@ -46,7 +46,7 @@ ErrorOr<bool> cors_check(Infrastructure::Request const& request, Infrastructure:
}
// https://fetch.spec.whatwg.org/#concept-tao-check
ErrorOr<bool> tao_check(Infrastructure::Request const& request, Infrastructure::Response const& response)
bool tao_check(Infrastructure::Request const& request, Infrastructure::Response const& response)
{
// 1. If requests timing allow failed flag is set, then return failure.
if (request.timing_allow_failed())
@ -60,7 +60,7 @@ ErrorOr<bool> tao_check(Infrastructure::Request const& request, Infrastructure::
return true;
// 4. If values contains the result of serializing a request origin with request, then return success.
if (values.has_value() && values->contains_slow(TRY(request.serialize_origin())))
if (values.has_value() && values->contains_slow(request.serialize_origin()))
return true;
// 5. If requests mode is "navigate" and requests current URLs origin is not same origin with requests origin, then return failure.