mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 17:55:07 +02:00
LibWeb/HTML: Add cross-site ancestor flag to environment
Corresponds to baec061a70
This commit is contained in:
Notes:
github-actions[bot]
2025-08-11 11:23:58 +00:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/LadybirdBrowser/ladybird/commit/4bcfc4bacc5 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5763
@@ -110,6 +110,28 @@ URL::Origin WindowEnvironmentSettingsObject::origin() const
|
||||
return m_window->associated_document().origin();
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#script-settings-for-window-objects:concept-settings-object-has-cross-site-ancestor
|
||||
bool WindowEnvironmentSettingsObject::has_cross_site_ancestor() const
|
||||
{
|
||||
// 1. If window's navigable's parent is null, then return false.
|
||||
if (m_window->navigable()->parent() == nullptr)
|
||||
return false;
|
||||
|
||||
// 2. Let parentDocument be window's navigable's parent's active document.
|
||||
auto parent_document = m_window->navigable()->parent()->active_document();
|
||||
|
||||
// 3. If parentDocument's relevant settings object's has cross-site ancestor is true, then return true.
|
||||
if (parent_document->relevant_settings_object().has_cross_site_ancestor())
|
||||
return true;
|
||||
|
||||
// 4. If parentDocument's origin is not same site with window's associated Document's origin, then return true.
|
||||
if (!parent_document->origin().is_same_site(m_window->associated_document().origin()))
|
||||
return true;
|
||||
|
||||
// 5. Return false.
|
||||
return false;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/window-object.html#script-settings-for-window-objects:concept-settings-object-policy-container
|
||||
GC::Ref<PolicyContainer> WindowEnvironmentSettingsObject::policy_container() const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user