Bug 597315 Part 1 (session history) - Frameset history does not work properly when restoring a tab [r=bz, a=blocking2.0:betaN+]

This commit is contained in:
Olli Pettay 2010-12-27 16:22:46 -05:00
parent 853fd4d981
commit 09dae4cf08
3 changed files with 28 additions and 1 deletions

View File

@ -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();
};

View File

@ -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<nsISHistoryListener> listener(do_QueryReferent(mListener));
if (listener) {
nsCOMPtr<nsIURI> 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)
{

View File

@ -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();