From 5e77a7b9d3441ed6b4f64c4fd462cb30776aa338 Mon Sep 17 00:00:00 2001 From: "radha%netscape.com" Date: Sat, 22 Sep 2001 00:10:58 +0000 Subject: [PATCH] Fix for bug 92824. Update index in SH after onStartLoad() gets called for the page --- docshell/base/nsWebShell.cpp | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/docshell/base/nsWebShell.cpp b/docshell/base/nsWebShell.cpp index c92119b7748..49aad54c9f5 100644 --- a/docshell/base/nsWebShell.cpp +++ b/docshell/base/nsWebShell.cpp @@ -107,6 +107,7 @@ typedef unsigned long HMTX; #include "nsISelection.h" #include "nsISelectionController.h" #include "nsIFileStream.h" +#include "nsISHistoryInternal.h" #include "nsIHttpChannel.h" // add this to the ick include list...we need it to QI for post data interface #include "nsIUploadChannel.h" @@ -1130,7 +1131,33 @@ nsresult nsWebShell::EndPageLoad(nsIWebProgress *aProgress, * the post data. */ if (!repost) - return NS_OK; + return NS_OK; + + // The user wants to repost the data to the server. + // If the page was loaded due to a back/forward/go + // operation, update the session history index. + // This is similar to the updating done in + // nsDocShell::OnNewURI() for regular pages + nsCOMPtr rootSH=mSessionHistory; + 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 + rootAsWebnav->GetSessionHistory(getter_AddRefs(rootSH)); + } + } + } // mSessionHistory + + if (rootSH && (mLoadType & LOAD_CMD_HISTORY)) { + nsCOMPtr shInternal(do_QueryInterface(rootSH)); + if (shInternal) + shInternal->UpdateIndex(); + } /* The user does want to repost the data to the server. * Initiate a new load again. */