From 54d41cfea34c7e078cbcd66a906cb89757ea90af Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Thu, 20 Feb 2025 13:02:56 +0000 Subject: [PATCH] LibWeb/HTML: Update navigation API when a same-document reload occurs Corresponds to https://github.com/whatwg/html/commit/3a2a05ddf857c72b3f1881bf22020825870e9fad --- Libraries/LibWeb/HTML/Navigation.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Libraries/LibWeb/HTML/Navigation.cpp b/Libraries/LibWeb/HTML/Navigation.cpp index 19a052bb345..0146e3ae50a 100644 --- a/Libraries/LibWeb/HTML/Navigation.cpp +++ b/Libraries/LibWeb/HTML/Navigation.cpp @@ -1126,7 +1126,14 @@ bool Navigation::inner_navigate_event_firing_algorithm( auto history_handling = navigation_type == Bindings::NavigationType::Push ? HistoryHandlingBehavior::Push : HistoryHandlingBehavior::Replace; perform_url_and_history_update_steps(document, event->destination()->raw_url(), event->classic_history_api_state(), history_handling); } - // Big spec note about reload here + + // 8. Otherwise, if navigationType is "reload", then update the navigation API entries for a same-document navigation + // given navigation, navigable's active session history entry, and "reload". + // NOTE: If navigationType is "traverse", then this event firing is happening as part of the traversal process, and + // that process will take care of performing the appropriate session history entry updates. + if (navigation_type == Bindings::NavigationType::Reload) { + update_the_navigation_api_entries_for_a_same_document_navigation(*navigable->active_session_history_entry(), Bindings::NavigationType::Reload); + } } // 34. If endResultIsSameDocument is true: