mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 14:58:46 +00:00
LibWeb: Support parsing a URL relative to environment settings object
This commit is contained in:
parent
f69c135796
commit
efe94d9040
Notes:
sideshowbarker
2024-07-17 04:26:50 +09:00
Author: https://github.com/IdanHo
Commit: efe94d9040
Pull-request: https://github.com/SerenityOS/serenity/pull/16072
Reviewed-by: https://github.com/linusg ✅
Reviewed-by: https://github.com/trflynn89
2 changed files with 18 additions and 0 deletions
|
@ -151,6 +151,22 @@ void EnvironmentSettingsObject::prepare_to_run_callback()
|
|||
context->skip_when_determining_incumbent_counter++;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#parse-a-url
|
||||
AK::URL EnvironmentSettingsObject::parse_url(StringView url)
|
||||
{
|
||||
// 1. Let encoding be document's character encoding, if document was given, and environment settings object's API URL character encoding otherwise.
|
||||
// FIXME: Pass in environment settings object's API URL character encoding.
|
||||
|
||||
// 2. Let baseURL be document's base URL, if document was given, and environment settings object's API base URL otherwise.
|
||||
auto base_url = api_base_url();
|
||||
|
||||
// 3. Let urlRecord be the result of applying the URL parser to url, with baseURL and encoding.
|
||||
// 4. If urlRecord is failure, then return failure.
|
||||
// 5. Let urlString be the result of applying the URL serializer to urlRecord.
|
||||
// 6. Return urlString as the resulting URL string and urlRecord as the resulting URL record.
|
||||
return base_url.complete_url(url);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/webappapis.html#clean-up-after-running-a-callback
|
||||
void EnvironmentSettingsObject::clean_up_after_running_callback()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue