mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 00:25:12 +00:00
LibWeb: Implement "close a top-level traversable"
This commit is contained in:
@@ -511,6 +511,25 @@ void TraversableNavigable::apply_pending_history_changes()
|
||||
apply_the_history_step(target_step);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/document-sequences.html#close-a-top-level-traversable
|
||||
void TraversableNavigable::close_top_level_traversable()
|
||||
{
|
||||
VERIFY(is_top_level_traversable());
|
||||
|
||||
// 1. Let toUnload be traversable's active document's inclusive descendant navigables.
|
||||
auto to_unload = active_document()->inclusive_descendant_navigables();
|
||||
|
||||
// FIXME: 2. If the result of checking if unloading is user-canceled for toUnload is true, then return.
|
||||
|
||||
// 3. Unload the active documents of each of toUnload.
|
||||
for (auto navigable : to_unload) {
|
||||
navigable->active_document()->unload();
|
||||
}
|
||||
|
||||
// 4. Destroy traversable.
|
||||
destroy_top_level_traversable();
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/document-sequences.html#destroy-a-top-level-traversable
|
||||
void TraversableNavigable::destroy_top_level_traversable()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user