1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 08:54:58 +00:00

LibWeb: Make BrowsingContext GC-allocated

(And BrowsingContextGroup had to come along for the ride as well.)
This solves a number of nasty reference cycles between browsing
contexts, history items, and their documents.
This commit is contained in:
Andreas Kling 2022-10-17 11:06:50 +02:00
parent 2898701459
commit 83c5ff57d8
15 changed files with 225 additions and 44 deletions

View file

@ -13,7 +13,7 @@ namespace Web {
Page::Page(PageClient& client)
: m_client(client)
{
m_top_level_browsing_context = HTML::BrowsingContext::create_a_new_top_level_browsing_context(*this);
m_top_level_browsing_context = JS::make_handle(*HTML::BrowsingContext::create_a_new_top_level_browsing_context(*this));
}
Page::~Page() = default;
@ -95,4 +95,14 @@ bool Page::handle_keyup(KeyCode key, unsigned modifiers, u32 code_point)
return focused_context().event_handler().handle_keyup(key, modifiers, code_point);
}
HTML::BrowsingContext& Page::top_level_browsing_context()
{
return *m_top_level_browsing_context;
}
HTML::BrowsingContext const& Page::top_level_browsing_context() const
{
return *m_top_level_browsing_context;
}
}