Skip to content

Truly independent web browser

LibWeb: Don't apply a continuation inside a destroyed subtree

Shannon Boothc82167b5d6c6
diff --git a/Libraries/LibWeb/HTML/HistoryExecutor.cpp b/Libraries/LibWeb/HTML/HistoryExecutor.cpp
index ea966b3a871..caf6ccf035c 100644
--- a/Libraries/LibWeb/HTML/HistoryExecutor.cpp
+++ b/Libraries/LibWeb/HTML/HistoryExecutor.cpp
@@ -581,8 +581,9 @@ Optional<HistoryExecutor::DequeuedChangingNavigableContinuation> HistoryExecutor
// 6. Let navigable be changingNavigableContinuation's navigable.
auto navigable = continuation->navigable;
- // AD-HOC: This process can destroy the navigable, or the displayed document, before the UI process removes it.
- if (navigable->has_been_destroyed() || !displayed_document->navigable())
+ // AD-HOC: This process can destroy the navigable, an ancestor of it, or the displayed document, before the UI
+ // process removes it.
+ if (navigable->is_in_a_destroyed_subtree() || !displayed_document->navigable())
return {};
// 7. Let (scriptHistoryLength, scriptHistoryIndex) be the result of getting the history object length and index given traversable and targetStep.