summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.cpp')
-rw-r--r--Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.cpp b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.cpp
index 891a46077d..940beba7b6 100644
--- a/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.cpp
+++ b/Userland/Libraries/LibWeb/Fetch/Infrastructure/HTTP/Responses.cpp
@@ -170,6 +170,16 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Response>> Response::clone(JS::Realm& realm
return new_response;
}
+// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#unsafe-response
+JS::NonnullGCPtr<Response> Response::unsafe_response()
+{
+ // A response's unsafe response is its internal response if it has one, and the response itself otherwise.
+ if (is<FilteredResponse>(this))
+ return static_cast<FilteredResponse&>(*this).internal_response();
+
+ return *this;
+}
+
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#cors-cross-origin
bool Response::is_cors_cross_origin() const
{