mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 08:39:22 +00:00
LibWeb: Let determine_the_origin() take an optional URL after all
I originally believed that this could never receive a null URL and the spec was inaccurate, but it seems like it can indeed. I don't have a distilled test, but this makes logging in with GitHub work on https://v0.dev/
This commit is contained in:
parent
ef9208047d
commit
1a4b0ded1f
Notes:
github-actions[bot]
2024-09-26 08:15:13 +00:00
Author: https://github.com/awesomekling
Commit: 1a4b0ded1f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1537
3 changed files with 10 additions and 8 deletions
|
@ -59,15 +59,17 @@ bool url_matches_about_srcdoc(URL::URL const& url)
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/document-sequences.html#determining-the-origin
|
||||
HTML::Origin determine_the_origin(URL::URL const& url, SandboxingFlagSet sandbox_flags, Optional<HTML::Origin> source_origin)
|
||||
HTML::Origin determine_the_origin(Optional<URL::URL> const& url, SandboxingFlagSet sandbox_flags, Optional<HTML::Origin> source_origin)
|
||||
{
|
||||
// 1. If sandboxFlags has its sandboxed origin browsing context flag set, then return a new opaque origin.
|
||||
if (has_flag(sandbox_flags, SandboxingFlagSet::SandboxedOrigin)) {
|
||||
return HTML::Origin {};
|
||||
}
|
||||
|
||||
// FIXME: 2. If url is null, then return a new opaque origin.
|
||||
// FIXME: There appears to be no way to get a null URL here, so it might be a spec bug.
|
||||
// 2. If url is null, then return a new opaque origin.
|
||||
if (!url.has_value()) {
|
||||
return HTML::Origin {};
|
||||
}
|
||||
|
||||
// 3. If url is about:srcdoc, then:
|
||||
if (url == "about:srcdoc"sv) {
|
||||
|
@ -79,11 +81,11 @@ HTML::Origin determine_the_origin(URL::URL const& url, SandboxingFlagSet sandbox
|
|||
}
|
||||
|
||||
// 4. If url matches about:blank and sourceOrigin is non-null, then return sourceOrigin.
|
||||
if (url_matches_about_blank(url) && source_origin.has_value())
|
||||
if (url_matches_about_blank(*url) && source_origin.has_value())
|
||||
return source_origin.release_value();
|
||||
|
||||
// 5. Return url's origin.
|
||||
return DOMURL::url_origin(url);
|
||||
return DOMURL::url_origin(*url);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/document-sequences.html#creating-a-new-auxiliary-browsing-context
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue