mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 15:37:43 +00:00
LibWeb: Add non-const variants of Request::{current_,}url()
This commit is contained in:
parent
0ee8da9556
commit
e40c8f550f
2 changed files with 17 additions and 3 deletions
|
@ -20,7 +20,7 @@ NonnullRefPtr<Request> Request::create()
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://fetch.spec.whatwg.org/#concept-request-url
|
// https://fetch.spec.whatwg.org/#concept-request-url
|
||||||
AK::URL const& Request::url() const
|
AK::URL& Request::url()
|
||||||
{
|
{
|
||||||
// A request has an associated URL (a 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.
|
// 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.
|
||||||
|
@ -28,14 +28,26 @@ AK::URL const& Request::url() const
|
||||||
return m_url_list.first();
|
return m_url_list.first();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://fetch.spec.whatwg.org/#concept-request-url
|
||||||
|
AK::URL const& Request::url() const
|
||||||
|
{
|
||||||
|
return const_cast<Request&>(*this).url();
|
||||||
|
}
|
||||||
|
|
||||||
// https://fetch.spec.whatwg.org/#concept-request-current-url
|
// https://fetch.spec.whatwg.org/#concept-request-current-url
|
||||||
AK::URL const& Request::current_url()
|
AK::URL& Request::current_url()
|
||||||
{
|
{
|
||||||
// A request has an associated current URL. It is a pointer to the last URL in request’s URL list.
|
// 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());
|
VERIFY(!m_url_list.is_empty());
|
||||||
return m_url_list.last();
|
return m_url_list.last();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://fetch.spec.whatwg.org/#concept-request-current-url
|
||||||
|
AK::URL const& Request::current_url() const
|
||||||
|
{
|
||||||
|
return const_cast<Request&>(*this).current_url();
|
||||||
|
}
|
||||||
|
|
||||||
void Request::set_url(AK::URL url)
|
void Request::set_url(AK::URL url)
|
||||||
{
|
{
|
||||||
// Sometimes setting the URL and URL list are done as two distinct steps in the spec,
|
// Sometimes setting the URL and URL list are done as two distinct steps in the spec,
|
||||||
|
|
|
@ -277,8 +277,10 @@ public:
|
||||||
[[nodiscard]] bool timing_allow_failed() const { return m_timing_allow_failed; }
|
[[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; }
|
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 const& url() const;
|
||||||
[[nodiscard]] AK::URL const& current_url();
|
[[nodiscard]] AK::URL& current_url();
|
||||||
|
[[nodiscard]] AK::URL const& current_url() const;
|
||||||
void set_url(AK::URL url);
|
void set_url(AK::URL url);
|
||||||
|
|
||||||
[[nodiscard]] bool destination_is_script_like() const;
|
[[nodiscard]] bool destination_is_script_like() const;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue