diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index fed0345c7c6..41fcc8b28c6 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -9416,14 +9416,7 @@ nsDocShell::InternalLoad(nsIURI * aURI, aLoadType == LOAD_HISTORY || aLoadType == LOAD_LINK) { - nsCOMPtr currentURI; - if (sURIFixup && mCurrentURI) { - rv = sURIFixup->CreateExposableURI(mCurrentURI, - getter_AddRefs(currentURI)); - NS_ENSURE_SUCCESS(rv, rv); - } else { - currentURI = mCurrentURI; - } + nsCOMPtr 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 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.