mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:07:35 +00:00
Everywhere: Use unqualified AK::URL
Now possible in LibWeb now that there is no longer a Web::URL.
This commit is contained in:
parent
f9e5b43b7a
commit
9ce8189f21
156 changed files with 471 additions and 471 deletions
|
@ -44,7 +44,7 @@ JS::NonnullGCPtr<Request> Request::create(JS::VM& vm)
|
|||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-request-url
|
||||
AK::URL& Request::url()
|
||||
URL& Request::url()
|
||||
{
|
||||
// A request has an associated URL (a URL).
|
||||
// NOTE: Implementations are encouraged to make this a pointer to the first URL in request’s URL list. It is provided as a distinct field solely for the convenience of other standards hooking into Fetch.
|
||||
|
@ -53,13 +53,13 @@ AK::URL& Request::url()
|
|||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-request-url
|
||||
AK::URL const& Request::url() const
|
||||
URL const& Request::url() const
|
||||
{
|
||||
return const_cast<Request&>(*this).url();
|
||||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-request-current-url
|
||||
AK::URL& Request::current_url()
|
||||
URL& Request::current_url()
|
||||
{
|
||||
// A request has an associated current URL. It is a pointer to the last URL in request’s URL list.
|
||||
VERIFY(!m_url_list.is_empty());
|
||||
|
@ -67,12 +67,12 @@ AK::URL& Request::current_url()
|
|||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-request-current-url
|
||||
AK::URL const& Request::current_url() const
|
||||
URL const& Request::current_url() const
|
||||
{
|
||||
return const_cast<Request&>(*this).current_url();
|
||||
}
|
||||
|
||||
void Request::set_url(AK::URL url)
|
||||
void Request::set_url(URL url)
|
||||
{
|
||||
// Sometimes setting the URL and URL list are done as two distinct steps in the spec,
|
||||
// but since we know the URL is always the URL list's first item and doesn't change later
|
||||
|
@ -163,7 +163,7 @@ bool Request::has_redirect_tainted_origin() const
|
|||
// A request request has a redirect-tainted origin if these steps return true:
|
||||
|
||||
// 1. Let lastURL be null.
|
||||
Optional<AK::URL const&> last_url;
|
||||
Optional<URL const&> last_url;
|
||||
|
||||
// 2. For each url of request’s URL list:
|
||||
for (auto const& url : m_url_list) {
|
||||
|
|
|
@ -164,7 +164,7 @@ public:
|
|||
using BodyType = Variant<Empty, ByteBuffer, JS::NonnullGCPtr<Body>>;
|
||||
using OriginType = Variant<Origin, HTML::Origin>;
|
||||
using PolicyContainerType = Variant<PolicyContainer, HTML::PolicyContainer>;
|
||||
using ReferrerType = Variant<Referrer, AK::URL>;
|
||||
using ReferrerType = Variant<Referrer, URL>;
|
||||
using ReservedClientType = Variant<Empty, HTML::Environment*, JS::GCPtr<HTML::EnvironmentSettingsObject>>;
|
||||
using WindowType = Variant<Window, JS::GCPtr<HTML::EnvironmentSettingsObject>>;
|
||||
|
||||
|
@ -263,9 +263,9 @@ public:
|
|||
[[nodiscard]] bool render_blocking() const { return m_render_blocking; }
|
||||
void set_render_blocking(bool render_blocking) { m_render_blocking = render_blocking; }
|
||||
|
||||
[[nodiscard]] Vector<AK::URL> const& url_list() const { return m_url_list; }
|
||||
[[nodiscard]] Vector<AK::URL>& url_list() { return m_url_list; }
|
||||
void set_url_list(Vector<AK::URL> url_list) { m_url_list = move(url_list); }
|
||||
[[nodiscard]] Vector<URL> const& url_list() const { return m_url_list; }
|
||||
[[nodiscard]] Vector<URL>& url_list() { return m_url_list; }
|
||||
void set_url_list(Vector<URL> url_list) { m_url_list = move(url_list); }
|
||||
|
||||
[[nodiscard]] u8 redirect_count() const { return m_redirect_count; }
|
||||
void set_redirect_count(u8 redirect_count) { m_redirect_count = redirect_count; }
|
||||
|
@ -288,11 +288,11 @@ public:
|
|||
[[nodiscard]] bool timing_allow_failed() const { return m_timing_allow_failed; }
|
||||
void set_timing_allow_failed(bool timing_allow_failed) { m_timing_allow_failed = timing_allow_failed; }
|
||||
|
||||
[[nodiscard]] AK::URL& url();
|
||||
[[nodiscard]] AK::URL const& url() const;
|
||||
[[nodiscard]] AK::URL& current_url();
|
||||
[[nodiscard]] AK::URL const& current_url() const;
|
||||
void set_url(AK::URL url);
|
||||
[[nodiscard]] URL& url();
|
||||
[[nodiscard]] URL const& url() const;
|
||||
[[nodiscard]] URL& current_url();
|
||||
[[nodiscard]] URL const& current_url() const;
|
||||
void set_url(URL url);
|
||||
|
||||
[[nodiscard]] bool destination_is_script_like() const;
|
||||
|
||||
|
@ -487,7 +487,7 @@ private:
|
|||
// https://fetch.spec.whatwg.org/#concept-request-url-list
|
||||
// A request has an associated URL list (a list of one or more URLs). Unless stated otherwise, it is a list
|
||||
// containing a copy of request’s URL.
|
||||
Vector<AK::URL> m_url_list;
|
||||
Vector<URL> m_url_list;
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-request-redirect-count
|
||||
// A request has an associated redirect count. Unless stated otherwise, it is zero.
|
||||
|
|
|
@ -104,7 +104,7 @@ bool Response::is_network_error() const
|
|||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-response-url
|
||||
Optional<AK::URL const&> Response::url() const
|
||||
Optional<URL const&> Response::url() const
|
||||
{
|
||||
// A response has an associated URL. It is a pointer to the last URL in response’s URL list and null if response’s URL list is empty.
|
||||
// NOTE: We have to use the virtual getter here to not bypass filtered responses.
|
||||
|
@ -114,23 +114,23 @@ Optional<AK::URL const&> Response::url() const
|
|||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-response-location-url
|
||||
ErrorOr<Optional<AK::URL>> Response::location_url(Optional<String> const& request_fragment) const
|
||||
ErrorOr<Optional<URL>> Response::location_url(Optional<String> const& request_fragment) const
|
||||
{
|
||||
// The location URL of a response response, given null or an ASCII string requestFragment, is the value returned by the following steps. They return null, failure, or a URL.
|
||||
|
||||
// 1. If response’s status is not a redirect status, then return null.
|
||||
// NOTE: We have to use the virtual getter here to not bypass filtered responses.
|
||||
if (!is_redirect_status(status()))
|
||||
return Optional<AK::URL> {};
|
||||
return Optional<URL> {};
|
||||
|
||||
// 2. Let location be the result of extracting header list values given `Location` and response’s header list.
|
||||
auto location_values_or_failure = TRY(extract_header_list_values("Location"sv.bytes(), m_header_list));
|
||||
if (location_values_or_failure.has<Infrastructure::ExtractHeaderParseFailure>() || location_values_or_failure.has<Empty>())
|
||||
return Optional<AK::URL> {};
|
||||
return Optional<URL> {};
|
||||
|
||||
auto const& location_values = location_values_or_failure.get<Vector<ByteBuffer>>();
|
||||
if (location_values.size() != 1)
|
||||
return Optional<AK::URL> {};
|
||||
return Optional<URL> {};
|
||||
|
||||
// 3. If location is a header value, then set location to the result of parsing location with response’s URL.
|
||||
auto location = DOMURL::parse(location_values.first(), url());
|
||||
|
|
|
@ -65,9 +65,9 @@ public:
|
|||
[[nodiscard]] virtual bool aborted() const { return m_aborted; }
|
||||
void set_aborted(bool aborted) { m_aborted = aborted; }
|
||||
|
||||
[[nodiscard]] virtual Vector<AK::URL> const& url_list() const { return m_url_list; }
|
||||
[[nodiscard]] virtual Vector<AK::URL>& url_list() { return m_url_list; }
|
||||
void set_url_list(Vector<AK::URL> url_list) { m_url_list = move(url_list); }
|
||||
[[nodiscard]] virtual Vector<URL> const& url_list() const { return m_url_list; }
|
||||
[[nodiscard]] virtual Vector<URL>& url_list() { return m_url_list; }
|
||||
void set_url_list(Vector<URL> url_list) { m_url_list = move(url_list); }
|
||||
|
||||
[[nodiscard]] virtual Status status() const { return m_status; }
|
||||
void set_status(Status status) { m_status = status; }
|
||||
|
@ -106,8 +106,8 @@ public:
|
|||
[[nodiscard]] bool is_aborted_network_error() const;
|
||||
[[nodiscard]] bool is_network_error() const;
|
||||
|
||||
[[nodiscard]] Optional<AK::URL const&> url() const;
|
||||
[[nodiscard]] ErrorOr<Optional<AK::URL>> location_url(Optional<String> const& request_fragment) const;
|
||||
[[nodiscard]] Optional<URL const&> url() const;
|
||||
[[nodiscard]] ErrorOr<Optional<URL>> location_url(Optional<String> const& request_fragment) const;
|
||||
|
||||
[[nodiscard]] WebIDL::ExceptionOr<JS::NonnullGCPtr<Response>> clone(JS::Realm&) const;
|
||||
|
||||
|
@ -134,7 +134,7 @@ private:
|
|||
|
||||
// https://fetch.spec.whatwg.org/#concept-response-url-list
|
||||
// A response has an associated URL list (a list of zero or more URLs). Unless stated otherwise, it is the empty list.
|
||||
Vector<AK::URL> m_url_list;
|
||||
Vector<URL> m_url_list;
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-response-status
|
||||
// A response has an associated status, which is a status. Unless stated otherwise it is 200.
|
||||
|
@ -197,8 +197,8 @@ public:
|
|||
|
||||
[[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 Vector<AK::URL>& url_list() override { return m_internal_response->url_list(); }
|
||||
[[nodiscard]] virtual Vector<URL> const& url_list() const override { return m_internal_response->url_list(); }
|
||||
[[nodiscard]] virtual Vector<URL>& url_list() 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 JS::NonnullGCPtr<HeaderList> header_list() const override { return m_internal_response->header_list(); }
|
||||
|
@ -268,8 +268,8 @@ public:
|
|||
[[nodiscard]] static JS::NonnullGCPtr<OpaqueFilteredResponse> create(JS::VM&, JS::NonnullGCPtr<Response>);
|
||||
|
||||
[[nodiscard]] virtual Type type() const override { return Type::Opaque; }
|
||||
[[nodiscard]] virtual Vector<AK::URL> const& url_list() const override { return m_url_list; }
|
||||
[[nodiscard]] virtual Vector<AK::URL>& url_list() override { return m_url_list; }
|
||||
[[nodiscard]] virtual Vector<URL> const& url_list() const override { return m_url_list; }
|
||||
[[nodiscard]] virtual Vector<URL>& url_list() override { return m_url_list; }
|
||||
[[nodiscard]] virtual Status status() const override { return 0; }
|
||||
[[nodiscard]] virtual ReadonlyBytes status_message() const override { return {}; }
|
||||
[[nodiscard]] virtual JS::NonnullGCPtr<HeaderList> header_list() const override { return m_header_list; }
|
||||
|
@ -281,7 +281,7 @@ private:
|
|||
|
||||
virtual void visit_edges(JS::Cell::Visitor&) override;
|
||||
|
||||
Vector<AK::URL> m_url_list;
|
||||
Vector<URL> m_url_list;
|
||||
JS::NonnullGCPtr<HeaderList> m_header_list;
|
||||
JS::GCPtr<Body> m_body;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue