Bug 974857. Compare attempted anchor traversals to both the actual page URI and the exposable URI, and do an anchor scroll if either one matches. r=smaug

This commit is contained in:
Boris Zbarsky 2014-09-05 14:28:46 -04:00
parent 72d84e295c
commit 8746d3dc2b

View File

@ -9416,14 +9416,7 @@ nsDocShell::InternalLoad(nsIURI * aURI,
aLoadType == LOAD_HISTORY ||
aLoadType == LOAD_LINK) {
nsCOMPtr<nsIURI> currentURI;
if (sURIFixup && mCurrentURI) {
rv = sURIFixup->CreateExposableURI(mCurrentURI,
getter_AddRefs(currentURI));
NS_ENSURE_SUCCESS(rv, rv);
} else {
currentURI = mCurrentURI;
}
nsCOMPtr<nsIURI> currentURI = mCurrentURI;
// Split currentURI and aURI on the '#' character. Make sure we read
// the return values of SplitURIAtHash; if it fails, we don't want to
// allow a short-circuited navigation.
@ -9439,6 +9432,19 @@ nsDocShell::InternalLoad(nsIURI * aURI,
NS_SUCCEEDED(splitRv2) &&
curBeforeHash.Equals(newBeforeHash);
if (!sameExceptHashes && sURIFixup && currentURI &&
NS_SUCCEEDED(splitRv2)) {
// Maybe aURI came from the exposable form of currentURI?
nsCOMPtr<nsIURI> currentExposableURI;
rv = sURIFixup->CreateExposableURI(currentURI,
getter_AddRefs(currentExposableURI));
NS_ENSURE_SUCCESS(rv, rv);
splitRv1 = nsContentUtils::SplitURIAtHash(currentExposableURI,
curBeforeHash, curHash);
sameExceptHashes = NS_SUCCEEDED(splitRv1) &&
curBeforeHash.Equals(newBeforeHash);
}
bool historyNavBetweenSameDoc = false;
if (mOSHE && aSHEntry) {
// We're doing a history load.