From 4f2a0a3d565dfe01c6a8fc486f501d1bb6a10c74 Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Sat, 18 Nov 2023 14:32:31 +0100 Subject: [PATCH] LibWeb: Remove ongoing navigation id check in navigate_to_a_fragment() It is a mistake to add this early return in fragment navigation because "ongoing navigation id" is not used during this kind of navigation. With this change we no longer crash in Acid2 test after reload button is pressed. --- Userland/Libraries/LibWeb/HTML/Navigable.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Userland/Libraries/LibWeb/HTML/Navigable.cpp b/Userland/Libraries/LibWeb/HTML/Navigable.cpp index 8788790f56..c7484ee06d 100644 --- a/Userland/Libraries/LibWeb/HTML/Navigable.cpp +++ b/Userland/Libraries/LibWeb/HTML/Navigable.cpp @@ -1313,10 +1313,8 @@ WebIDL::ExceptionOr Navigable::navigate(NavigateParams params) return {}; } -WebIDL::ExceptionOr Navigable::navigate_to_a_fragment(AK::URL const& url, HistoryHandlingBehavior history_handling, String navigation_id) +WebIDL::ExceptionOr Navigable::navigate_to_a_fragment(AK::URL const& url, HistoryHandlingBehavior history_handling, String) { - (void)navigation_id; - // FIXME: 1. Let navigation be navigable's active window's navigation API. // FIXME: 2. Let destinationNavigationAPIState be navigable's active session history entry's navigation API state. // FIXME: 3. If navigationAPIState is not null, then set destinationNavigationAPIState to navigationAPIState. @@ -1374,12 +1372,7 @@ WebIDL::ExceptionOr Navigable::navigate_to_a_fragment(AK::URL const& url, auto traversable = traversable_navigable(); // 17. Append the following session history synchronous navigation steps involving navigable to traversable: - traversable->append_session_history_traversal_steps([this, traversable, history_entry, entry_to_replace, navigation_id] { - if (this->ongoing_navigation() != navigation_id) { - // NOTE: This check is not in the spec but we should not continue navigation if ongoing navigation id has changed. - return; - } - + traversable->append_session_history_traversal_steps([this, traversable, history_entry, entry_to_replace] { // 1. Finalize a same-document navigation given traversable, navigable, historyEntry, and entryToReplace. finalize_a_same_document_navigation(*traversable, *this, history_entry, entry_to_replace);