Synchronize SHistory entry with mLSHE.

This commit is contained in:
Pale Moon
2017-08-12 13:45:53 +02:00
committed by Roy Tam
parent 43d943dd3e
commit 90e4f7f831
+15
View File
@@ -11425,6 +11425,21 @@ nsDocShell::OnNewURI(nsIURI* aURI, nsIChannel* aChannel, nsISupports* aOwner,
(void)AddToSessionHistory(aURI, aChannel, aOwner, aCloneSHChildren,
getter_AddRefs(mLSHE));
}
} else if (mSessionHistory && mLSHE && mURIResultedInDocument) {
// Even if we don't add anything to SHistory, ensure the current index
// points to the same SHEntry as our mLSHE.
int32_t index = 0;
mSessionHistory->GetRequestedIndex(&index);
if (index == -1) {
mSessionHistory->GetIndex(&index);
}
nsCOMPtr<nsISHEntry> currentSH;
mSessionHistory->GetEntryAtIndex(index, false, getter_AddRefs(currentSH));
if (currentSH != mLSHE) {
nsCOMPtr<nsISHistoryInternal> shPrivate =
do_QueryInterface(mSessionHistory);
shPrivate->ReplaceEntry(index, mLSHE);
}
}
// If this is a POST request, we do not want to include this in global