mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 20:15:08 +00:00
LibWeb: Determine the origin when navigating across documents
This commit is contained in:
parent
9643a5c63f
commit
8d2c2f7c52
4 changed files with 14 additions and 4 deletions
|
@ -216,7 +216,7 @@ NonnullRefPtr<Document> Document::create_and_initialize(Type type, String conten
|
||||||
// 8. Let document be a new Document,
|
// 8. Let document be a new Document,
|
||||||
// whose type is type,
|
// whose type is type,
|
||||||
// content type is contentType,
|
// content type is contentType,
|
||||||
// FIXME: origin is navigationParams's origin,
|
// origin is navigationParams's origin,
|
||||||
// FIXME: policy container is navigationParams's policy container,
|
// FIXME: policy container is navigationParams's policy container,
|
||||||
// FIXME: permissions policy is permissionsPolicy,
|
// FIXME: permissions policy is permissionsPolicy,
|
||||||
// FIXME: active sandboxing flag set is navigationParams's final sandboxing flag set,
|
// FIXME: active sandboxing flag set is navigationParams's final sandboxing flag set,
|
||||||
|
@ -226,6 +226,7 @@ NonnullRefPtr<Document> Document::create_and_initialize(Type type, String conten
|
||||||
auto document = Document::create();
|
auto document = Document::create();
|
||||||
document->m_type = type;
|
document->m_type = type;
|
||||||
document->m_content_type = content_type;
|
document->m_content_type = content_type;
|
||||||
|
document->set_origin(navigation_params.origin);
|
||||||
|
|
||||||
document->m_window = window;
|
document->m_window = window;
|
||||||
window->set_associated_document(*document);
|
window->set_associated_document(*document);
|
||||||
|
|
|
@ -59,7 +59,7 @@ static HTML::Origin url_origin(AK::URL const& url)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/browsers.html#determining-the-origin
|
// https://html.spec.whatwg.org/multipage/browsers.html#determining-the-origin
|
||||||
static HTML::Origin determine_the_origin(BrowsingContext const& browsing_context, Optional<AK::URL> url, SandboxingFlagSet sandbox_flags, Optional<HTML::Origin> invocation_origin)
|
HTML::Origin determine_the_origin(BrowsingContext const& browsing_context, Optional<AK::URL> url, SandboxingFlagSet sandbox_flags, Optional<HTML::Origin> invocation_origin)
|
||||||
{
|
{
|
||||||
// 1. If sandboxFlags has its sandboxed origin browsing context flag set, then return a new opaque origin.
|
// 1. If sandboxFlags has its sandboxed origin browsing context flag set, then return a new opaque origin.
|
||||||
if (sandbox_flags.flags & SandboxingFlagSet::SandboxedOrigin) {
|
if (sandbox_flags.flags & SandboxingFlagSet::SandboxedOrigin) {
|
||||||
|
|
|
@ -157,4 +157,6 @@ private:
|
||||||
String m_name;
|
String m_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
HTML::Origin determine_the_origin(BrowsingContext const& browsing_context, Optional<AK::URL> url, SandboxingFlagSet sandbox_flags, Optional<HTML::Origin> invocation_origin);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -367,15 +367,22 @@ void FrameLoader::resource_did_load()
|
||||||
dbgln_if(RESOURCE_DEBUG, "This content has MIME type '{}', encoding unknown", resource()->mime_type());
|
dbgln_if(RESOURCE_DEBUG, "This content has MIME type '{}', encoding unknown", resource()->mime_type());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto final_sandboxing_flag_set = HTML::SandboxingFlagSet {};
|
||||||
|
|
||||||
|
// (Part of https://html.spec.whatwg.org/#navigating-across-documents)
|
||||||
|
// 3. Let responseOrigin be the result of determining the origin given browsingContext, resource's url, finalSandboxFlags, and incumbentNavigationOrigin.
|
||||||
|
// FIXME: Pass incumbentNavigationOrigin
|
||||||
|
auto response_origin = HTML::determine_the_origin(browsing_context(), url, final_sandboxing_flag_set, {});
|
||||||
|
|
||||||
auto response = make<Fetch::Infrastructure::Response>();
|
auto response = make<Fetch::Infrastructure::Response>();
|
||||||
response->url_list().append(url);
|
response->url_list().append(url);
|
||||||
HTML::NavigationParams navigation_params {
|
HTML::NavigationParams navigation_params {
|
||||||
.id = {},
|
.id = {},
|
||||||
.request = nullptr,
|
.request = nullptr,
|
||||||
.response = move(response),
|
.response = move(response),
|
||||||
.origin = HTML::Origin {},
|
.origin = move(response_origin),
|
||||||
.policy_container = HTML::PolicyContainer {},
|
.policy_container = HTML::PolicyContainer {},
|
||||||
.final_sandboxing_flag_set = HTML::SandboxingFlagSet {},
|
.final_sandboxing_flag_set = move(final_sandboxing_flag_set),
|
||||||
.cross_origin_opener_policy = HTML::CrossOriginOpenerPolicy {},
|
.cross_origin_opener_policy = HTML::CrossOriginOpenerPolicy {},
|
||||||
.coop_enforcement_result = HTML::CrossOriginOpenerPolicyEnforcementResult {},
|
.coop_enforcement_result = HTML::CrossOriginOpenerPolicyEnforcementResult {},
|
||||||
.reserved_environment = {},
|
.reserved_environment = {},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue