Bug 1322896, synchronize SHistory entry with mLSHE, r=bz

This commit is contained in:
Olli Pettay
2017-03-25 03:33:43 +02:00
parent 741ba6de67
commit 10e9618106

View File

@@ -11847,6 +11847,21 @@ nsDocShell::OnNewURI(nsIURI* aURI, nsIChannel* aChannel,
aPrincipalToInherit, 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