|
@@ -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);
|
|
|
+}
|
|
|
+
|
|
|
}
|