Truly independent web browser
LibWeb: Check a navigation is ongoing before ending it as a download
Shannon Booth50b92f73746b
diff --git a/Libraries/LibWeb/HTML/LocalNavigable.cpp b/Libraries/LibWeb/HTML/LocalNavigable.cppindex c1598cd8c46..2607c7d6309 100644--- a/Libraries/LibWeb/HTML/LocalNavigable.cpp+++ b/Libraries/LibWeb/HTML/LocalNavigable.cpp@@ -970,6 +970,13 @@ void LocalNavigable::continue_navigation_at_population(NavigationPopulationRequeBindings::NavigationTimingType::Navigate,output,GC::create_function(navigable->heap(), [navigable, history_entry, history_handling = request.history_handling, navigation_id = request.navigation_id, user_involvement = request.user_involvement](GC::Ptr<PopulateSessionHistoryEntryDocumentOutput> output) mutable {+ // AD-HOC: This check is not in the spec but we should not continue navigation if ongoing navigation id has changed.+ if (navigable->ongoing_navigation() != navigation_id) {+ navigable->stop_delaying_load_events_for_navigation(navigation_id);+ navigable->page().client().navigation_population_failed(navigable->id(), navigation_id);+ return;+ }+if (output && output->download_handled) {// NB: The UI process ended the recorded load and its transaction when the download adopted this// population's response body.@@ -978,13 +985,6 @@ void LocalNavigable::continue_navigation_at_population(NavigationPopulationRequereturn;}- // AD-HOC: This check is not in the spec but we should not continue navigation if ongoing navigation id has changed.- if (navigable->ongoing_navigation() != navigation_id) {- navigable->stop_delaying_load_events_for_navigation(navigation_id);- navigable->page().client().navigation_population_failed(navigable->id(), navigation_id);- return;- }-if (output)output->apply_to(*history_entry);auto pending_document = output ? output->document : GC::Ptr<DOM::Document> {};