commit 9e0d29780ade44bb0bd1d60d9fd2edad9ae15e50
parent de898334fb149c80173e50d37615c532d84decf6
Author: Andreas Farre <farre@mozilla.com>
Date: Fri, 31 Oct 2025 09:17:10 +0000
Bug 1996573 - Part 4: Reconstruct the active entry list for iframes. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D270688
Diffstat:
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/docshell/base/CanonicalBrowsingContext.cpp b/docshell/base/CanonicalBrowsingContext.cpp
@@ -1279,7 +1279,9 @@ void CanonicalBrowsingContext::SessionHistoryCommit(
"NotTop: Loading from session history");
mActiveEntry = newActiveEntry;
if (Navigation::IsAPIEnabled() && !mActiveEntry->isInList()) {
- mActiveEntryList.insertBack(mActiveEntry);
+ mActiveEntryList.clear();
+ mActiveEntryList =
+ shistory->ConstructContiguousEntryListFrom(mActiveEntry);
}
shistory->InternalSetRequestedIndex(indexOfHistoryLoad);
diff --git a/docshell/shistory/nsSHistory.cpp b/docshell/shistory/nsSHistory.cpp
@@ -2502,14 +2502,24 @@ mozilla::dom::SessionHistoryEntry* nsSHistory::FindAdjacentContiguousEntryFor(
LinkedList<SessionHistoryEntry> nsSHistory::ConstructContiguousEntryListFrom(
SessionHistoryEntry* aEntry) {
+ if (aEntry->isInList()) {
+ aEntry->remove();
+ }
+
LinkedList<SessionHistoryEntry> entryList;
entryList.insertBack(aEntry);
for (auto* entry = aEntry;
(entry = FindAdjacentContiguousEntryFor(entry, -1));) {
+ if (entry->isInList()) {
+ entry->remove();
+ }
entryList.insertFront(entry);
}
for (auto* entry = aEntry;
(entry = FindAdjacentContiguousEntryFor(entry, 1));) {
+ if (entry->isInList()) {
+ entry->remove();
+ }
entryList.insertBack(entry);
}
return entryList;