ソースを参照

LibWeb: Add unloading of child navigables in "apply the history step"

Implements missing step from the spec.
Aliaksandr Kalenik 1 年間 前
コミット
c20123378d
1 ファイル変更7 行追加2 行削除
  1. 7 2
      Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp

+ 7 - 2
Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp

@@ -406,8 +406,13 @@ void TraversableNavigable::apply_the_history_step(int step, Optional<SourceSnaps
                 // 1. Unload displayedDocument given targetEntry's document.
                 // 1. Unload displayedDocument given targetEntry's document.
                 displayed_document->unload(target_entry->document_state->document());
                 displayed_document->unload(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.
                 // 3. Activate history entry targetEntry for navigable.
                 navigable->activate_history_entry(*target_entry);
                 navigable->activate_history_entry(*target_entry);