Fix longstanding issue where anchor scrolls on a POST result page could lead to a silent re-POST during history traversal. Bug 413310, r+sr=biesi, a=dsicore,beltzner,righteousness.

This commit is contained in:
2008-02-28 20:21:39 -08:00
parent 5eab40cc1c
commit 9f445d622f
5 changed files with 122 additions and 0 deletions

View File

@@ -6880,6 +6880,7 @@ nsDocShell::InternalLoad(nsIURI * aURI,
OnNewURI(aURI, nsnull, mLoadType, PR_TRUE);
nsCOMPtr<nsIInputStream> postData;
PRUint32 pageIdent = PR_UINT32_MAX;
nsCOMPtr<nsISupports> cacheKey;
if (mOSHE) {
/* save current position of scroller(s) (bug 59774) */
@@ -6893,6 +6894,7 @@ nsDocShell::InternalLoad(nsIURI * aURI,
if (aLoadType & LOAD_CMD_NORMAL) {
mOSHE->GetPostData(getter_AddRefs(postData));
mOSHE->GetPageIdentifier(&pageIdent);
mOSHE->GetCacheKey(getter_AddRefs(cacheKey));
}
}
@@ -6907,6 +6909,11 @@ nsDocShell::InternalLoad(nsIURI * aURI,
// page will restore the appropriate postData.
if (postData)
mOSHE->SetPostData(postData);
// Make sure we won't just repost without hitting the
// cache first
if (cacheKey)
mOSHE->SetCacheKey(cacheKey);
// Propagate our page ident to the new mOSHE so that
// we'll know it just differed by a scroll on the page.