From 7124231a9c8baa8f63225df239093cc0a442f57b Mon Sep 17 00:00:00 2001 From: "mscott%netscape.com" Date: Fri, 13 Jul 2001 04:53:58 +0000 Subject: [PATCH] Bug #89628 --> don't create a session history entry if there is no session history for this docshell chain. Fixes the problem where the mailnews message pane was suddenly getting the scroll bar state remembered across messages. (checking in for radha) r=valeski sr=mscott git-svn-id: svn://10.0.0.236/trunk@99159 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsDocShell.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index 3325f6b17ea..696bf9fa4da 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -4958,6 +4958,7 @@ nsDocShell::OnNewURI(nsIURI * aURI, nsIChannel * aChannel, UpdateCurrentGlobalHistory(); PRBool updateHistory = PR_TRUE; PRBool equalUri = PR_FALSE; + PRBool shAvailable = PR_TRUE; // Get the post data from the channel nsCOMPtr inputStream; @@ -4968,6 +4969,26 @@ nsDocShell::OnNewURI(nsIURI * aURI, nsIChannel * aChannel, httpChannel->GetUploadStream(getter_AddRefs(inputStream)); } } + /* Create SH Entry (mLSHE) only if there is a SessionHistory object (mSessionHistory) in + * the current frame or in the root docshell + */ + + if (!mSessionHistory) { + nsCOMPtr root; + //Get the root docshell + GetSameTypeRootTreeItem(getter_AddRefs(root)); + if (root) { + // QI root to nsIWebNavigation + nsCOMPtr rootAsWebnav(do_QueryInterface(root)); + if (rootAsWebnav) { + // Get the handle to SH from the root docshell + nsCOMPtr rootSH; + rootAsWebnav->GetSessionHistory(getter_AddRefs(rootSH)); + if (!rootSH) + shAvailable = PR_FALSE; + } + } + } // mSessionHistory // Determine if this type of load should update history if (aLoadType & LOAD_FLAGS_BYPASS_HISTORY || aLoadType & LOAD_CMD_RELOAD || aLoadType & LOAD_CMD_HISTORY || @@ -4976,8 +4997,8 @@ nsDocShell::OnNewURI(nsIURI * aURI, nsIChannel * aChannel, updateHistory = PR_FALSE; } - if (updateHistory) { // Page load not from SH - // Update session history if necessary... + if (updateHistory && shAvailable) { + // Update session history if necessary... if (!mLSHE && (mItemType == typeContent) && mURIResultedInDocument) { /* This is a fresh page getting loaded for the first time *.Create a Entry for it and add it to SH, if this is the