Change logic for detecting whether two loads with the same URI (up to anchor)

are actually different to be smarter about dealing with postdata (both loads
may have postdata and may be the same or different depending on what that post
data is).  Bug 227554, r=adamlock, sr=darin
This commit is contained in:
bzbarsky@mit.edu
2004-01-08 04:23:22 +00:00
parent ad5f7693c0
commit b5d1d6fff8

View File

@@ -5106,11 +5106,24 @@ nsDocShell::InternalLoad(nsIURI * aURI,
//
// First:
// Check to see if the new URI is an anchor in the existing document.
// Skip this check if we're doing some sort of abnormal load, if
// the new load is a non-history load and has postdata, or if
// we're doing a history load and there are postdata differences
// between what we plan to load and what we have loaded currently.
//
PRBool samePostData = PR_TRUE;
if (!aSHEntry) {
samePostData = (aPostData == nsnull);
} else if (mOSHE) {
nsCOMPtr<nsIInputStream> currentPostData;
mOSHE->GetPostData(getter_AddRefs(currentPostData));
samePostData = (currentPostData == aPostData);
}
if ((aLoadType == LOAD_NORMAL ||
aLoadType == LOAD_NORMAL_REPLACE ||
aLoadType == LOAD_HISTORY ||
aLoadType == LOAD_LINK) && (aPostData == nsnull)) {
aLoadType == LOAD_LINK) && samePostData) {
PRBool wasAnchor = PR_FALSE;
nscoord cx, cy;
NS_ENSURE_SUCCESS(ScrollIfAnchor(aURI, &wasAnchor, aLoadType, &cx, &cy), NS_ERROR_FAILURE);