LibWeb: Use finalize for cleaning up all navigables

The use of this HashMap looks very spooky, but let's at least use
finalize when cleaning them up on destruction to make things slightly
less dangerous looking.
This commit is contained in:
Shannon Booth 2025-01-17 14:18:36 +13:00 committed by Andreas Kling
parent 59162c8155
commit 76397c9ecd
Notes: github-actions[bot] 2025-01-17 09:11:51 +00:00
7 changed files with 17 additions and 13 deletions

View file

@ -3787,8 +3787,8 @@ void Document::destroy()
// Not in the spec:
for (auto& navigable_container : HTML::NavigableContainer::all_instances()) {
if (&navigable_container->document() == this)
HTML::all_navigables().remove(navigable_container->content_navigable());
if (&navigable_container->document() == this && navigable_container->content_navigable())
HTML::all_navigables().remove(*navigable_container->content_navigable());
}
// 9. Set document's node navigable's active session history entry's document state's document to null.