From 26ea934e3206cd11916384286389f6ff06d21b15 Mon Sep 17 00:00:00 2001 From: "radha%netscape.com" Date: Mon, 6 May 2002 21:01:59 +0000 Subject: [PATCH] Fix for bug # 125372. Forward arrow not active when it should be. r=adamlock sr=alecf. git-svn-id: svn://10.0.0.236/trunk@120866 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsDocShell.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index e602a8511ea..17b87baab85 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -4648,6 +4648,14 @@ nsDocShell::InternalLoad(nsIURI * aURI, if (wasAnchor) { mLoadType = aLoadType; mURIResultedInDocument = PR_TRUE; + + /* we need to assign mLSHE to aSHEntry right here, so that on History loads, + * SetCurrentURI() called from OnNewURI() will send proper + * onLocationChange() notifications to the browser to update + * back/forward buttons. + */ + mLSHE = aSHEntry; + /* This is a anchor traversal with in the same page. * call OnNewURI() so that, this traversal will be * recorded in session and global history. @@ -4658,14 +4666,10 @@ nsDocShell::InternalLoad(nsIURI * aURI, if (mOSHE) mOSHE->SetScrollPosition(cx, cy); - /* 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. + /* Assign mOSHE to mLSHE. This will either be a new entry created + * by OnNewURI() for normal loads or aSHEntry for history loads. */ - if (aSHEntry && !mLSHE) - mOSHE = aSHEntry; - else if (mLSHE) + if (mLSHE) mOSHE = mLSHE; /* restore previous position of scroller(s), if we're moving @@ -5626,7 +5630,7 @@ nsDocShell::AddToSessionHistory(nsIURI * aURI, } if (cacheToken) { // Check if the page has expired from cache - nsCOMPtr cacheEntryInfo(do_QueryInterface(cacheToken)); + nsCOMPtr cacheEntryInfo(do_QueryInterface(cacheToken)); if (cacheEntryInfo) { PRUint32 expTime; cacheEntryInfo->GetExpirationTime(&expTime);