Bug 282622
| Summary: | [Navigation] Cross document push navigations don't prune correctly | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Patrick Griffis <pgriffis> |
| Component: | WebCore Misc. | Assignee: | Chris Dumez <cdumez> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Bug Depends on: | |||
| Bug Blocks: | 258384 | ||
Patrick Griffis
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 | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/139734080>
Chris Dumez
Pull request: https://github.com/WebKit/WebKit/pull/37500
EWS
Committed 287548@main (e08f45aa8902): <https://commits.webkit.org/287548@main>
Reviewed commits have been landed. Closing PR #37500 and removing active labels.