Put conditional test around anchor scrolling so reload operations really do reload on anchor URLs

b=30558,r=,approved valeski
This commit is contained in:
locka%iol.ie 2000-06-05 22:13:52 +00:00
parent a4ade66319
commit 2af7bba123

View File

@ -2360,13 +2360,20 @@ NS_IMETHODIMP nsDocShell::SetupNewViewer(nsIContentViewer* aNewViewer)
NS_IMETHODIMP nsDocShell::InternalLoad(nsIURI* aURI, nsIURI* aReferrer, NS_IMETHODIMP nsDocShell::InternalLoad(nsIURI* aURI, nsIURI* aReferrer,
const char* aWindowTarget, nsIInputStream* aPostData, loadType aLoadType) const char* aWindowTarget, nsIInputStream* aPostData, loadType aLoadType)
{ {
PRBool wasAnchor = PR_FALSE; // Check to see if the new URI is an anchor in the existing document.
NS_ENSURE_SUCCESS(ScrollIfAnchor(aURI, &wasAnchor), NS_ERROR_FAILURE); if (aLoadType == loadNormal ||
if(wasAnchor) aLoadType == loadNormalReplace ||
aLoadType == loadHistory ||
aLoadType == loadLink)
{ {
mLoadType = aLoadType; PRBool wasAnchor = PR_FALSE;
OnNewURI(aURI, nsnull, mLoadType); NS_ENSURE_SUCCESS(ScrollIfAnchor(aURI, &wasAnchor), NS_ERROR_FAILURE);
return NS_OK; if(wasAnchor)
{
mLoadType = aLoadType;
OnNewURI(aURI, nsnull, mLoadType);
return NS_OK;
}
} }
NS_ENSURE_SUCCESS(StopCurrentLoads(), NS_ERROR_FAILURE); NS_ENSURE_SUCCESS(StopCurrentLoads(), NS_ERROR_FAILURE);
@ -2789,11 +2796,12 @@ NS_IMETHODIMP nsDocShell::ScrollIfAnchor(nsIURI* aURI, PRBool* aWasAnchor)
// Compare the URIs. // Compare the URIs.
// //
// NOTE: this is case sensitive so it won't pick up www.ABC.com and // NOTE: this is a case sensitive comparison because some parts of the
// www.abc.com being the same. It's not possible to do a case-insensitive // URI are case sensitive, and some are not. i.e. the domain name
// comparison because some parts of the URI are case sensitive, and some // is case insensitive but the the paths are not.
// are not. e.g. the paths "/Something" and "/something" are two //
// different places on Unix. // This means that comparing "http://www.ABC.com/" to "http://www.abc.com/"
// will fail this test.
if (sCurrentLeft.CompareWithConversion(sNewLeft, PR_FALSE, -1) != 0) if (sCurrentLeft.CompareWithConversion(sNewLeft, PR_FALSE, -1) != 0)
{ {