Truly independent web browser
LibWeb: Apply a displaced push or replace job as update-only
Shannon Boothec2e000327d5
diff --git a/Libraries/LibWeb/HTML/HistoryExecutor.cpp b/Libraries/LibWeb/HTML/HistoryExecutor.cppindex 38c7623962e..614908a3cd5 100644--- a/Libraries/LibWeb/HTML/HistoryExecutor.cpp+++ b/Libraries/LibWeb/HTML/HistoryExecutor.cpp@@ -329,19 +329,6 @@ void HistoryExecutor::run_ui_changing_navigable_history_job(CrossProcessId opera// job. Retain that exact local entry instead of repeating the global-step lookup in WebContent.NonnullRefPtr claimed_target_entry = local_target_entry.release_nonnull();- auto active_entry = navigable->active_session_history_entry();- auto applies_same_document_push_or_replace = is_same_document_push_or_replace(- navigation_type, *claimed_target_entry, navigable->active_document_id());-- // A newer synchronous navigation can become active after this operation's exact-entry check. Preserve that visible entry while- // advancing current entry in queue order; the newer operation advances it again.- if (applies_same_document_push_or_replace- && active_entry != claimed_target_entry) {- navigable->set_current_session_history_entry(claimed_target_entry);- on_complete->function()(ChangingNavigableHistoryStepJobDisposition::Skipped, false, {});- return;- }-// https://html.spec.whatwg.org/multipage/nav-history-apis.html#fire-a-traverse-navigate-event// The UI process is the canonical coordinator for navigation starts and history operations. Only it can prove// that a navigation was admitted after this traversal; the presence of a local navigation ID does not establish@@ -386,13 +373,12 @@ void HistoryExecutor::run_ui_changing_navigable_history_job(CrossProcessId opera// 2. Let targetEntry be navigable's current session history entry.// AD-HOC: A synchronous navigation that jumps the queue during this run's apply-history-step re-claims the- // navigable before this task runs. It supersedes a same-document push or replace, as the newest claim- // wins, but no other run: that run still applies its claimed target entry once the jumped navigation's- // nested run completes. A navigation proven newer completes the job as stale before this task is- // queued.+ // navigable before this task runs. The run still applies its claimed target entry once the jumped+ // navigation's nested run completes. A navigation proven newer completes the job as stale before this+ // task is queued.auto target_entry = navigable->current_session_history_entry();if (target_entry != claimed_target_entry) {- if (!target_entry || is_same_document_push_or_replace(navigation_type, *claimed_target_entry, navigable->active_document_id())) {+ if (!target_entry) {// AD-HOC: Release the claim this job made, unless its operation completed and released it already.if (auto* operation = find_history_operation(operation_id)) {operation->changing_navigable_jobs.remove(navigable_id);@@ -417,15 +403,11 @@ void HistoryExecutor::run_ui_changing_navigable_history_job(CrossProcessId operachanging_navigable_continuation->population_output = nullptr;// 4. If displayedEntry is targetEntry and targetEntry's document state's reload pending is false, then:- bool is_update_only = displayed_entry == target_entry- && !target_entry->document_state()->reload_pending();- if (is_same_document_push_or_replace(- navigation_type, *target_entry,- changing_navigable_continuation->displayed_document_id)) {- is_update_only = !target_entry->document_state()->reload_pending()- || displayed_entry == target_entry;- }- if (is_update_only) {+ // AD-HOC: A same-document push or replace is update-only too. Its document displays its entry already, or a+ // newer one a synchronous navigation that jumped the queue pushed or replaced, which the continuation+ // then leaves displayed.+ if ((displayed_entry == target_entry && !target_entry->document_state()->reload_pending())+ || is_same_document_push_or_replace(navigation_type, *target_entry, changing_navigable_continuation->displayed_document_id)) {// 1. Set changingNavigableContinuation's update-only to true.changing_navigable_continuation->update_only = true;changing_navigable_continuation->target_document = navigable->active_document();