瀏覽代碼

LibWeb: Only return initialized navigables from child_navigables()

Fixes a crash in `get_session_history_entries()` that happens when
it attempts to find entries for a navigable that hasn't been fully
initialized and therefore doesn't have a nested history entry yet.
Aliaksandr Kalenik 1 年之前
父節點
當前提交
fbc95440a4
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      Userland/Libraries/LibWeb/HTML/Navigable.cpp

+ 2 - 0
Userland/Libraries/LibWeb/HTML/Navigable.cpp

@@ -62,6 +62,8 @@ Vector<JS::Handle<Navigable>> Navigable::child_navigables() const
 {
     Vector<JS::Handle<Navigable>> results;
     for (auto& entry : all_navigables()) {
+        if (entry->current_session_history_entry()->step == SessionHistoryEntry::Pending::Tag)
+            continue;
         if (entry->parent() == this)
             results.append(entry);
     }