LibWeb: Check if entryToReplace is contained in session history entries

This small hack will allow us to get rid of "force processing of
session history traversal queue" which is significantly more cumbersome
hack.
This commit is contained in:
Aliaksandr Kalenik 2024-04-05 17:39:33 +02:00 committed by Alexander Kalenik
parent adcc3905e5
commit 8cc2ee34db
Notes: sideshowbarker 2024-07-17 01:46:00 +09:00

View File

@ -1011,7 +1011,9 @@ void finalize_a_same_document_navigation(JS::NonnullGCPtr<TraversableNavigable>
auto& target_entries = target_navigable->get_session_history_entries();
// 5. If entryToReplace is null, then:
if (!entry_to_replace) {
// FIXME: Checking containment of entryToReplace should not be needed.
// For more details see https://github.com/whatwg/html/issues/10232#issuecomment-2037543137
if (!entry_to_replace || !target_entries.contains_slow(JS::NonnullGCPtr { *entry_to_replace })) {
// 1. Clear the forward session history of traversable.
traversable->clear_the_forward_session_history();