From c17562f4c2d0df14a952db13744da5cf72a06b52 Mon Sep 17 00:00:00 2001 From: "radha%netscape.com" Date: Thu, 18 Aug 2005 11:15:37 +0000 Subject: [PATCH] More checkins for feature bug 36547. CODE NOT PART OF THE BUILD. reviewer will be provided when feature is enabled. git-svn-id: svn://10.0.0.236/trunk@178059 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/shistory/src/nsSHistory.cpp | 41 +++++++++++++------- mozilla/docshell/shistory/src/nsSHistory.h | 2 +- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/mozilla/docshell/shistory/src/nsSHistory.cpp b/mozilla/docshell/shistory/src/nsSHistory.cpp index 563c9ba0d3e..f11323ecd28 100644 --- a/mozilla/docshell/shistory/src/nsSHistory.cpp +++ b/mozilla/docshell/shistory/src/nsSHistory.cpp @@ -34,6 +34,7 @@ #include "nsISHContainer.h" #include "nsIDocShellTreeItem.h" #include "nsIDocShellTreeNode.h" +#include "nsIDocShellLoadInfo.h" //***************************************************************************** //*** nsSHistory: Object Management @@ -329,6 +330,7 @@ nsSHistory::GetCanGoForward(PRBool * aCanGoForward) return NS_OK; } + NS_IMETHODIMP nsSHistory::GoBack() { @@ -354,10 +356,10 @@ nsSHistory::GoForward() } NS_IMETHODIMP -nsSHistory::Reload(PRInt32 reloadType) +nsSHistory::Reload(PRInt32 aReloadType) { - // NOT implemented - return NS_OK; + + return LoadEntry(mIndex, PR_TRUE, aReloadType); } @@ -438,6 +440,13 @@ nsSHistory::GetSHEForChild(PRInt32 aChildOffset, nsISHEntry ** aResult) NS_IMETHODIMP nsSHistory::GotoIndex(PRInt32 aIndex) +{ + + return LoadEntry(aIndex, PR_FALSE, nsIDocShellLoadInfo::loadHistory); +} + +NS_IMETHODIMP +nsSHistory::LoadEntry(PRInt32 aIndex, PRBool aReloadFlag, long aLoadType) { nsCOMPtr docShell; nsCOMPtr shEntry; @@ -450,22 +459,26 @@ nsSHistory::GotoIndex(PRInt32 aIndex) nsCOMPtr nextEntry; GetEntryAtIndex(mIndex, PR_FALSE, getter_AddRefs(nextEntry)); - PRBool result = CompareSHEntry(prevEntry, nextEntry, mRootDocShell, getter_AddRefs(docShell), getter_AddRefs(shEntry)); - - if (!result) - mIndex = oldIndex; - - if (!docShell || !shEntry || !mRootDocShell) - return NS_ERROR_FAILURE; - nsCOMPtr nexturi; nsCOMPtr loadInfo; + if (oldIndex != aIndex) { + PRBool result = CompareSHEntry(prevEntry, nextEntry, mRootDocShell, getter_AddRefs(docShell), getter_AddRefs(shEntry)); + if (!result) + mIndex = oldIndex; + + if (!docShell || !shEntry || !mRootDocShell) + return NS_ERROR_FAILURE; + + + shEntry->GetURI(getter_AddRefs(nexturi)); + } + else + nextEntry->GetURI(getter_AddRefs(nexturi)); - shEntry->GetURI(getter_AddRefs(nexturi)); mRootDocShell->CreateLoadInfo (getter_AddRefs(loadInfo)); // This is not available yet - // loadInfo->SetSessionHistoryEntry(nextEntry); - + loadInfo->SetLoadType(aLoadType); + loadInfo->SetSHEntry(nextEntry); // Time to initiate a document load return docShell->LoadURI(nexturi, loadInfo); diff --git a/mozilla/docshell/shistory/src/nsSHistory.h b/mozilla/docshell/shistory/src/nsSHistory.h index ce3737b16e7..8d285a9b6db 100644 --- a/mozilla/docshell/shistory/src/nsSHistory.h +++ b/mozilla/docshell/shistory/src/nsSHistory.h @@ -47,11 +47,11 @@ protected: virtual ~nsSHistory(); // Could become part of nsIWebNavigation - NS_IMETHOD GotoIndex(PRInt32 aIndex); NS_IMETHOD PrintHistory(); NS_IMETHOD GetTransactionAtIndex(PRInt32 aIndex, nsISHTransaction ** aResult); PRBool CompareSHEntry(nsISHEntry * prevEntry, nsISHEntry * nextEntry, nsIDocShell * rootDocShell, nsIDocShell ** aResultDocShell, nsISHEntry ** aResultSHEntry); + NS_IMETHOD LoadEntry(PRInt32 aIndex, PRBool aReloadFlag, long aLoadType); protected: nsCOMPtr mListRoot;