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

LibWeb: Protect against null deref during Web::Page initialization

BrowsingContext::set_active_document() may end up asking for the Page's
top level browsing context before Page has one. Do a workaround for now
where we have an API to ask if it's initialized.

Long-term we should find a cleaner solution.
This commit is contained in:
Andreas Kling 2023-05-27 18:37:02 +02:00
parent f07ac8f20a
commit 33500bb6db
3 changed files with 9 additions and 1 deletions

View file

@ -158,6 +158,11 @@ bool Page::handle_keyup(KeyCode key, unsigned modifiers, u32 code_point)
return focused_context().event_handler().handle_keyup(key, modifiers, code_point);
}
bool Page::top_level_browsing_context_is_initialized() const
{
return m_top_level_browsing_context;
}
HTML::BrowsingContext& Page::top_level_browsing_context()
{
return *m_top_level_browsing_context;