From 2b3bc2654f8c1833d909c1a290f5754182f28b1a Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Mon, 12 Feb 2024 17:36:38 -0700 Subject: [PATCH] LibWeb: Mark Navigable as destroyed in destroy_top_level_traversable AO Without this, a top level traversable might show up in settings we don't want it to when accessing all_navigables, such as choose a navigable. --- Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp b/Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp index fde231d79c..3b37550b04 100644 --- a/Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp +++ b/Userland/Libraries/LibWeb/HTML/TraversableNavigable.cpp @@ -917,6 +917,11 @@ void TraversableNavigable::destroy_top_level_traversable() // 5. Remove traversable from the user agent's top-level traversable set. user_agent_top_level_traversable_set().remove(this); + + // FIXME: Figure out why we need to do this... we shouldn't be leaking Navigables for all time. + // However, without this, we can keep stale destroyed traversables around. + set_has_been_destroyed(); + all_navigables().remove(this); } // https://html.spec.whatwg.org/multipage/browsing-the-web.html#finalize-a-same-document-navigation