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

LibWeb: Make Frame point weakly to Page

This patch makes Page weakable and allows page-less frames to exist.

Page is single-owner, and Frame is multiple-owner, so it's not sound
for Frame to assume its containing Page will stick around for its own
entire lifetime.

Fixes #3976.
This commit is contained in:
Andreas Kling 2020-11-12 18:23:05 +01:00
parent e445ff670d
commit 81add73955
12 changed files with 87 additions and 56 deletions

View file

@ -62,9 +62,9 @@ void HTMLInputElement::did_click_button(Badge<LayoutButton>)
RefPtr<LayoutNode> HTMLInputElement::create_layout_node(const CSS::StyleProperties* parent_style)
{
ASSERT(document().frame());
auto& frame = *document().frame();
auto& page_view = const_cast<InProcessWebView&>(static_cast<const InProcessWebView&>(frame.page().client()));
ASSERT(document().page());
auto& page = *document().page();
auto& page_view = const_cast<InProcessWebView&>(static_cast<const InProcessWebView&>(page.client()));
if (type() == "hidden")
return nullptr;