diff --git a/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp b/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp index 377ae146596..059cd7e85e2 100644 --- a/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Fetching/Fetching.cpp @@ -417,16 +417,16 @@ WebIDL::ExceptionOr> main_fetch(JS::Realm& realm, Inf // 2. Set response to the following filtered response with response as its internal response, depending // on request’s response tainting: - response = TRY_OR_IGNORE([&]() -> WebIDL::ExceptionOr> { + response = [&]() -> JS::NonnullGCPtr { switch (request->response_tainting()) { // -> "basic" case Infrastructure::Request::ResponseTainting::Basic: // basic filtered response - return TRY_OR_THROW_OOM(vm, Infrastructure::BasicFilteredResponse::create(vm, *response)); + return Infrastructure::BasicFilteredResponse::create(vm, *response); // -> "cors" case Infrastructure::Request::ResponseTainting::CORS: // CORS filtered response - return TRY_OR_THROW_OOM(vm, Infrastructure::CORSFilteredResponse::create(vm, *response)); + return Infrastructure::CORSFilteredResponse::create(vm, *response); // -> "opaque" case Infrastructure::Request::ResponseTainting::Opaque: // opaque filtered response @@ -434,7 +434,7 @@ WebIDL::ExceptionOr> main_fetch(JS::Realm& realm, Inf default: VERIFY_NOT_REACHED(); } - }()); + }(); } // 15. Let internalResponse be response, if response is a network error, and response’s internal response diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.cpp b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.cpp index b6e48eb6a39..079ec1309b0 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.cpp @@ -146,18 +146,18 @@ ErrorOr> Response::location_url(Optional const& reque } // https://fetch.spec.whatwg.org/#concept-response-clone -WebIDL::ExceptionOr> Response::clone(JS::Realm& realm) const +JS::NonnullGCPtr Response::clone(JS::Realm& realm) const { // To clone a response response, run these steps: auto& vm = realm.vm(); // 1. If response is a filtered response, then return a new identical filtered response whose internal response is a clone of response’s internal response. if (is(*this)) { - auto internal_response = TRY(static_cast(*this).internal_response()->clone(realm)); + auto internal_response = static_cast(*this).internal_response()->clone(realm); if (is(*this)) - return TRY_OR_THROW_OOM(vm, BasicFilteredResponse::create(vm, internal_response)); + return BasicFilteredResponse::create(vm, internal_response); if (is(*this)) - return TRY_OR_THROW_OOM(vm, CORSFilteredResponse::create(vm, internal_response)); + return CORSFilteredResponse::create(vm, internal_response); if (is(*this)) return OpaqueFilteredResponse::create(vm, internal_response); if (is(*this)) @@ -231,7 +231,7 @@ void FilteredResponse::visit_edges(JS::Cell::Visitor& visitor) visitor.visit(m_internal_response); } -ErrorOr> BasicFilteredResponse::create(JS::VM& vm, JS::NonnullGCPtr internal_response) +JS::NonnullGCPtr BasicFilteredResponse::create(JS::VM& vm, JS::NonnullGCPtr internal_response) { // A basic filtered response is a filtered response whose type is "basic" and header list excludes // any headers in internal response’s header list whose name is a forbidden response-header name. @@ -256,7 +256,7 @@ void BasicFilteredResponse::visit_edges(JS::Cell::Visitor& visitor) visitor.visit(m_header_list); } -ErrorOr> CORSFilteredResponse::create(JS::VM& vm, JS::NonnullGCPtr internal_response) +JS::NonnullGCPtr CORSFilteredResponse::create(JS::VM& vm, JS::NonnullGCPtr internal_response) { // A CORS filtered response is a filtered response whose type is "cors" and header list excludes // any headers in internal response’s header list whose name is not a CORS-safelisted response-header diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.h b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.h index ec35fc1e633..e5d842048b3 100644 --- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.h +++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.h @@ -109,7 +109,7 @@ public: [[nodiscard]] Optional url() const; [[nodiscard]] ErrorOr> location_url(Optional const& request_fragment) const; - [[nodiscard]] WebIDL::ExceptionOr> clone(JS::Realm&) const; + [[nodiscard]] JS::NonnullGCPtr clone(JS::Realm&) const; [[nodiscard]] JS::NonnullGCPtr unsafe_response(); @@ -227,7 +227,7 @@ class BasicFilteredResponse final : public FilteredResponse { JS_DECLARE_ALLOCATOR(BasicFilteredResponse); public: - [[nodiscard]] static ErrorOr> create(JS::VM&, JS::NonnullGCPtr); + [[nodiscard]] static JS::NonnullGCPtr create(JS::VM&, JS::NonnullGCPtr); [[nodiscard]] virtual Type type() const override { return Type::Basic; } [[nodiscard]] virtual JS::NonnullGCPtr header_list() const override { return m_header_list; } @@ -246,7 +246,7 @@ class CORSFilteredResponse final : public FilteredResponse { JS_DECLARE_ALLOCATOR(CORSFilteredResponse); public: - [[nodiscard]] static ErrorOr> create(JS::VM&, JS::NonnullGCPtr); + [[nodiscard]] static JS::NonnullGCPtr create(JS::VM&, JS::NonnullGCPtr); [[nodiscard]] virtual Type type() const override { return Type::CORS; } [[nodiscard]] virtual JS::NonnullGCPtr header_list() const override { return m_header_list; } diff --git a/Userland/Libraries/LibWeb/Fetch/Response.cpp b/Userland/Libraries/LibWeb/Fetch/Response.cpp index fa993ae5135..99f8e5274e5 100644 --- a/Userland/Libraries/LibWeb/Fetch/Response.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Response.cpp @@ -289,7 +289,7 @@ WebIDL::ExceptionOr> Response::clone() const return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Response is unusable"sv }; // 2. Let clonedResponse be the result of cloning this’s response. - auto cloned_response = TRY(m_response->clone(realm)); + auto cloned_response = m_response->clone(realm); // 3. Return the result of creating a Response object, given clonedResponse, this’s headers’s guard, and this’s relevant Realm. return Response::create(HTML::relevant_realm(*this), cloned_response, m_headers->guard());