mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:47:45 +00:00
LibWeb: Destroy navigable containers not inserted into document tree
This change fixes the bug where navigable containers related to a document, but not present in the tree, were never destroyed. Fixes https://github.com/SerenityOS/serenity/issues/21364
This commit is contained in:
parent
61b6146d5e
commit
a86531809e
1 changed files with 4 additions and 5 deletions
|
@ -2714,12 +2714,11 @@ void Document::destroy()
|
||||||
|
|
||||||
// When a frame element stops being an active frame element, the user agent must destroy a child navigable given the element.
|
// When a frame element stops being an active frame element, the user agent must destroy a child navigable given the element.
|
||||||
// A frame element is said to be an active frame element when it is in a document tree and its node document's browsing context is non-null.
|
// A frame element is said to be an active frame element when it is in a document tree and its node document's browsing context is non-null.
|
||||||
for_each_shadow_including_descendant([&](DOM::Node& node) {
|
for (auto& navigable_container : HTML::NavigableContainer::all_instances()) {
|
||||||
if (is<HTML::NavigableContainer>(node)) {
|
if (&navigable_container->document() == this) {
|
||||||
verify_cast<HTML::NavigableContainer>(node).destroy_the_child_navigable();
|
navigable_container->destroy_the_child_navigable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return IterationDecision::Continue;
|
|
||||||
});
|
|
||||||
|
|
||||||
// 7. Set document's node navigable's active session history entry's document state's document to null.
|
// 7. Set document's node navigable's active session history entry's document state's document to null.
|
||||||
if (navigable()) {
|
if (navigable()) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue