summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML')
-rw-r--r--Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp1
-rw-r--r--Userland/Libraries/LibWeb/HTML/BrowsingContext.h7
-rw-r--r--Userland/Libraries/LibWeb/HTML/CrossOrigin/Reporting.cpp8
3 files changed, 12 insertions, 4 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
index a371771aeb..67cb6e1eca 100644
--- a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
+++ b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
@@ -246,6 +246,7 @@ void BrowsingContext::visit_edges(Cell::Visitor& visitor)
visitor.visit(entry.document);
visitor.visit(m_container);
visitor.visit(m_window_proxy);
+ visitor.visit(m_opener_browsing_context);
visitor.visit(m_group);
visitor.visit(m_parent);
visitor.visit(m_first_child);
diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContext.h b/Userland/Libraries/LibWeb/HTML/BrowsingContext.h
index 27a8763690..64953a5638 100644
--- a/Userland/Libraries/LibWeb/HTML/BrowsingContext.h
+++ b/Userland/Libraries/LibWeb/HTML/BrowsingContext.h
@@ -124,6 +124,10 @@ public:
HTML::WindowProxy* window_proxy();
HTML::WindowProxy const* window_proxy() const;
+ JS::GCPtr<BrowsingContext> opener_browsing_context() const { return m_opener_browsing_context; }
+
+ void set_opener_browsing_context(JS::GCPtr<BrowsingContext> browsing_context) { m_opener_browsing_context = browsing_context; }
+
HTML::Window* active_window();
HTML::Window const* active_window() const;
@@ -288,6 +292,9 @@ private:
// https://html.spec.whatwg.org/multipage/browsers.html#browsing-context
JS::GCPtr<HTML::WindowProxy> m_window_proxy;
+ // https://html.spec.whatwg.org/multipage/browsers.html#opener-browsing-context
+ JS::GCPtr<BrowsingContext> m_opener_browsing_context;
+
DOM::Position m_cursor_position;
RefPtr<Platform::Timer> m_cursor_blink_timer;
bool m_cursor_blink_state { false };
diff --git a/Userland/Libraries/LibWeb/HTML/CrossOrigin/Reporting.cpp b/Userland/Libraries/LibWeb/HTML/CrossOrigin/Reporting.cpp
index b3b940fbfe..81da84e14d 100644
--- a/Userland/Libraries/LibWeb/HTML/CrossOrigin/Reporting.cpp
+++ b/Userland/Libraries/LibWeb/HTML/CrossOrigin/Reporting.cpp
@@ -26,12 +26,12 @@ void check_if_access_between_two_browsing_contexts_should_be_reported(BrowsingCo
// 4. Let accessorAccessedRelationship be a new accessor-accessed relationship with value none.
auto accessor_accessed_relationship = AccessorAccessedRelationship::None;
- // FIXME: 5. If accessed's top-level browsing context's opener browsing context is accessor or an ancestor of accessor, then set accessorAccessedRelationship to accessor is opener.
- if (false)
+ // 5. If accessed's top-level browsing context's opener browsing context is accessor or an ancestor of accessor, then set accessorAccessedRelationship to accessor is opener.
+ if (auto opener = accessed.top_level_browsing_context().opener_browsing_context(); opener && (opener == &accessor || opener->is_ancestor_of(accessor)))
accessor_accessed_relationship = AccessorAccessedRelationship::AccessorIsOpener;
- // FIXME: 6. If accessor's top-level browsing context's opener browsing context is accessed or an ancestor of accessed, then set accessorAccessedRelationship to accessor is openee.
- if (false)
+ // 6. If accessor's top-level browsing context's opener browsing context is accessed or an ancestor of accessed, then set accessorAccessedRelationship to accessor is openee.
+ if (auto opener = accessor.top_level_browsing_context().opener_browsing_context(); opener && (opener == &accessed || opener->is_ancestor_of(accessed)))
accessor_accessed_relationship = AccessorAccessedRelationship::AccessorIsOpenee;
// FIXME: 7. Queue violation reports for accesses, given accessorAccessedRelationship, accessor's top-level browsing context's active document's cross-origin opener policy, accessed's top-level browsing context's active document's cross-origin opener policy, accessor's active document's URL, accessed's active document's URL, accessor's top-level browsing context's initial URL, accessed's top-level browsing context's initial URL, accessor's active document's origin, accessed's active document's origin, accessor's top-level browsing context's opener origin at creation, accessed's top-level browsing context's opener origin at creation, accessor's top-level browsing context's active document's referrer, accessed's top-level browsing context's active document's referrer, P, and environment.