diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContextGroup.cpp b/Userland/Libraries/LibWeb/HTML/BrowsingContextGroup.cpp
index 046b92478b..7235ec82ed 100644
--- a/Userland/Libraries/LibWeb/HTML/BrowsingContextGroup.cpp
+++ b/Userland/Libraries/LibWeb/HTML/BrowsingContextGroup.cpp
@@ -20,7 +20,7 @@ static HashTable>& user_agent_browsing_co
return set;
}
-BrowsingContextGroup::BrowsingContextGroup(Web::Page& page)
+BrowsingContextGroup::BrowsingContextGroup(JS::NonnullGCPtr page)
: m_page(page)
{
user_agent_browsing_context_group_set().set(*this);
@@ -40,7 +40,7 @@ void BrowsingContextGroup::visit_edges(Cell::Visitor& visitor)
}
// https://html.spec.whatwg.org/multipage/document-sequences.html#creating-a-new-browsing-context-group-and-document
-auto BrowsingContextGroup::create_a_new_browsing_context_group_and_document(Page& page) -> WebIDL::ExceptionOr
+auto BrowsingContextGroup::create_a_new_browsing_context_group_and_document(JS::NonnullGCPtr page) -> WebIDL::ExceptionOr
{
// 1. Let group be a new browsing context group.
// 2. Append group to the user agent's browsing context group set.
diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContextGroup.h b/Userland/Libraries/LibWeb/HTML/BrowsingContextGroup.h
index a5f4932a7f..e7f0f74cce 100644
--- a/Userland/Libraries/LibWeb/HTML/BrowsingContextGroup.h
+++ b/Userland/Libraries/LibWeb/HTML/BrowsingContextGroup.h
@@ -23,7 +23,7 @@ public:
JS::NonnullGCPtr browsing_context;
JS::NonnullGCPtr document;
};
- static WebIDL::ExceptionOr create_a_new_browsing_context_group_and_document(Page&);
+ static WebIDL::ExceptionOr create_a_new_browsing_context_group_and_document(JS::NonnullGCPtr);
~BrowsingContextGroup();
@@ -36,7 +36,7 @@ public:
void append(BrowsingContext&);
private:
- explicit BrowsingContextGroup(Web::Page&);
+ explicit BrowsingContextGroup(JS::NonnullGCPtr);
virtual void visit_edges(Cell::Visitor&) override;
diff --git a/Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp b/Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp
index dc1624602c..761af6e51f 100644
--- a/Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp
+++ b/Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp
@@ -20,7 +20,7 @@ namespace Web::HTML {
JS_DEFINE_ALLOCATOR(TraversableNavigable);
-TraversableNavigable::TraversableNavigable(Page& page)
+TraversableNavigable::TraversableNavigable(JS::NonnullGCPtr page)
: m_page(page)
{
}
@@ -30,6 +30,7 @@ TraversableNavigable::~TraversableNavigable() = default;
void TraversableNavigable::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);
+ visitor.visit(m_page);
for (auto& entry : m_session_history_entries)
visitor.visit(entry);
}
@@ -41,7 +42,7 @@ static OrderedHashTable& user_agent_top_level_traversable
}
// https://html.spec.whatwg.org/multipage/document-sequences.html#creating-a-new-top-level-browsing-context
-WebIDL::ExceptionOr create_a_new_top_level_browsing_context_and_document(Page& page)
+WebIDL::ExceptionOr create_a_new_top_level_browsing_context_and_document(JS::NonnullGCPtr page)
{
// 1. Let group and document be the result of creating a new browsing context group and document.
auto [group, document] = TRY(BrowsingContextGroup::create_a_new_browsing_context_group_and_document(page));
@@ -51,7 +52,7 @@ WebIDL::ExceptionOr create_a_new_top_level_browsing_
}
// https://html.spec.whatwg.org/multipage/document-sequences.html#creating-a-new-top-level-traversable
-WebIDL::ExceptionOr> TraversableNavigable::create_a_new_top_level_traversable(Page& page, JS::GCPtr opener, String target_name)
+WebIDL::ExceptionOr> TraversableNavigable::create_a_new_top_level_traversable(JS::NonnullGCPtr page, JS::GCPtr opener, String target_name)
{
auto& vm = Bindings::main_thread_vm();
@@ -112,7 +113,7 @@ WebIDL::ExceptionOr> TraversableNavigable
}
// https://html.spec.whatwg.org/multipage/document-sequences.html#create-a-fresh-top-level-traversable
-WebIDL::ExceptionOr> TraversableNavigable::create_a_fresh_top_level_traversable(Page& page, AK::URL const& initial_navigation_url, Variant initial_navigation_post_resource)
+WebIDL::ExceptionOr> TraversableNavigable::create_a_fresh_top_level_traversable(JS::NonnullGCPtr page, AK::URL const& initial_navigation_url, Variant initial_navigation_post_resource)
{
// 1. Let traversable be the result of creating a new top-level traversable given null and the empty string.
auto traversable = TRY(create_a_new_top_level_traversable(page, nullptr, {}));
diff --git a/Userland/Libraries/LibWeb/HTML/TraversableNavigable.h b/Userland/Libraries/LibWeb/HTML/TraversableNavigable.h
index 4915930cc9..8c9281d0f2 100644
--- a/Userland/Libraries/LibWeb/HTML/TraversableNavigable.h
+++ b/Userland/Libraries/LibWeb/HTML/TraversableNavigable.h
@@ -19,8 +19,8 @@ class TraversableNavigable final : public Navigable {
JS_DECLARE_ALLOCATOR(TraversableNavigable);
public:
- static WebIDL::ExceptionOr> create_a_new_top_level_traversable(Page&, JS::GCPtr opener, String target_name);
- static WebIDL::ExceptionOr> create_a_fresh_top_level_traversable(Page&, AK::URL const& initial_navigation_url, Variant = Empty {});
+ static WebIDL::ExceptionOr> create_a_new_top_level_traversable(JS::NonnullGCPtr, JS::GCPtr opener, String target_name);
+ static WebIDL::ExceptionOr> create_a_fresh_top_level_traversable(JS::NonnullGCPtr, AK::URL const& initial_navigation_url, Variant = Empty {});
virtual ~TraversableNavigable() override;
@@ -67,7 +67,7 @@ public:
Page const* page() const { return m_page; }
private:
- TraversableNavigable(Page&);
+ TraversableNavigable(JS::NonnullGCPtr);
virtual void visit_edges(Cell::Visitor&) override;
@@ -89,7 +89,7 @@ private:
SessionHistoryTraversalQueue m_session_history_traversal_queue;
- WeakPtr m_page;
+ JS::NonnullGCPtr m_page;
};
struct BrowsingContextAndDocument {
@@ -97,7 +97,7 @@ struct BrowsingContextAndDocument {
JS::NonnullGCPtr document;
};
-WebIDL::ExceptionOr create_a_new_top_level_browsing_context_and_document(Page& page);
+WebIDL::ExceptionOr create_a_new_top_level_browsing_context_and_document(JS::NonnullGCPtr page);
void finalize_a_same_document_navigation(JS::NonnullGCPtr traversable, JS::NonnullGCPtr target_navigable, JS::NonnullGCPtr target_entry, JS::GCPtr entry_to_replace);
}