Going from foo#bar to foo shouldn't do an anchor scroll. Bug 273158, r=biesi,
sr=darin git-svn-id: svn://10.0.0.236/trunk@166434 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -5819,22 +5819,17 @@ nsDocShell::ScrollIfAnchor(nsIURI * aURI, PRBool * aWasAnchor,
|
||||
newSpec.EndReading(refEnd);
|
||||
|
||||
PRInt32 hashNew = newSpec.FindChar(kHash);
|
||||
if (hashNew == 0) {
|
||||
return NS_OK; // Strange URI
|
||||
if (hashNew <= 0) {
|
||||
return NS_OK; // Strange URI or no new anchor
|
||||
}
|
||||
else if (hashNew > 0) {
|
||||
// found it
|
||||
urlEnd = urlStart;
|
||||
urlEnd.advance(hashNew);
|
||||
|
||||
// found it
|
||||
urlEnd = urlStart;
|
||||
urlEnd.advance(hashNew);
|
||||
|
||||
refStart = urlEnd;
|
||||
++refStart; // advanced past '#'
|
||||
refStart = urlEnd;
|
||||
++refStart; // advanced past '#'
|
||||
|
||||
}
|
||||
else {
|
||||
// no hash at all
|
||||
urlEnd = refStart = refEnd;
|
||||
}
|
||||
const nsACString& sNewLeft = Substring(urlStart, urlEnd);
|
||||
const nsACString& sNewRef = Substring(refStart, refEnd);
|
||||
|
||||
@@ -5846,7 +5841,8 @@ nsDocShell::ScrollIfAnchor(nsIURI * aURI, PRBool * aWasAnchor,
|
||||
if (hashCurrent == 0) {
|
||||
return NS_OK; // Strange URI
|
||||
}
|
||||
else if (hashCurrent > 0) {
|
||||
|
||||
if (hashCurrent > 0) {
|
||||
currentLeftEnd = currentLeftStart;
|
||||
currentLeftEnd.advance(hashCurrent);
|
||||
}
|
||||
@@ -5854,11 +5850,6 @@ nsDocShell::ScrollIfAnchor(nsIURI * aURI, PRBool * aWasAnchor,
|
||||
currentSpec.EndReading(currentLeftEnd);
|
||||
}
|
||||
|
||||
// Exit when there are no anchors
|
||||
if (hashNew <= 0 && hashCurrent <= 0) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Compare the URIs.
|
||||
//
|
||||
// NOTE: this is a case sensitive comparison because some parts of the
|
||||
|
||||
Reference in New Issue
Block a user