From c20123378d6bfac3d259fa5e7ad13a3d811fe295 Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Sun, 3 Sep 2023 22:34:27 +0200 Subject: [PATCH] LibWeb: Add unloading of child navigables in "apply the history step" Implements missing step from the spec. --- Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp b/Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp index e6ef402a1f..14fca46334 100644 --- a/Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp +++ b/Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp @@ -406,8 +406,13 @@ void TraversableNavigable::apply_the_history_step(int step, Optionalunload(target_entry->document_state->document()); - // FIXME: 2. For each childNavigable of displayedDocument's descendant navigables, queue a global task on the navigation and traversal task source given - // childNavigable's active window to unload childNavigable's active document. + // 2. For each childNavigable of displayedDocument's descendant navigables, queue a global task on the navigation and traversal task source given + // childNavigable's active window to unload childNavigable's active document. + for (auto child_navigable : displayed_document->descendant_navigables()) { + queue_global_task(Task::Source::NavigationAndTraversal, *navigable->active_window(), [child_navigable] { + child_navigable->active_document()->unload(); + }); + } // 3. Activate history entry targetEntry for navigable. navigable->activate_history_entry(*target_entry);