Bug 1750973, don't replace the nsILayoutHistoryState object when doing same document history navigations, r=peterv

Differential Revision: https://phabricator.services.mozilla.com/D137703
This commit is contained in:
Olli Pettay
2022-02-04 11:37:14 +00:00
parent 0268d8b9a3
commit f5ed5abaee
4 changed files with 80 additions and 0 deletions

View File

@@ -9005,7 +9005,20 @@ nsresult nsDocShell::HandleSameDocumentNavigation(
"%s",
this, mLoadingEntry->mInfo.GetURI()->GetSpecOrDefault().get()));
bool hadActiveEntry = !!mActiveEntry;
nsCOMPtr<nsILayoutHistoryState> currentLayoutHistoryState;
if (mActiveEntry) {
currentLayoutHistoryState = mActiveEntry->GetLayoutHistoryState();
}
mActiveEntry = MakeUnique<SessionHistoryInfo>(mLoadingEntry->mInfo);
if (currentLayoutHistoryState) {
// Restore the existing nsILayoutHistoryState object, since it is
// possibly being used by the layout. When doing a new load, the
// shared state is copied from the existing active entry, so this
// special case is needed only with the history loads.
mActiveEntry->SetLayoutHistoryState(currentLayoutHistoryState);
}
if (cacheKey != 0) {
mActiveEntry->SetCacheKey(cacheKey);
}