Explorar el Código

LibWeb: Use saved navigable pointer in destroy_the_child_navigable

During the destruction of a navigable, we need to use the pointer to
the navigable that was saved at the beginning of the function. This
is because `Node::navigable()` will return a nullptr in subsequent
steps after the navigable's document becomes inactive.
Aliaksandr Kalenik hace 1 año
padre
commit
67f5c027fe
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      Userland/Libraries/LibWeb/HTML/NavigableContainer.cpp

+ 2 - 2
Userland/Libraries/LibWeb/HTML/NavigableContainer.cpp

@@ -253,7 +253,7 @@ void NavigableContainer::destroy_the_child_navigable()
     navigable->active_document()->destroy();
     navigable->active_document()->destroy();
 
 
     // 5. Let parentDocState be container's node navigable's active session history entry's document state.
     // 5. Let parentDocState be container's node navigable's active session history entry's document state.
-    auto parent_doc_state = this->navigable()->active_session_history_entry()->document_state;
+    auto parent_doc_state = navigable->active_session_history_entry()->document_state;
 
 
     // 6. Remove the nested history from parentDocState's nested histories whose id equals navigable's id.
     // 6. Remove the nested history from parentDocState's nested histories whose id equals navigable's id.
     parent_doc_state->nested_histories().remove_all_matching([&](auto& nested_history) {
     parent_doc_state->nested_histories().remove_all_matching([&](auto& nested_history) {
@@ -261,7 +261,7 @@ void NavigableContainer::destroy_the_child_navigable()
     });
     });
 
 
     // 7. Let traversable be container's node navigable's traversable navigable.
     // 7. Let traversable be container's node navigable's traversable navigable.
-    auto traversable = this->navigable()->traversable_navigable();
+    auto traversable = navigable->traversable_navigable();
 
 
     // Not in the spec
     // Not in the spec
     navigable->set_has_been_destroyed();
     navigable->set_has_been_destroyed();