Selaa lähdekoodia

LibWeb: Update create_new_child_navigable() after spec fix

Now that https://github.com/whatwg/html/issues/9686 is fixed, let's
fix it the exact same way in our implementation. :^)
Andreas Kling 1 vuosi sitten
vanhempi
commit
0a05be69cf
1 muutettua tiedostoa jossa 8 lisäystä ja 6 poistoa
  1. 8 6
      Userland/Libraries/LibWeb/HTML/NavigableContainer.cpp

+ 8 - 6
Userland/Libraries/LibWeb/HTML/NavigableContainer.cpp

@@ -114,16 +114,18 @@ WebIDL::ExceptionOr<void> NavigableContainer::create_new_child_navigable()
 
         auto parent_doc_state = parent_navigable->active_session_history_entry()->document_state;
 
-        // 2. Let targetStepSHE be the first session history entry in traversable's session history entries whose document state equals parentDocState.
-        // NOTE: We need to look for parent document state in parent navigable instead of traversable as specification says. https://github.com/whatwg/html/issues/9686
-        auto target_step_she = *(parent_navigable->get_session_history_entries().find_if([parent_doc_state](auto& entry) {
+        // 2. Let parentNavigableEntries be the result of getting session history entries for parentNavigable.
+        auto parent_navigable_entries = parent_navigable->get_session_history_entries();
+
+        // 3. Let targetStepSHE be the first session history entry in parentNavigableEntries whose document state equals parentDocState.
+        auto target_step_she = *parent_navigable_entries.find_if([parent_doc_state](auto& entry) {
             return entry->document_state == parent_doc_state;
-        }));
+        });
 
-        // 3. Set historyEntry's step to targetStepSHE's step.
+        // 4. Set historyEntry's step to targetStepSHE's step.
         history_entry->step = target_step_she->step;
 
-        // 4. Let nestedHistory be a new nested history whose id is navigable's id and entries list is « historyEntry ».
+        // 5. Let nestedHistory be a new nested history whose id is navigable's id and entries list is « historyEntry ».
         DocumentState::NestedHistory nested_history {
             .id = navigable->id(),
             .entries { *history_entry },