From b9befe5a2de16a3b44e8a1f2a3bd48eece471ef7 Mon Sep 17 00:00:00 2001 From: "radha%netscape.com" Date: Fri, 19 Oct 2001 21:28:57 +0000 Subject: [PATCH] Fix for bug #101682. history.back() history.go(-1) misbehave on repeated usage and does notrestore scrollbar position. r=mcafee, sr=alecf git-svn-id: svn://10.0.0.236/trunk@105822 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsDocShell.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index 05e5873b44d..a48f7b27202 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -4358,8 +4358,7 @@ nsDocShell::InternalLoad(nsIURI * aURI, } mURIResultedInDocument = PR_FALSE; // reset the clock... - mLSHE = aSHEntry; - + // // First: // Check to see if the new URI is an anchor in the existing document. @@ -4373,10 +4372,20 @@ nsDocShell::InternalLoad(nsIURI * aURI, if (wasAnchor) { mLoadType = aLoadType; mURIResultedInDocument = PR_TRUE; + /* This is a anchor traversal with in the same page. + * call OnNewURI() so that, this traversal will be + * recorded in session and global history. + */ OnNewURI(aURI, nsnull, mLoadType); - - // Save the new entry in mOSHE - if (mLSHE) + + /* If this is a history load, OnNewURI() will not create + * a mLSHE. In that case, we want to assign mOSHE to aSHEntry + * passed by SH, otherwise, mLSHE created by OnNewURI() should + * be assigned to mOSHE. + */ + if (aSHEntry && !mLSHE) + mOSHE = aSHEntry; + else if (mLSHE) mOSHE = mLSHE; /* Clear out mLSHE so that further anchor visits get @@ -4410,7 +4419,9 @@ nsDocShell::InternalLoad(nsIURI * aURI, mLoadType = aLoadType; - + // mLSHE should be assigned to aSHEntry, only after Stop() has + // been called. + mLSHE = aSHEntry; nsDocShellInfoLoadType loadCmd = ConvertLoadTypeToDocShellLoadInfo(mLoadType);