mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibWeb: Implement XMLHttpRequest.responseURL
This was used on https://twinings.co.uk/ so let's support it :^)
This commit is contained in:
parent
34f2cbf202
commit
527ad9ac01
Notes:
sideshowbarker
2024-07-17 01:28:15 +09:00
Author: https://github.com/awesomekling
Commit: 527ad9ac01
Pull-request: https://github.com/SerenityOS/serenity/pull/24177
5 changed files with 31 additions and 1 deletions
|
@ -1265,4 +1265,16 @@ JS::ThrowCompletionOr<void> XMLHttpRequest::request_error_steps(FlyString const&
|
|||
return {};
|
||||
}
|
||||
|
||||
// https://xhr.spec.whatwg.org/#the-responseurl-attribute
|
||||
String XMLHttpRequest::response_url()
|
||||
{
|
||||
// The responseURL getter steps are to return the empty string if this’s response’s URL is null;
|
||||
// otherwise its serialization with the exclude fragment flag set.
|
||||
if (!m_response->url().has_value())
|
||||
return String {};
|
||||
|
||||
auto serialized = m_response->url().value().serialize(URL::ExcludeFragment::Yes);
|
||||
return String::from_utf8_without_validation(serialized.bytes());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue