Skip to content

Truly independent web browser

LibWebView: Number an enqueued history operation where it is enqueued

Shannon Boothde60edcf6767
diff --git a/Libraries/LibWebView/CanonicalTraversable.cpp b/Libraries/LibWebView/CanonicalTraversable.cpp
index a7ddad13c64..e19fc16158e 100644
--- a/Libraries/LibWebView/CanonicalTraversable.cpp
+++ b/Libraries/LibWebView/CanonicalTraversable.cpp
@@ -670,7 +670,7 @@ void CanonicalTraversable::reload()
.navigable_id = id(),
.user_involvement = user_involvement,
};
- enqueue_history_operation(Application::the().allocate_ui_process_cross_process_id(), parameters, {}, next_sequence_number());
+ enqueue_history_operation(Application::the().allocate_ui_process_cross_process_id(), parameters, {});
}
// https://html.spec.whatwg.org/multipage/document-lifecycle.html#nav-stop
@@ -2137,8 +2137,10 @@ void CanonicalTraversable::did_attempt_to_populate_the_history_entry_document(We
navigable->populate_document_for_javascript_url(*navigation, move(history_entry), navigable->create_and_initialize_a_document(response_document));
}
-void CanonicalTraversable::enqueue_history_operation(Web::HTML::CrossProcessId operation_id, Web::HistoryOperationParameters request, RefPtr<WebContentPage> requesting_page, u64 sequence_number)
+void CanonicalTraversable::enqueue_history_operation(Web::HTML::CrossProcessId operation_id, Web::HistoryOperationParameters request, RefPtr<WebContentPage> requesting_page)
{
+ auto sequence_number = next_sequence_number();
+
// https://html.spec.whatwg.org/multipage/document-sequences.html#destroy-a-child-navigable
// Steps 6-7 remove the nested history before step 9 appends traversal steps. Apply the canonical counterpart while
// admitting the destruction request, rather than deferring it to the operation's eventual queue position.
diff --git a/Libraries/LibWebView/CanonicalTraversable.h b/Libraries/LibWebView/CanonicalTraversable.h
index 5f07a5112e3..7ae10bfbde9 100644
--- a/Libraries/LibWebView/CanonicalTraversable.h
+++ b/Libraries/LibWebView/CanonicalTraversable.h
@@ -65,7 +65,7 @@ public:
// Apply-the-history-step coordination. Operations serialize on the traversable's session history traversal
// queue; the algorithm runs here and dispatches its per-navigable jobs to the processes hosting the documents.
- void enqueue_history_operation(Web::HTML::CrossProcessId operation_id, Web::HistoryOperationParameters, RefPtr<WebContentPage> requesting_page, u64 sequence_number);
+ void enqueue_history_operation(Web::HTML::CrossProcessId operation_id, Web::HistoryOperationParameters, RefPtr<WebContentPage> requesting_page);
// Appends plain algorithm steps; a requested traversal defers its target resolution to its queued position, the
// way the specification's queued steps do, and then starts its operation at that position.
void append_history_queue_steps(SessionHistoryTraversalSteps);
diff --git a/Libraries/LibWebView/WebContentPage.cpp b/Libraries/LibWebView/WebContentPage.cpp
index 0698d78b936..e0c32c66f56 100644
--- a/Libraries/LibWebView/WebContentPage.cpp
+++ b/Libraries/LibWebView/WebContentPage.cpp
@@ -1623,7 +1623,7 @@ void WebContentPage::request_history_operation(Web::HTML::CrossProcessId operati
client().did_misbehave("request_history_operation"sv, "resumed traversal to a step before every used step"sv);
return;
}
- traversable().enqueue_history_operation(operation_id, move(parameters), *this, traversable().next_sequence_number());
+ traversable().enqueue_history_operation(operation_id, move(parameters), *this);
}
void WebContentPage::revoke_history_operation(Web::HTML::CrossProcessId operation_id)
diff --git a/Tests/LibWebView/TestSessionHistory.cpp b/Tests/LibWebView/TestSessionHistory.cpp
index 2697142d831..b12f49a91a3 100644
--- a/Tests/LibWebView/TestSessionHistory.cpp
+++ b/Tests/LibWebView/TestSessionHistory.cpp
@@ -435,7 +435,7 @@ TEST_CASE(queued_same_document_entries_are_addressed_by_identity)
.history_handling = Web::HTML::HistoryHandlingBehavior::Push,
.user_involvement = Web::HTML::UserNavigationInvolvement::None,
};
- traversable.enqueue_history_operation(operation_id, move(parameters), {}, 0);
+ traversable.enqueue_history_operation(operation_id, move(parameters), {});
};
enqueue_push({ 8, 1 }, move(first_entry));
enqueue_push({ 8, 2 }, move(replacement_entry));