diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Methods.cpp b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Methods.cpp index 92b3aa9f4f6..d9899203cbe 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Methods.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Methods.cpp @@ -36,10 +36,10 @@ bool is_forbidden_method(ReadonlyBytes method) } // https://fetch.spec.whatwg.org/#concept-method-normalize -ErrorOr normalize_method(ReadonlyBytes method) +ByteBuffer normalize_method(ReadonlyBytes method) { // To normalize a method, if it is a byte-case-insensitive match for `DELETE`, `GET`, `HEAD`, `OPTIONS`, `POST`, or `PUT`, byte-uppercase it. - auto bytes = TRY(ByteBuffer::copy(method)); + auto bytes = MUST(ByteBuffer::copy(method)); if (StringView { method }.is_one_of_ignoring_ascii_case("DELETE"sv, "GET"sv, "HEAD"sv, "OPTIONS"sv, "POST"sv, "PUT"sv)) Infra::byte_uppercase(bytes); return bytes; diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Methods.h b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Methods.h index 1258616a603..a98fdca80c2 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Methods.h +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Methods.h @@ -13,6 +13,6 @@ namespace Web::Fetch::Infrastructure { [[nodiscard]] bool is_method(ReadonlyBytes); [[nodiscard]] bool is_cors_safelisted_method(ReadonlyBytes); [[nodiscard]] bool is_forbidden_method(ReadonlyBytes); -[[nodiscard]] ErrorOr normalize_method(ReadonlyBytes); +[[nodiscard]] ByteBuffer normalize_method(ReadonlyBytes); } diff --git a/Userland/Libraries/LibWeb/Fetch/Request.cpp b/Userland/Libraries/LibWeb/Fetch/Request.cpp index 3c3fb5b1f9b..199877e359e 100644 --- a/Userland/Libraries/LibWeb/Fetch/Request.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Request.cpp @@ -373,7 +373,7 @@ WebIDL::ExceptionOr> Request::construct_impl(JS::Realm return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Method must not be one of CONNECT, TRACE, or TRACK"sv }; // 3. Normalize method. - method = TRY_OR_THROW_OOM(vm, String::from_utf8(TRY_OR_THROW_OOM(vm, Infrastructure::normalize_method(method.bytes())))); + method = TRY_OR_THROW_OOM(vm, String::from_utf8(Infrastructure::normalize_method(method.bytes()))); // 4. Set request’s method to method. request->set_method(MUST(ByteBuffer::copy(method.bytes()))); diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp index 9f013e05ee4..426246e996e 100644 --- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp +++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp @@ -475,7 +475,7 @@ WebIDL::ExceptionOr XMLHttpRequest::open(String const& method_string, Stri return WebIDL::SecurityError::create(realm(), "Forbidden method, must not be 'CONNECT', 'TRACE', or 'TRACK'"_fly_string); // 4. Normalize method. - auto normalized_method = TRY_OR_THROW_OOM(vm(), Fetch::Infrastructure::normalize_method(method)); + auto normalized_method = Fetch::Infrastructure::normalize_method(method); // 5. Let parsedURL be the result of parsing url with this’s relevant settings object’s API base URL and this’s relevant settings object’s API URL character encoding. // FIXME: Pass in this’s relevant settings object’s API URL character encoding.