From 846d176b60d827811abd2e51045a6b134201925e Mon Sep 17 00:00:00 2001 From: Olli Pettay Date: Mon, 27 Dec 2010 16:22:46 -0500 Subject: [PATCH] Bug 597315 Part 1 (session history) - Frameset history does not work properly when restoring a tab [r=bz, a=blocking2.0:betaN+] --- docshell/shistory/public/nsISHistory.idl | 6 ++++++ docshell/shistory/src/nsSHistory.cpp | 20 ++++++++++++++++++++ docshell/shistory/src/nsSHistory.h | 3 ++- 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/docshell/shistory/public/nsISHistory.idl b/docshell/shistory/public/nsISHistory.idl index cfa8084e9ab..c93aeaf4011 100644 --- a/docshell/shistory/public/nsISHistory.idl +++ b/docshell/shistory/public/nsISHistory.idl @@ -178,3 +178,9 @@ interface nsISHistory: nsISupports */ readonly attribute nsISimpleEnumerator SHistoryEnumerator; }; + +[scriptable, uuid(ac8b3eb3-2051-4cce-8303-d6e7938501dd)] +interface nsISHistory_2_0_BRANCH: nsISHistory +{ + void reloadCurrentEntry(); +}; diff --git a/docshell/shistory/src/nsSHistory.cpp b/docshell/shistory/src/nsSHistory.cpp index 95f94a55184..2556141700b 100644 --- a/docshell/shistory/src/nsSHistory.cpp +++ b/docshell/shistory/src/nsSHistory.cpp @@ -153,6 +153,7 @@ NS_INTERFACE_MAP_BEGIN(nsSHistory) NS_INTERFACE_MAP_ENTRY(nsISHistory) NS_INTERFACE_MAP_ENTRY(nsIWebNavigation) NS_INTERFACE_MAP_ENTRY(nsISHistoryInternal) + NS_INTERFACE_MAP_ENTRY(nsISHistory_2_0_BRANCH) NS_INTERFACE_MAP_END //***************************************************************************** @@ -796,6 +797,25 @@ nsSHistory::Reload(PRUint32 aReloadFlags) return LoadEntry(mIndex, loadType, HIST_CMD_RELOAD); } +NS_IMETHODIMP +nsSHistory::ReloadCurrentEntry() +{ + // Notify listeners + PRBool canNavigate = PR_TRUE; + if (mListener) { + nsCOMPtr listener(do_QueryReferent(mListener)); + if (listener) { + nsCOMPtr currentURI; + GetCurrentURI(getter_AddRefs(currentURI)); + listener->OnHistoryGotoIndex(mIndex, currentURI, &canNavigate); + } + } + if (!canNavigate) + return NS_OK; + + return LoadEntry(mIndex, nsIDocShellLoadInfo::loadHistory, HIST_CMD_RELOAD); +} + void nsSHistory::EvictWindowContentViewers(PRInt32 aFromIndex, PRInt32 aToIndex) { diff --git a/docshell/shistory/src/nsSHistory.h b/docshell/shistory/src/nsSHistory.h index 94a9650ef73..f6b696a474c 100644 --- a/docshell/shistory/src/nsSHistory.h +++ b/docshell/shistory/src/nsSHistory.h @@ -62,7 +62,7 @@ class nsIDocShell; class nsSHEnumerator; class nsSHistoryObserver; class nsSHistory: public PRCList, - public nsISHistory, + public nsISHistory_2_0_BRANCH, public nsISHistoryInternal, public nsIWebNavigation { @@ -73,6 +73,7 @@ public: NS_DECL_NSISHISTORY NS_DECL_NSISHISTORYINTERNAL NS_DECL_NSIWEBNAVIGATION + NS_DECL_NSISHISTORY_2_0_BRANCH // One time initialization method called upon docshell module construction static nsresult Startup();