mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:57:43 +00:00
LibWeb: Implement most of "destroy a top-level traversable"
Co-authored-by: Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
This commit is contained in:
parent
1b78e0f059
commit
40e7f64433
2 changed files with 29 additions and 0 deletions
|
@ -508,4 +508,31 @@ void TraversableNavigable::apply_pending_history_changes()
|
|||
apply_the_history_step(target_step);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/document-sequences.html#destroy-a-top-level-traversable
|
||||
void TraversableNavigable::destroy_top_level_traversable()
|
||||
{
|
||||
VERIFY(is_top_level_traversable());
|
||||
|
||||
// 1. Let browsingContext be traversable's active browsing context.
|
||||
auto browsing_context = active_browsing_context();
|
||||
|
||||
// 2. For each historyEntry in traversable's session history entries:
|
||||
for (auto& history_entry : m_session_history_entries) {
|
||||
// 1. Let document be historyEntry's document.
|
||||
auto document = history_entry->document_state->document();
|
||||
|
||||
// 2. If document is not null, then destroy document.
|
||||
if (document)
|
||||
document->destroy();
|
||||
}
|
||||
|
||||
// 3. Remove browsingContext.
|
||||
browsing_context->remove();
|
||||
|
||||
// FIXME: 4. Remove traversable from the user interface (e.g., close or hide its tab in a tabbed browser).
|
||||
|
||||
// 5. Remove traversable from the user agent's top-level traversable set.
|
||||
user_agent_top_level_traversable_set().remove(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue