mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-27 19:59:17 +00:00
AK+LibURL: Move AK::URL into a new URL library
This URL library ends up being a relatively fundamental base library of the system, as LibCore depends on LibURL. This change has two main benefits: * Moving AK back more towards being an agnostic library that can be used between the kernel and userspace. URL has never really fit that description - and is not used in the kernel. * URL _should_ depend on LibUnicode, as it needs punnycode support. However, it's not really possible to do this inside of AK as it can't depend on any external library. This change brings us a little closer to being able to do that, but unfortunately we aren't there quite yet, as the code generators depend on LibCore.
This commit is contained in:
@@ -44,7 +44,7 @@ JS::NonnullGCPtr<Request> Request::create(JS::VM& vm)
|
||||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-request-url
|
||||
URL& Request::url()
|
||||
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 @@ URL& Request::url()
|
||||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-request-url
|
||||
URL const& Request::url() const
|
||||
URL::URL const& Request::url() const
|
||||
{
|
||||
return const_cast<Request&>(*this).url();
|
||||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-request-current-url
|
||||
URL& Request::current_url()
|
||||
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 @@ URL& Request::current_url()
|
||||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-request-current-url
|
||||
URL const& Request::current_url() const
|
||||
URL::URL const& Request::current_url() const
|
||||
{
|
||||
return const_cast<Request&>(*this).current_url();
|
||||
}
|
||||
|
||||
void Request::set_url(URL url)
|
||||
void Request::set_url(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<URL const&> last_url;
|
||||
Optional<URL::URL const&> last_url;
|
||||
|
||||
// 2. For each url of request’s URL list:
|
||||
for (auto const& url : m_url_list) {
|
||||
|
||||
Reference in New Issue
Block a user