mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:27:44 +00:00
LibWeb: Make Fetch::Infrastructure::{Request,Response} ref-counted
With the addition of the 'fetch params' struct, the single ownership model we had so far falls apart completely. Additionally, this works nicely for FilteredResponse's internal response instead of risking a dangling reference. Replacing the public constructor with a create() function also found a few instances of a Request being stack-allocated!
This commit is contained in:
parent
886ca9c7b6
commit
1c12f5c31d
14 changed files with 228 additions and 175 deletions
|
@ -14,6 +14,11 @@ Request::Request()
|
|||
{
|
||||
}
|
||||
|
||||
NonnullRefPtr<Request> Request::create()
|
||||
{
|
||||
return adopt_ref(*new Request());
|
||||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-request-url
|
||||
AK::URL const& Request::url() const
|
||||
{
|
||||
|
@ -164,15 +169,50 @@ ErrorOr<ByteBuffer> Request::byte_serialize_origin() const
|
|||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-request-clone
|
||||
WebIDL::ExceptionOr<NonnullOwnPtr<Request>> Request::clone() const
|
||||
WebIDL::ExceptionOr<NonnullRefPtr<Request>> Request::clone() const
|
||||
{
|
||||
// To clone a request request, run these steps:
|
||||
|
||||
// 1. Let newRequest be a copy of request, except for its body.
|
||||
BodyType tmp_body;
|
||||
swap(tmp_body, const_cast<BodyType&>(m_body));
|
||||
auto new_request = make<Infrastructure::Request>(*this);
|
||||
swap(tmp_body, const_cast<BodyType&>(m_body));
|
||||
auto new_request = Infrastructure::Request::create();
|
||||
new_request->set_method(m_method);
|
||||
new_request->set_local_urls_only(m_local_urls_only);
|
||||
for (auto const& header : *m_header_list)
|
||||
MUST(new_request->header_list()->append(header));
|
||||
new_request->set_unsafe_request(m_unsafe_request);
|
||||
new_request->set_client(m_client);
|
||||
new_request->set_reserved_client(m_reserved_client);
|
||||
new_request->set_replaces_client_id(m_replaces_client_id);
|
||||
new_request->set_window(m_window);
|
||||
new_request->set_keepalive(m_keepalive);
|
||||
new_request->set_initiator_type(m_initiator_type);
|
||||
new_request->set_service_workers_mode(m_service_workers_mode);
|
||||
new_request->set_initiator(m_initiator);
|
||||
new_request->set_destination(m_destination);
|
||||
new_request->set_priority(m_priority);
|
||||
new_request->set_origin(m_origin);
|
||||
new_request->set_policy_container(m_policy_container);
|
||||
new_request->set_referrer(m_referrer);
|
||||
new_request->set_referrer_policy(m_referrer_policy);
|
||||
new_request->set_mode(m_mode);
|
||||
new_request->set_use_cors_preflight(m_use_cors_preflight);
|
||||
new_request->set_credentials_mode(m_credentials_mode);
|
||||
new_request->set_use_url_credentials(m_use_url_credentials);
|
||||
new_request->set_cache_mode(m_cache_mode);
|
||||
new_request->set_redirect_mode(m_redirect_mode);
|
||||
new_request->set_integrity_metadata(m_integrity_metadata);
|
||||
new_request->set_cryptographic_nonce_metadata(m_cryptographic_nonce_metadata);
|
||||
new_request->set_parser_metadata(m_parser_metadata);
|
||||
new_request->set_reload_navigation(m_reload_navigation);
|
||||
new_request->set_history_navigation(m_history_navigation);
|
||||
new_request->set_user_activation(m_user_activation);
|
||||
new_request->set_render_blocking(m_render_blocking);
|
||||
new_request->set_url_list(m_url_list);
|
||||
new_request->set_redirect_count(m_redirect_count);
|
||||
new_request->set_response_tainting(m_response_tainting);
|
||||
new_request->set_prevent_no_cache_cache_control_header_modification(m_prevent_no_cache_cache_control_header_modification);
|
||||
new_request->set_done(m_done);
|
||||
new_request->set_timing_allow_failed(m_timing_allow_failed);
|
||||
|
||||
// 2. If request’s body is non-null, set newRequest’s body to the result of cloning request’s body.
|
||||
if (auto const* body = m_body.get_pointer<Body>())
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <AK/Error.h>
|
||||
#include <AK/Forward.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/URL.h>
|
||||
#include <AK/Variant.h>
|
||||
|
@ -23,7 +24,7 @@
|
|||
namespace Web::Fetch::Infrastructure {
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-request
|
||||
class Request final {
|
||||
class Request final : public RefCounted<Request> {
|
||||
public:
|
||||
enum class CacheMode {
|
||||
Default,
|
||||
|
@ -154,7 +155,7 @@ public:
|
|||
using ReservedClientType = Variant<Empty, HTML::Environment*, HTML::EnvironmentSettingsObject*>;
|
||||
using WindowType = Variant<Window, HTML::EnvironmentSettingsObject*>;
|
||||
|
||||
Request();
|
||||
static NonnullRefPtr<Request> create();
|
||||
|
||||
[[nodiscard]] ReadonlyBytes method() const { return m_method; }
|
||||
void set_method(ByteBuffer method) { m_method = move(method); }
|
||||
|
@ -290,13 +291,15 @@ public:
|
|||
[[nodiscard]] String serialize_origin() const;
|
||||
[[nodiscard]] ErrorOr<ByteBuffer> byte_serialize_origin() const;
|
||||
|
||||
[[nodiscard]] WebIDL::ExceptionOr<NonnullOwnPtr<Request>> clone() const;
|
||||
[[nodiscard]] WebIDL::ExceptionOr<NonnullRefPtr<Request>> clone() const;
|
||||
|
||||
[[nodiscard]] ErrorOr<void> add_range_reader(u64 first, Optional<u64> const& last);
|
||||
|
||||
[[nodiscard]] bool cross_origin_embedder_policy_allows_credentials() const;
|
||||
|
||||
private:
|
||||
Request();
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-request-method
|
||||
// A request has an associated method (a method). Unless stated otherwise it is `GET`.
|
||||
ByteBuffer m_method { ByteBuffer::copy("GET"sv.bytes()).release_value() };
|
||||
|
|
|
@ -14,20 +14,25 @@ Response::Response()
|
|||
{
|
||||
}
|
||||
|
||||
NonnullRefPtr<Response> Response::create()
|
||||
{
|
||||
return adopt_ref(*new Response());
|
||||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#ref-for-concept-network-error%E2%91%A3
|
||||
// A network error is a response whose status is always 0, status message is always
|
||||
// the empty byte sequence, header list is always empty, and body is always null.
|
||||
|
||||
NonnullOwnPtr<Response> Response::aborted_network_error()
|
||||
NonnullRefPtr<Response> Response::aborted_network_error()
|
||||
{
|
||||
auto response = network_error();
|
||||
response->set_aborted(true);
|
||||
return response;
|
||||
}
|
||||
|
||||
NonnullOwnPtr<Response> Response::network_error()
|
||||
NonnullRefPtr<Response> Response::network_error()
|
||||
{
|
||||
auto response = make<Response>();
|
||||
auto response = Response::create();
|
||||
response->set_status(0);
|
||||
response->set_type(Type::Error);
|
||||
VERIFY(!response->body().has_value());
|
||||
|
@ -83,17 +88,28 @@ ErrorOr<Optional<AK::URL>> Response::location_url(Optional<String> const& reques
|
|||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-response-clone
|
||||
WebIDL::ExceptionOr<NonnullOwnPtr<Response>> Response::clone() const
|
||||
WebIDL::ExceptionOr<NonnullRefPtr<Response>> Response::clone() const
|
||||
{
|
||||
// To clone a response response, run these steps:
|
||||
|
||||
// FIXME: 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.
|
||||
|
||||
// 2. Let newResponse be a copy of response, except for its body.
|
||||
Optional<Body> tmp_body;
|
||||
swap(tmp_body, const_cast<Optional<Body>&>(m_body));
|
||||
auto new_response = make<Infrastructure::Response>(*this);
|
||||
swap(tmp_body, const_cast<Optional<Body>&>(m_body));
|
||||
auto new_response = Infrastructure::Response::create();
|
||||
new_response->set_type(m_type);
|
||||
new_response->set_aborted(m_aborted);
|
||||
new_response->set_url_list(m_url_list);
|
||||
new_response->set_status(m_status);
|
||||
new_response->set_status_message(m_status_message);
|
||||
for (auto const& header : *m_header_list)
|
||||
MUST(new_response->header_list()->append(header));
|
||||
new_response->set_cache_state(m_cache_state);
|
||||
new_response->set_cors_exposed_header_name_list(m_cors_exposed_header_name_list);
|
||||
new_response->set_range_requested(m_range_requested);
|
||||
new_response->set_request_includes_credentials(m_request_includes_credentials);
|
||||
new_response->set_timing_allow_passed(m_timing_allow_passed);
|
||||
new_response->set_body_info(m_body_info);
|
||||
// FIXME: service worker timing info
|
||||
|
||||
// 3. If response’s body is non-null, then set newResponse’s body to the result of cloning response’s body.
|
||||
if (m_body.has_value())
|
||||
|
@ -103,8 +119,8 @@ WebIDL::ExceptionOr<NonnullOwnPtr<Response>> Response::clone() const
|
|||
return new_response;
|
||||
}
|
||||
|
||||
FilteredResponse::FilteredResponse(Response& internal_response)
|
||||
: m_internal_response(internal_response)
|
||||
FilteredResponse::FilteredResponse(NonnullRefPtr<Response> internal_response)
|
||||
: m_internal_response(move(internal_response))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -112,69 +128,69 @@ FilteredResponse::~FilteredResponse()
|
|||
{
|
||||
}
|
||||
|
||||
ErrorOr<NonnullOwnPtr<BasicFilteredResponse>> BasicFilteredResponse::create(Response& internal_response)
|
||||
ErrorOr<NonnullRefPtr<BasicFilteredResponse>> BasicFilteredResponse::create(NonnullRefPtr<Response> 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.
|
||||
auto header_list = make_ref_counted<HeaderList>();
|
||||
for (auto const& header : *internal_response.header_list()) {
|
||||
for (auto const& header : *internal_response->header_list()) {
|
||||
if (!is_forbidden_response_header_name(header.name))
|
||||
TRY(header_list->append(header));
|
||||
}
|
||||
|
||||
return adopt_own(*new BasicFilteredResponse(internal_response, move(header_list)));
|
||||
return adopt_ref(*new BasicFilteredResponse(internal_response, move(header_list)));
|
||||
}
|
||||
|
||||
BasicFilteredResponse::BasicFilteredResponse(Response& internal_response, NonnullRefPtr<HeaderList> header_list)
|
||||
: FilteredResponse(internal_response)
|
||||
BasicFilteredResponse::BasicFilteredResponse(NonnullRefPtr<Response> internal_response, NonnullRefPtr<HeaderList> header_list)
|
||||
: FilteredResponse(move(internal_response))
|
||||
, m_header_list(move(header_list))
|
||||
{
|
||||
}
|
||||
|
||||
ErrorOr<NonnullOwnPtr<CORSFilteredResponse>> CORSFilteredResponse::create(Response& internal_response)
|
||||
ErrorOr<NonnullRefPtr<CORSFilteredResponse>> CORSFilteredResponse::create(NonnullRefPtr<Response> 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
|
||||
// name, given internal response’s CORS-exposed header-name list.
|
||||
Vector<ReadonlyBytes> cors_exposed_header_name_list;
|
||||
for (auto const& header_name : internal_response.cors_exposed_header_name_list())
|
||||
for (auto const& header_name : internal_response->cors_exposed_header_name_list())
|
||||
cors_exposed_header_name_list.append(header_name.span());
|
||||
|
||||
auto header_list = make_ref_counted<HeaderList>();
|
||||
for (auto const& header : *internal_response.header_list()) {
|
||||
for (auto const& header : *internal_response->header_list()) {
|
||||
if (is_cors_safelisted_response_header_name(header.name, cors_exposed_header_name_list))
|
||||
TRY(header_list->append(header));
|
||||
}
|
||||
|
||||
return adopt_own(*new CORSFilteredResponse(internal_response, move(header_list)));
|
||||
return adopt_ref(*new CORSFilteredResponse(internal_response, move(header_list)));
|
||||
}
|
||||
|
||||
CORSFilteredResponse::CORSFilteredResponse(Response& internal_response, NonnullRefPtr<HeaderList> header_list)
|
||||
: FilteredResponse(internal_response)
|
||||
CORSFilteredResponse::CORSFilteredResponse(NonnullRefPtr<Response> internal_response, NonnullRefPtr<HeaderList> header_list)
|
||||
: FilteredResponse(move(internal_response))
|
||||
, m_header_list(move(header_list))
|
||||
{
|
||||
}
|
||||
|
||||
NonnullOwnPtr<OpaqueFilteredResponse> OpaqueFilteredResponse::create(Response& internal_response)
|
||||
NonnullRefPtr<OpaqueFilteredResponse> OpaqueFilteredResponse::create(NonnullRefPtr<Response> internal_response)
|
||||
{
|
||||
// An opaque-redirect filtered response is a filtered response whose type is "opaqueredirect",
|
||||
// status is 0, status message is the empty byte sequence, header list is empty, and body is null.
|
||||
return adopt_own(*new OpaqueFilteredResponse(internal_response));
|
||||
return adopt_ref(*new OpaqueFilteredResponse(move(internal_response)));
|
||||
}
|
||||
|
||||
OpaqueFilteredResponse::OpaqueFilteredResponse(Response& internal_response)
|
||||
: FilteredResponse(internal_response)
|
||||
OpaqueFilteredResponse::OpaqueFilteredResponse(NonnullRefPtr<Response> internal_response)
|
||||
: FilteredResponse(move(internal_response))
|
||||
, m_header_list(make_ref_counted<HeaderList>())
|
||||
{
|
||||
}
|
||||
|
||||
NonnullOwnPtr<OpaqueRedirectFilteredResponse> OpaqueRedirectFilteredResponse::create(Response& internal_response)
|
||||
NonnullRefPtr<OpaqueRedirectFilteredResponse> OpaqueRedirectFilteredResponse::create(NonnullRefPtr<Response> internal_response)
|
||||
{
|
||||
return adopt_own(*new OpaqueRedirectFilteredResponse(internal_response));
|
||||
return adopt_ref(*new OpaqueRedirectFilteredResponse(move(internal_response)));
|
||||
}
|
||||
|
||||
OpaqueRedirectFilteredResponse::OpaqueRedirectFilteredResponse(Response& internal_response)
|
||||
: FilteredResponse(internal_response)
|
||||
OpaqueRedirectFilteredResponse::OpaqueRedirectFilteredResponse(NonnullRefPtr<Response> internal_response)
|
||||
: FilteredResponse(move(internal_response))
|
||||
, m_header_list(make_ref_counted<HeaderList>())
|
||||
{
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <AK/Error.h>
|
||||
#include <AK/Forward.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/URL.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibWeb/Fetch/Infrastructure/HTTP/Bodies.h>
|
||||
|
@ -19,7 +20,7 @@
|
|||
namespace Web::Fetch::Infrastructure {
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-response
|
||||
class Response {
|
||||
class Response : public RefCounted<Response> {
|
||||
public:
|
||||
enum class CacheState {
|
||||
Local,
|
||||
|
@ -44,10 +45,10 @@ public:
|
|||
u64 decoded_size { 0 };
|
||||
};
|
||||
|
||||
[[nodiscard]] static NonnullOwnPtr<Response> aborted_network_error();
|
||||
[[nodiscard]] static NonnullOwnPtr<Response> network_error();
|
||||
[[nodiscard]] static NonnullRefPtr<Response> create();
|
||||
[[nodiscard]] static NonnullRefPtr<Response> aborted_network_error();
|
||||
[[nodiscard]] static NonnullRefPtr<Response> network_error();
|
||||
|
||||
Response();
|
||||
virtual ~Response() = default;
|
||||
|
||||
[[nodiscard]] virtual Type type() const { return m_type; }
|
||||
|
@ -100,7 +101,10 @@ public:
|
|||
[[nodiscard]] Optional<AK::URL const&> url() const;
|
||||
[[nodiscard]] ErrorOr<Optional<AK::URL>> location_url(Optional<String> const& request_fragment) const;
|
||||
|
||||
[[nodiscard]] WebIDL::ExceptionOr<NonnullOwnPtr<Response>> clone() const;
|
||||
[[nodiscard]] WebIDL::ExceptionOr<NonnullRefPtr<Response>> clone() const;
|
||||
|
||||
protected:
|
||||
Response();
|
||||
|
||||
private:
|
||||
// https://fetch.spec.whatwg.org/#concept-response-type
|
||||
|
@ -162,41 +166,40 @@ private:
|
|||
// https://fetch.spec.whatwg.org/#concept-filtered-response
|
||||
class FilteredResponse : public Response {
|
||||
public:
|
||||
explicit FilteredResponse(Response&);
|
||||
explicit FilteredResponse(NonnullRefPtr<Response>);
|
||||
virtual ~FilteredResponse() = 0;
|
||||
|
||||
[[nodiscard]] virtual Type type() const override { return m_internal_response.type(); }
|
||||
[[nodiscard]] virtual bool aborted() const override { return m_internal_response.aborted(); }
|
||||
[[nodiscard]] virtual Vector<AK::URL> const& url_list() const override { return m_internal_response.url_list(); }
|
||||
[[nodiscard]] virtual Status status() const override { return m_internal_response.status(); }
|
||||
[[nodiscard]] virtual ReadonlyBytes status_message() const override { return m_internal_response.status_message(); }
|
||||
[[nodiscard]] virtual NonnullRefPtr<HeaderList> const& header_list() const override { return m_internal_response.header_list(); }
|
||||
[[nodiscard]] virtual Optional<Body> const& body() const override { return m_internal_response.body(); }
|
||||
[[nodiscard]] virtual Optional<CacheState> const& cache_state() const override { return m_internal_response.cache_state(); }
|
||||
[[nodiscard]] virtual Vector<ByteBuffer> const& cors_exposed_header_name_list() const override { return m_internal_response.cors_exposed_header_name_list(); }
|
||||
[[nodiscard]] virtual bool range_requested() const override { return m_internal_response.range_requested(); }
|
||||
[[nodiscard]] virtual bool request_includes_credentials() const override { return m_internal_response.request_includes_credentials(); }
|
||||
[[nodiscard]] virtual bool timing_allow_passed() const override { return m_internal_response.timing_allow_passed(); }
|
||||
[[nodiscard]] virtual BodyInfo const& body_info() const override { return m_internal_response.body_info(); }
|
||||
[[nodiscard]] virtual Type type() const override { return m_internal_response->type(); }
|
||||
[[nodiscard]] virtual bool aborted() const override { return m_internal_response->aborted(); }
|
||||
[[nodiscard]] virtual Vector<AK::URL> const& url_list() const override { return m_internal_response->url_list(); }
|
||||
[[nodiscard]] virtual Status status() const override { return m_internal_response->status(); }
|
||||
[[nodiscard]] virtual ReadonlyBytes status_message() const override { return m_internal_response->status_message(); }
|
||||
[[nodiscard]] virtual NonnullRefPtr<HeaderList> const& header_list() const override { return m_internal_response->header_list(); }
|
||||
[[nodiscard]] virtual Optional<Body> const& body() const override { return m_internal_response->body(); }
|
||||
[[nodiscard]] virtual Optional<CacheState> const& cache_state() const override { return m_internal_response->cache_state(); }
|
||||
[[nodiscard]] virtual Vector<ByteBuffer> const& cors_exposed_header_name_list() const override { return m_internal_response->cors_exposed_header_name_list(); }
|
||||
[[nodiscard]] virtual bool range_requested() const override { return m_internal_response->range_requested(); }
|
||||
[[nodiscard]] virtual bool request_includes_credentials() const override { return m_internal_response->request_includes_credentials(); }
|
||||
[[nodiscard]] virtual bool timing_allow_passed() const override { return m_internal_response->timing_allow_passed(); }
|
||||
[[nodiscard]] virtual BodyInfo const& body_info() const override { return m_internal_response->body_info(); }
|
||||
|
||||
[[nodiscard]] Response const& internal_response() const { return m_internal_response; }
|
||||
[[nodiscard]] Response& internal_response() { return m_internal_response; }
|
||||
[[nodiscard]] NonnullRefPtr<Response> internal_response() const { return m_internal_response; }
|
||||
|
||||
protected:
|
||||
// https://fetch.spec.whatwg.org/#concept-internal-response
|
||||
Response& m_internal_response;
|
||||
NonnullRefPtr<Response> m_internal_response;
|
||||
};
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-filtered-response-basic
|
||||
class BasicFilteredResponse final : public FilteredResponse {
|
||||
public:
|
||||
static ErrorOr<NonnullOwnPtr<BasicFilteredResponse>> create(Response&);
|
||||
static ErrorOr<NonnullRefPtr<BasicFilteredResponse>> create(NonnullRefPtr<Response>);
|
||||
|
||||
[[nodiscard]] virtual Type type() const override { return Type::Basic; }
|
||||
[[nodiscard]] virtual NonnullRefPtr<HeaderList> const& header_list() const override { return m_header_list; }
|
||||
|
||||
private:
|
||||
BasicFilteredResponse(Response&, NonnullRefPtr<HeaderList>);
|
||||
BasicFilteredResponse(NonnullRefPtr<Response>, NonnullRefPtr<HeaderList>);
|
||||
|
||||
NonnullRefPtr<HeaderList> m_header_list;
|
||||
};
|
||||
|
@ -204,13 +207,13 @@ private:
|
|||
// https://fetch.spec.whatwg.org/#concept-filtered-response-cors
|
||||
class CORSFilteredResponse final : public FilteredResponse {
|
||||
public:
|
||||
static ErrorOr<NonnullOwnPtr<CORSFilteredResponse>> create(Response&);
|
||||
static ErrorOr<NonnullRefPtr<CORSFilteredResponse>> create(NonnullRefPtr<Response>);
|
||||
|
||||
[[nodiscard]] virtual Type type() const override { return Type::CORS; }
|
||||
[[nodiscard]] virtual NonnullRefPtr<HeaderList> const& header_list() const override { return m_header_list; }
|
||||
|
||||
private:
|
||||
CORSFilteredResponse(Response&, NonnullRefPtr<HeaderList>);
|
||||
CORSFilteredResponse(NonnullRefPtr<Response>, NonnullRefPtr<HeaderList>);
|
||||
|
||||
NonnullRefPtr<HeaderList> m_header_list;
|
||||
};
|
||||
|
@ -218,7 +221,7 @@ private:
|
|||
// https://fetch.spec.whatwg.org/#concept-filtered-response-opaque
|
||||
class OpaqueFilteredResponse final : public FilteredResponse {
|
||||
public:
|
||||
static NonnullOwnPtr<OpaqueFilteredResponse> create(Response&);
|
||||
static NonnullRefPtr<OpaqueFilteredResponse> create(NonnullRefPtr<Response>);
|
||||
|
||||
[[nodiscard]] virtual Type type() const override { return Type::Opaque; }
|
||||
[[nodiscard]] virtual Vector<AK::URL> const& url_list() const override { return m_url_list; }
|
||||
|
@ -228,7 +231,7 @@ public:
|
|||
[[nodiscard]] virtual Optional<Body> const& body() const override { return m_body; }
|
||||
|
||||
private:
|
||||
explicit OpaqueFilteredResponse(Response&);
|
||||
explicit OpaqueFilteredResponse(NonnullRefPtr<Response>);
|
||||
|
||||
Vector<AK::URL> m_url_list;
|
||||
NonnullRefPtr<HeaderList> m_header_list;
|
||||
|
@ -238,7 +241,7 @@ private:
|
|||
// https://fetch.spec.whatwg.org/#concept-filtered-response-opaque-redirect
|
||||
class OpaqueRedirectFilteredResponse final : public FilteredResponse {
|
||||
public:
|
||||
static NonnullOwnPtr<OpaqueRedirectFilteredResponse> create(Response&);
|
||||
static NonnullRefPtr<OpaqueRedirectFilteredResponse> create(NonnullRefPtr<Response>);
|
||||
|
||||
[[nodiscard]] virtual Type type() const override { return Type::OpaqueRedirect; }
|
||||
[[nodiscard]] virtual Status status() const override { return 0; }
|
||||
|
@ -247,7 +250,7 @@ public:
|
|||
[[nodiscard]] virtual Optional<Body> const& body() const override { return m_body; }
|
||||
|
||||
private:
|
||||
explicit OpaqueRedirectFilteredResponse(Response&);
|
||||
explicit OpaqueRedirectFilteredResponse(NonnullRefPtr<Response>);
|
||||
|
||||
NonnullRefPtr<HeaderList> m_header_list;
|
||||
Optional<Body> m_body;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue