1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:18:11 +00:00

LibWeb: Bring Document::fallback_base_url closer to the spec

This commit is contained in:
Andrew Kaster 2024-02-04 03:41:07 -07:00 committed by Andrew Kaster
parent 5d9d0aa267
commit 6e75440d5a
3 changed files with 25 additions and 5 deletions

View file

@ -51,6 +51,18 @@ bool url_matches_about_blank(AK::URL const& url)
&& url.host().has<Empty>();
}
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#matches-about:srcdoc
bool url_matches_about_srcdoc(AK::URL const& url)
{
// A URL matches about:srcdoc if its scheme is "about", its path contains a single string "srcdoc", its query is null, its username and password are the empty string, and its host is null.
return url.scheme() == "about"sv
&& url.serialize_path() == "srcdoc"sv
&& !url.query().has_value()
&& url.raw_username().is_empty()
&& url.raw_password().is_empty()
&& url.host().has<Empty>();
}
// https://html.spec.whatwg.org/multipage/document-sequences.html#determining-the-origin
HTML::Origin determine_the_origin(AK::URL const& url, SandboxingFlagSet sandbox_flags, Optional<HTML::Origin> source_origin)
{