mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-25 18:58:56 +00:00
LibWeb: Fix "destroy the child navigable" to call Document::destroy()
f66d33423b
was not sufficient to ensure
document destruction when a child navigable is destroyed. This is
because a navigable was remove from the set of all navigables too early
which led to `Navigable::navigable_with_active_document()` being unable
to find a navigable that is still in the process of destruction.
This change solves that by making all steps of a navigable destruction
to happen in afterAllDestruction callback.
Unfortunately, writing a test to verify document destruction is
challenging because no events are emitted to indicate that it has
happened.
This commit is contained in:
parent
35676491ec
commit
696cf7b9fb
Notes:
sideshowbarker
2024-07-17 08:34:29 +09:00
Author: https://github.com/kalenikaliaksandr
Commit: 696cf7b9fb
Pull-request: https://github.com/SerenityOS/serenity/pull/23821
Reviewed-by: https://github.com/awesomekling
1 changed files with 17 additions and 15 deletions
|
@ -267,15 +267,16 @@ void NavigableContainer::destroy_the_child_navigable()
|
|||
if (navigable->has_been_destroyed())
|
||||
return;
|
||||
navigable->set_has_been_destroyed();
|
||||
HTML::all_navigables().remove(navigable);
|
||||
|
||||
// FIXME: 4. Inform the navigation API about child navigable destruction given navigable.
|
||||
|
||||
// 5. Destroy a document and its descendants given navigable's active document.
|
||||
navigable->active_document()->destroy_a_document_and_its_descendants([this] {
|
||||
navigable->active_document()->destroy_a_document_and_its_descendants([this, navigable] {
|
||||
// 3. Set container's content navigable to null.
|
||||
m_content_navigable = nullptr;
|
||||
});
|
||||
|
||||
// Not in the spec:
|
||||
HTML::all_navigables().remove(navigable);
|
||||
|
||||
// 6. Let parentDocState be container's node navigable's active session history entry's document state.
|
||||
auto parent_doc_state = this->navigable()->active_session_history_entry()->document_state();
|
||||
|
@ -293,6 +294,7 @@ void NavigableContainer::destroy_the_child_navigable()
|
|||
// 1. Update for navigable creation/destruction given traversable.
|
||||
traversable->update_for_navigable_creation_or_destruction();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#potentially-delays-the-load-event
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue