mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:07:43 +00:00
LibWeb: Update determine_the_origin
to match the latest spec
This commit is contained in:
parent
e33145aa4b
commit
8e832a174e
3 changed files with 11 additions and 12 deletions
|
@ -49,7 +49,7 @@ bool url_matches_about_blank(AK::URL const& url)
|
|||
}
|
||||
|
||||
// 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, Optional<HTML::Origin> container_origin)
|
||||
HTML::Origin determine_the_origin(AK::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)) {
|
||||
|
@ -61,11 +61,11 @@ HTML::Origin determine_the_origin(AK::URL const& url, SandboxingFlagSet sandbox_
|
|||
|
||||
// 3. If url is about:srcdoc, then:
|
||||
if (url == "about:srcdoc"sv) {
|
||||
// 1. Assert: containerOrigin is non-null.
|
||||
VERIFY(container_origin.has_value());
|
||||
// 1. Assert: sourceOrigin is non-null.
|
||||
VERIFY(source_origin.has_value());
|
||||
|
||||
// 2. Return containerOrigin.
|
||||
return container_origin.release_value();
|
||||
// 2. Return sourceOrigin.
|
||||
return source_origin.release_value();
|
||||
}
|
||||
|
||||
// 4. If url matches about:blank and sourceOrigin is non-null, then return sourceOrigin.
|
||||
|
@ -134,8 +134,8 @@ WebIDL::ExceptionOr<BrowsingContext::BrowsingContextAndDocument> BrowsingContext
|
|||
// FIXME: 5. Let sandboxFlags be the result of determining the creation sandboxing flags given browsingContext and embedder.
|
||||
SandboxingFlagSet sandbox_flags = {};
|
||||
|
||||
// 6. Let origin be the result of determining the origin given about:blank, sandboxFlags, creatorOrigin, and null.
|
||||
auto origin = determine_the_origin(AK::URL("about:blank"sv), sandbox_flags, creator_origin, {});
|
||||
// 6. Let origin be the result of determining the origin given about:blank, sandboxFlags, and creatorOrigin.
|
||||
auto origin = determine_the_origin(AK::URL("about:blank"sv), sandbox_flags, creator_origin);
|
||||
|
||||
// FIXME: 7. Let permissionsPolicy be the result of creating a permissions policy given browsingContext and origin. [PERMISSIONSPOLICY]
|
||||
|
||||
|
|
|
@ -278,7 +278,7 @@ private:
|
|||
bool m_has_been_discarded { false };
|
||||
};
|
||||
|
||||
HTML::Origin determine_the_origin(AK::URL const& url, SandboxingFlagSet sandbox_flags, Optional<HTML::Origin> source_origin, Optional<HTML::Origin> container_origin);
|
||||
HTML::Origin determine_the_origin(AK::URL const& url, SandboxingFlagSet sandbox_flags, Optional<HTML::Origin> source_origin);
|
||||
|
||||
SandboxingFlagSet determine_the_creation_sandboxing_flags(BrowsingContext const&, JS::GCPtr<DOM::Element> embedder);
|
||||
|
||||
|
|
|
@ -399,7 +399,7 @@ static WebIDL::ExceptionOr<NavigationParams> create_navigation_params_from_a_src
|
|||
response->set_body(TRY(Fetch::Infrastructure::byte_sequence_as_body(realm, document_resource.get<String>().bytes())));
|
||||
|
||||
// 3. Let responseOrigin be the result of determining the origin given response's URL, targetSnapshotParams's sandboxing flags, null, and entry's document state's origin.
|
||||
auto response_origin = determine_the_origin(*response->url(), SandboxingFlagSet {}, {}, entry->document_state->origin());
|
||||
auto response_origin = determine_the_origin(*response->url(), SandboxingFlagSet {}, entry->document_state->origin());
|
||||
|
||||
// 4. Let coop be a new cross-origin opener policy.
|
||||
CrossOriginOpenerPolicy coop;
|
||||
|
@ -598,9 +598,8 @@ static WebIDL::ExceptionOr<Optional<NavigationParams>> create_navigation_params_
|
|||
entry->document_state->set_resource(Empty {});
|
||||
}
|
||||
|
||||
// 11. Set responseOrigin to the result of determining the origin given response's URL, finalSandboxFlags,
|
||||
// entry's document state's initiator origin, and null.
|
||||
response_origin = determine_the_origin(*response_holder->response()->url(), final_sandbox_flags, entry->document_state->initiator_origin(), {});
|
||||
// 11. Set responseOrigin to the result of determining the origin given response's URL, finalSandboxFlags, and entry's document state's initiator origin.
|
||||
response_origin = determine_the_origin(*response_holder->response()->url(), final_sandbox_flags, entry->document_state->initiator_origin());
|
||||
|
||||
// 14. Set locationURL to response's location URL given currentURL's fragment.
|
||||
auto location_url = response_holder->response()->location_url(current_url.fragment());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue