mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 22:25:08 +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:
parent
e445ff670d
commit
81add73955
12 changed files with 87 additions and 56 deletions
|
@ -160,8 +160,10 @@ bool FrameLoader::load(const LoadRequest& request, Type type)
|
|||
|
||||
set_resource(ResourceLoader::the().load_resource(Resource::Type::Generic, request));
|
||||
|
||||
if (type == Type::Navigation)
|
||||
frame().page().client().page_did_start_loading(url);
|
||||
if (type == Type::Navigation) {
|
||||
if (auto* page = frame().page())
|
||||
page->client().page_did_start_loading(url);
|
||||
}
|
||||
|
||||
if (type == Type::IFrame)
|
||||
return true;
|
||||
|
@ -184,7 +186,8 @@ bool FrameLoader::load(const LoadRequest& request, Type type)
|
|||
return;
|
||||
}
|
||||
dbg() << "Decoded favicon, " << bitmap->size();
|
||||
frame().page().client().page_did_change_favicon(*bitmap);
|
||||
if (auto* page = frame().page())
|
||||
page->client().page_did_change_favicon(*bitmap);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue