RESOLVED FIXED 282622
[Navigation] Cross document push navigations don't prune correctly
https://bugs.webkit.org/show_bug.cgi?id=282622
Summary [Navigation] Cross document push navigations don't prune correctly
Patrick Griffis
Reported 2024-11-05 10:46:40 PST
This is test navigation-api/navigation-history-entry/entries-after-cross-document-forward-pruning.html This is resolved by fixing this fixme: https://github.com/WebKit/WebKit/blob/ac9f0488c548bf6c6bc855059c6b3b27929b1b81/Source/WebCore/page/Navigation.cpp#L141 A diff such as this would be the starting point: diff --git a/Source/WebCore/page/Navigation.cpp b/Source/WebCore/page/Navigation.cpp index cf5725257363..c0753548cfb2 100644 --- a/Source/WebCore/page/Navigation.cpp +++ b/Source/WebCore/page/Navigation.cpp @@ -138,7 +138,7 @@ void Navigation::initializeForNewWindow(std::optional<NavigationNavigationType> // FIXME: This should handle Push, however somewhere before here the currentEntry of previousNavigation was updated // to the new navigation so we get duplicate entries. - if (navigationType != NavigationNavigationType::Push) { + if (true) { if (navigationType == NavigationNavigationType::Traverse) { m_currentEntryIndex = getEntryIndexOfHistoryItem(m_entries, *currentItem); if (m_currentEntryIndex) { @@ -151,6 +151,11 @@ void Navigation::initializeForNewWindow(std::optional<NavigationNavigationType> } else { Ref previousEntry = m_entries[*previousNavigation->m_currentEntryIndex]; + if (navigationType == NavigationNavigationType::Push) { + m_entries.resize(*previousNavigation->m_currentEntryIndex + 1); // Prune forward entries. + m_entries.append(NavigationHistoryEntry::create(protectedScriptExecutionContext().get(), *currentItem)); // fixme + } + if (navigationType == NavigationNavigationType::Replace) m_entries[*previousNavigation->m_currentEntryIndex] = NavigationHistoryEntry::create(protectedScriptExecutionContext().get(), *currentItem);
Attachments
Radar WebKit Bug Importer
Comment 1 2024-11-12 10:47:14 PST
Chris Dumez
Comment 2 2024-12-05 11:35:09 PST
EWS
Comment 3 2024-12-09 08:22:40 PST
Committed 287548@main (e08f45aa8902): <https://commits.webkit.org/287548@main> Reviewed commits have been landed. Closing PR #37500 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.