зеркало из https://github.com/mozilla/pjs.git
More checkins for feature bug 36547. CODE NOT PART OF THE BUILD. reviewer will be provided
when feature is enabled.
This commit is contained in:
Родитель
8aa2633473
Коммит
e1fc2c5789
|
@ -225,12 +225,16 @@ NS_IMETHODIMP nsDocShell::LoadURI(nsIURI* aURI, nsIDocShellLoadInfo* aLoadInfo)
|
|||
aLoadInfo->GetReferrer(getter_AddRefs(referrer));
|
||||
aLoadInfo->GetLoadType(&loadType);
|
||||
aLoadInfo->GetOwner(getter_AddRefs(owner));
|
||||
}
|
||||
#ifdef SH_IN_FRAMES
|
||||
aLoadInfo->GetSHEntry(getter_AddRefs(loadInfoSHEntry));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifdef SH_IN_FRAMES
|
||||
if (loadInfoSHEntry)
|
||||
NS_ENSURE_SUCCESS(LoadHistoryEntry(loadInfoSHEntry, loadType), NS_ERROR_FAILURE);
|
||||
else
|
||||
NS_ENSURE_SUCCESS(InternalLoad(aURI, referrer, owner, nsnull, nsnull, loadType, loadInfoSHEntry), NS_ERROR_FAILURE);
|
||||
#else
|
||||
NS_ENSURE_SUCCESS(InternalLoad(aURI, referrer, owner, nsnull, nsnull, loadType), NS_ERROR_FAILURE);
|
||||
|
@ -726,6 +730,19 @@ NS_IMETHODIMP nsDocShell::SetTreeOwner(nsIDocShellTreeOwner* aTreeOwner)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShell::SetChildOffset(PRInt32 aChildOffset)
|
||||
{
|
||||
mChildOffset = aChildOffset;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShell::GetChildOffset(PRInt32 *aChildOffset)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aChildOffset);
|
||||
*aChildOffset = mChildOffset;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsDocShell::nsIDocShellTreeNode
|
||||
//*****************************************************************************
|
||||
|
@ -737,6 +754,8 @@ NS_IMETHODIMP nsDocShell::GetChildCount(PRInt32 *aChildCount)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP nsDocShell::AddChild(nsIDocShellTreeItem *aChild)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aChild);
|
||||
|
@ -745,12 +764,18 @@ NS_IMETHODIMP nsDocShell::AddChild(nsIDocShellTreeItem *aChild)
|
|||
mChildren.AppendElement(aChild);
|
||||
NS_ADDREF(aChild);
|
||||
|
||||
// Set the child's index in the parent's children list
|
||||
// XXX What if the parent had different types of children?
|
||||
// XXX in that case docshell hierarchyand SH hierarchy won't match.
|
||||
aChild->SetChildOffset((mChildren.Count())-1);
|
||||
|
||||
PRInt32 childType = ~mItemType; // Set it to not us in case the get fails
|
||||
aChild->GetItemType(&childType);
|
||||
if(childType != mItemType)
|
||||
return NS_OK;
|
||||
// Everything below here is only done when the child is the same type.
|
||||
|
||||
|
||||
aChild->SetTreeOwner(mTreeOwner);
|
||||
|
||||
nsCOMPtr<nsIDocShell> childAsDocShell(do_QueryInterface(aChild));
|
||||
|
@ -871,6 +896,7 @@ NS_IMETHODIMP nsDocShell::FindChildWithName(const PRUnichar *aName,
|
|||
|
||||
NS_IMETHODIMP nsDocShell::GetCanGoBack(PRBool* aCanGoBack)
|
||||
{
|
||||
#ifndef SH_IN_FRAMES
|
||||
NS_ENSURE_ARG_POINTER(aCanGoBack);
|
||||
*aCanGoBack = PR_FALSE;
|
||||
if (mSessionHistory == nsnull) {
|
||||
|
@ -883,12 +909,13 @@ NS_IMETHODIMP nsDocShell::GetCanGoBack(PRBool* aCanGoBack)
|
|||
NS_ENSURE_SUCCESS(mSessionHistory->GetIndex(&index), NS_ERROR_FAILURE);
|
||||
if(index > 0)
|
||||
*aCanGoBack = PR_TRUE;
|
||||
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShell::GetCanGoForward(PRBool* aCanGoForward)
|
||||
{
|
||||
#ifndef SH_IN_FRAMES
|
||||
NS_ENSURE_ARG_POINTER(aCanGoForward);
|
||||
*aCanGoForward = PR_FALSE;
|
||||
if (mSessionHistory == nsnull) {
|
||||
|
@ -905,12 +932,13 @@ NS_IMETHODIMP nsDocShell::GetCanGoForward(PRBool* aCanGoForward)
|
|||
|
||||
if((index >= 0) && (index < (count - 1)))
|
||||
*aCanGoForward = PR_TRUE;
|
||||
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShell::GoBack()
|
||||
{
|
||||
#ifndef SH_IN_FRAMES
|
||||
if (mSessionHistory == nsnull) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -935,12 +963,13 @@ NS_IMETHODIMP nsDocShell::GoBack()
|
|||
|
||||
|
||||
NS_ENSURE_SUCCESS(LoadHistoryEntry(previousEntry), NS_ERROR_FAILURE);
|
||||
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShell::GoForward()
|
||||
{
|
||||
#ifndef SH_IN_FRAMES
|
||||
if (mSessionHistory == nsnull) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -964,10 +993,17 @@ NS_IMETHODIMP nsDocShell::GoForward()
|
|||
|
||||
|
||||
NS_ENSURE_SUCCESS(LoadHistoryEntry(nextEntry), NS_ERROR_FAILURE);
|
||||
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GotoIndex(PRInt32 aIndex)
|
||||
{
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShell::LoadURI(const PRUnichar* aURI)
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
|
@ -1993,11 +2029,11 @@ NS_IMETHODIMP nsDocShell::Embed(nsIContentViewer* aContentViewer,
|
|||
// Determine if this type of load should update history
|
||||
switch(mLoadType)
|
||||
{
|
||||
case loadHistory:
|
||||
case loadReloadNormal:
|
||||
case loadReloadBypassCache:
|
||||
case loadReloadBypassProxy:
|
||||
case loadReloadBypassProxyAndCache:
|
||||
case nsIDocShellLoadInfo::loadHistory:
|
||||
case nsIDocShellLoadInfo::loadReloadNormal:
|
||||
case nsIDocShellLoadInfo::loadReloadBypassCache:
|
||||
case nsIDocShellLoadInfo::loadReloadBypassProxy:
|
||||
case nsIDocShellLoadInfo::loadReloadBypassProxyAndCache:
|
||||
updateHistory = PR_FALSE;
|
||||
break;
|
||||
default:
|
||||
|
@ -2862,8 +2898,10 @@ nsDocShell::OnNewURI(nsIURI *aURI, nsIChannel *aChannel, nsDocShellInfoLoadType
|
|||
NS_ERROR("Need to update case");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
#ifdef SH_IN_FRAMES
|
||||
if (!LSHE && updateHistory) { // Page load not from SH
|
||||
if (!LSHE && updateHistory && (mItemType == typeContent)) { // Page load not from SH
|
||||
/* If no LSHE by this time, then this page load was not initiated
|
||||
* from SH. Now check, if you
|
||||
* can get your SHEntry from your parent's LSHE. This will help
|
||||
|
@ -2872,14 +2910,16 @@ nsDocShell::OnNewURI(nsIURI *aURI, nsIChannel *aChannel, nsDocShellInfoLoadType
|
|||
* on back/forward and went to a frameset page. and currently,
|
||||
* a subframe in that page is being loaded.
|
||||
*/
|
||||
nsCOMPtr<nsIDocShellTreeItem> parentAsItem;
|
||||
GetSameTypeParent(getter_AddRefs(parentAsItem));
|
||||
nsCOMPtr<nsISHEntry> she;
|
||||
nsCOMPtr<nsIWebNavigation> parent;
|
||||
// Get your SHEntry from your parent
|
||||
if (mParent) {
|
||||
parent = do_QueryInterface(mParent);
|
||||
if (parentAsItem) {
|
||||
parent = do_QueryInterface(parentAsItem);
|
||||
if (!parent)
|
||||
return NS_ERROR_FAILURE;
|
||||
parent->GetSHEForChild(mOffset, getter_AddRefs(she));
|
||||
parent->GetSHEForChild(mChildOffset, getter_AddRefs(she));
|
||||
}
|
||||
|
||||
if (!she) { // Parent didn't have any SHEntry for you
|
||||
|
@ -2892,7 +2932,7 @@ nsDocShell::OnNewURI(nsIURI *aURI, nsIChannel *aChannel, nsDocShellInfoLoadType
|
|||
ShouldPersistInSessionHistory(aURI, &shouldPersist);
|
||||
|
||||
nsCOMPtr<nsISHEntry> entry;
|
||||
if(loadNormalReplace == mLoadType)
|
||||
if(nsIDocShellLoadInfo::loadNormalReplace == mLoadType)
|
||||
{
|
||||
PRInt32 index = 0;
|
||||
mSessionHistory->GetIndex(&index);
|
||||
|
@ -2924,10 +2964,11 @@ nsDocShell::OnNewURI(nsIURI *aURI, nsIChannel *aChannel, nsDocShellInfoLoadType
|
|||
NS_ERROR_FAILURE);
|
||||
}
|
||||
else {
|
||||
NS_ENSURE_TRUE(parent, NS_ERROR_FAILURE);
|
||||
// OSHE could be null here
|
||||
NS_ENSURE_SUCCESS(parent->AddChildSHEntry(OSHE, she),
|
||||
if (parent) {
|
||||
// OSHE could be null here
|
||||
NS_ENSURE_SUCCESS(parent->AddChildSHEntry(nsnull /* OSHE */, entry),
|
||||
NS_ERROR_FAILURE);
|
||||
}
|
||||
}
|
||||
} //!she
|
||||
// Set the LSHE for non-SH initiated loads.
|
||||
|
@ -3196,7 +3237,11 @@ NS_IMETHODIMP nsDocShell::UpdateCurrentSessionHistory()
|
|||
|
||||
}
|
||||
|
||||
#ifdef SH_IN_FRAMES
|
||||
NS_IMETHODIMP nsDocShell::LoadHistoryEntry(nsISHEntry* aEntry, nsDocShellInfoLoadType aLoadType)
|
||||
#else
|
||||
NS_IMETHODIMP nsDocShell::LoadHistoryEntry(nsISHEntry* aEntry)
|
||||
#endif
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsCOMPtr<nsIInputStream> postData;
|
||||
|
@ -3228,7 +3273,7 @@ NS_IMETHODIMP nsDocShell::LoadHistoryEntry(nsISHEntry* aEntry)
|
|||
|
||||
|
||||
#ifdef SH_IN_FRAMES
|
||||
NS_ENSURE_SUCCESS(InternalLoad(uri, nsnull, nsnull, nsnull, postData, nsIDocShellLoadInfo::loadHistory, aEntry),
|
||||
NS_ENSURE_SUCCESS(InternalLoad(uri, nsnull, nsnull, nsnull, postData, aLoadType, aEntry),
|
||||
NS_ERROR_FAILURE);
|
||||
#else
|
||||
NS_ENSURE_SUCCESS(InternalLoad(uri, nsnull, nsnull, nsnull, postData, nsIDocShellLoadInfo::loadHistory),
|
||||
|
|
|
@ -206,7 +206,11 @@ protected:
|
|||
NS_IMETHOD ShouldPersistInSessionHistory(nsIURI* aURI, PRBool* aShouldPersist);
|
||||
NS_IMETHOD AddToSessionHistory(nsIURI* aURI, nsIChannel *aChannel);
|
||||
NS_IMETHOD UpdateCurrentSessionHistory();
|
||||
#ifdef SH_IN_FRAMES
|
||||
NS_IMETHOD LoadHistoryEntry(nsISHEntry* aEntry, nsDocShellInfoLoadType aLoadType);
|
||||
#else
|
||||
NS_IMETHOD LoadHistoryEntry(nsISHEntry* aEntry);
|
||||
#endif
|
||||
// NS_IMETHOD GetCurrentSHE(PRInt32 aChildOffset, nsISHEntry ** aResult);
|
||||
NS_IMETHOD PersistLayoutHistoryState();
|
||||
NS_IMETHOD CloneAndReplace(nsISHEntry * srcEntry, nsISHEntry * aCloneRef,
|
||||
|
@ -259,7 +263,7 @@ protected:
|
|||
PRBool mAllowPlugins;
|
||||
PRInt32 mViewMode;
|
||||
|
||||
PRInt32 mOffset; // Offset in the parent's child list.
|
||||
PRInt32 mChildOffset; // Offset in the parent's child list.
|
||||
// Reference to the SHEntry for this docshell until the page is destroyed.
|
||||
// Somebody give me better name
|
||||
nsCOMPtr<nsISHEntry> OSHE;
|
||||
|
|
|
@ -131,5 +131,8 @@ interface nsIDocShellTreeItem : nsISupports
|
|||
addref'd before handing it to them.
|
||||
*/
|
||||
attribute nsIDocShellTreeOwner treeOwner;
|
||||
|
||||
/* The offset of yourself in your parent's child list */
|
||||
attribute long childOffset;
|
||||
};
|
||||
|
||||
|
|
|
@ -64,6 +64,14 @@ interface nsIWebNavigation : nsISupports
|
|||
*/
|
||||
void goForward();
|
||||
|
||||
/*
|
||||
Tells the object to navigate to the session history item at index.
|
||||
@return NS_OK - Gotoindex was successfull
|
||||
NS_ERROR_UNEXPECTED - This call was unexpected at this time. Most
|
||||
likely you can't goto that index
|
||||
*/
|
||||
void gotoIndex(in long index);
|
||||
|
||||
/*
|
||||
Loads a given URI. This will give priority to loading the requested URI
|
||||
in the object implementing this interface. If it can't be loaded here
|
||||
|
|
|
@ -132,6 +132,8 @@ static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_C
|
|||
#define DETECT_WEBSHELL_LEAKS
|
||||
#endif
|
||||
|
||||
//#ifdef SH_IN_FRAMES 1
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
/**
|
||||
* Note: the log module is created during initialization which
|
||||
|
@ -745,8 +747,11 @@ NS_IMETHODIMP nsWebShell::GoTo(PRInt32 aIndex)
|
|||
NS_ENSURE_TRUE(entry, NS_ERROR_FAILURE);
|
||||
|
||||
UpdateCurrentSessionHistory();
|
||||
|
||||
#ifdef SH_IN_FRAMES
|
||||
NS_ENSURE_SUCCESS(LoadHistoryEntry(entry, nsIDocShellLoadInfo::loadHistory), NS_ERROR_FAILURE);
|
||||
#else
|
||||
NS_ENSURE_SUCCESS(LoadHistoryEntry(entry), NS_ERROR_FAILURE);
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1019,8 +1024,11 @@ nsWebShell::HandleLinkClickEvent(nsIContent *aContent,
|
|||
|
||||
nsCOMPtr<nsISupports> owner;
|
||||
GetCurrentDocumentOwner(getter_AddRefs(owner));
|
||||
|
||||
#ifdef SH_IN_FRAMES
|
||||
InternalLoad(uri, mCurrentURI, owner, target, aPostDataStream, nsIDocShellLoadInfo::loadLink, nsnull);
|
||||
#else
|
||||
InternalLoad(uri, mCurrentURI, owner, target, aPostDataStream, nsIDocShellLoadInfo::loadLink);
|
||||
#endif /* SH_IN_FRAMES */
|
||||
}
|
||||
break;
|
||||
case eLinkVerb_Embed:
|
||||
|
@ -1136,6 +1144,9 @@ nsWebShell::OnEndDocumentLoad(nsIDocumentLoader* loader,
|
|||
during this load handler. */
|
||||
nsCOMPtr<nsIWebShell> kungFuDeathGrip(this);
|
||||
|
||||
// Clear the LSHE reference in docshell to indicate document loading
|
||||
// is done one way or another.
|
||||
LSHE = nsnull;
|
||||
if(mScriptGlobal && !mEODForCurrentDocument && NS_SUCCEEDED(aStatus))
|
||||
{
|
||||
if(mContentViewer)
|
||||
|
|
|
@ -337,6 +337,18 @@ NS_IMETHODIMP nsWebBrowser::SetTreeOwner(nsIDocShellTreeOwner* aTreeOwner)
|
|||
return mDocShellTreeOwner->SetTreeOwner(aTreeOwner);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowser::SetChildOffset(PRInt32 aChildOffset)
|
||||
{
|
||||
// Not implemented
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowser::GetChildOffset(PRInt32 *aChildOffset)
|
||||
{
|
||||
// Not implemented
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsWebBrowser::nsIWebNavigation
|
||||
//*****************************************************************************
|
||||
|
@ -383,6 +395,13 @@ NS_IMETHODIMP nsWebBrowser::Reload(PRInt32 aReloadType)
|
|||
return mDocShellAsNav->Reload(aReloadType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowser::GotoIndex(PRInt32 aIndex)
|
||||
{
|
||||
NS_ENSURE_STATE(mDocShell);
|
||||
|
||||
return mDocShellAsNav->GotoIndex(aIndex);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowser::Stop()
|
||||
{
|
||||
NS_ENSURE_STATE(mDocShell);
|
||||
|
|
|
@ -132,6 +132,8 @@ static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_C
|
|||
#define DETECT_WEBSHELL_LEAKS
|
||||
#endif
|
||||
|
||||
//#ifdef SH_IN_FRAMES 1
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
/**
|
||||
* Note: the log module is created during initialization which
|
||||
|
@ -745,8 +747,11 @@ NS_IMETHODIMP nsWebShell::GoTo(PRInt32 aIndex)
|
|||
NS_ENSURE_TRUE(entry, NS_ERROR_FAILURE);
|
||||
|
||||
UpdateCurrentSessionHistory();
|
||||
|
||||
#ifdef SH_IN_FRAMES
|
||||
NS_ENSURE_SUCCESS(LoadHistoryEntry(entry, nsIDocShellLoadInfo::loadHistory), NS_ERROR_FAILURE);
|
||||
#else
|
||||
NS_ENSURE_SUCCESS(LoadHistoryEntry(entry), NS_ERROR_FAILURE);
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1019,8 +1024,11 @@ nsWebShell::HandleLinkClickEvent(nsIContent *aContent,
|
|||
|
||||
nsCOMPtr<nsISupports> owner;
|
||||
GetCurrentDocumentOwner(getter_AddRefs(owner));
|
||||
|
||||
#ifdef SH_IN_FRAMES
|
||||
InternalLoad(uri, mCurrentURI, owner, target, aPostDataStream, nsIDocShellLoadInfo::loadLink, nsnull);
|
||||
#else
|
||||
InternalLoad(uri, mCurrentURI, owner, target, aPostDataStream, nsIDocShellLoadInfo::loadLink);
|
||||
#endif /* SH_IN_FRAMES */
|
||||
}
|
||||
break;
|
||||
case eLinkVerb_Embed:
|
||||
|
@ -1136,6 +1144,9 @@ nsWebShell::OnEndDocumentLoad(nsIDocumentLoader* loader,
|
|||
during this load handler. */
|
||||
nsCOMPtr<nsIWebShell> kungFuDeathGrip(this);
|
||||
|
||||
// Clear the LSHE reference in docshell to indicate document loading
|
||||
// is done one way or another.
|
||||
LSHE = nsnull;
|
||||
if(mScriptGlobal && !mEODForCurrentDocument && NS_SUCCEEDED(aStatus))
|
||||
{
|
||||
if(mContentViewer)
|
||||
|
|
|
@ -450,50 +450,81 @@ NS_INTERFACE_MAP_END
|
|||
NS_IMETHODIMP
|
||||
nsBrowserInstance::Back()
|
||||
{
|
||||
#ifdef SH_IN_FRAMES
|
||||
NS_ENSURE_TRUE(mSessionHistory, NS_ERROR_UNEXPECTED);
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mSessionHistory));
|
||||
webNav->GoBack();
|
||||
#else
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(GetContentAreaDocShell()));
|
||||
NS_ENSURE_TRUE(webNav, NS_ERROR_FAILURE);
|
||||
|
||||
webNav->GoBack();
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserInstance::Forward()
|
||||
{
|
||||
#ifdef SH_IN_FRAMES
|
||||
NS_ENSURE_TRUE(mSessionHistory, NS_ERROR_UNEXPECTED);
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mSessionHistory));
|
||||
webNav->GoForward();
|
||||
#else
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(GetContentAreaDocShell()));
|
||||
NS_ENSURE_TRUE(webNav, NS_ERROR_FAILURE);
|
||||
|
||||
webNav->GoForward();
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserInstance::GetCanGoBack(PRBool* aCan)
|
||||
{
|
||||
#ifdef SH_IN_FRAMES
|
||||
NS_ENSURE_TRUE(mSessionHistory, NS_ERROR_UNEXPECTED);
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mSessionHistory));
|
||||
webNav->GetCanGoBack(aCan);
|
||||
#else
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(GetContentAreaDocShell()));
|
||||
NS_ENSURE_TRUE(webNav, NS_ERROR_FAILURE);
|
||||
|
||||
webNav->GetCanGoBack(aCan);
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserInstance::GetCanGoForward(PRBool* aCan)
|
||||
{
|
||||
#ifdef SH_IN_FRAMES
|
||||
NS_ENSURE_TRUE(mSessionHistory, NS_ERROR_UNEXPECTED);
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mSessionHistory));
|
||||
webNav->GetCanGoForward(aCan);
|
||||
#else
|
||||
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(GetContentAreaDocShell()));
|
||||
NS_ENSURE_TRUE(webNav, NS_ERROR_FAILURE);
|
||||
|
||||
webNav->GetCanGoForward(aCan);
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserInstance::Reload(nsLoadFlags flags)
|
||||
{
|
||||
#ifdef SH_IN_FRAMES
|
||||
NS_ENSURE_TRUE(mSessionHistory, NS_ERROR_UNEXPECTED);
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mSessionHistory));
|
||||
webNav->Reload(flags);
|
||||
#else
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(GetContentAreaDocShell()));
|
||||
NS_ENSURE_TRUE(webNav, NS_ERROR_FAILURE);
|
||||
|
||||
webNav->Reload(nsIWebNavigation::reloadNormal);
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -763,8 +794,15 @@ nsBrowserInstance::ForwardButtonPopup(nsIDOMNode * aParent)
|
|||
NS_IMETHODIMP
|
||||
nsBrowserInstance::GotoHistoryIndex(PRInt32 aIndex)
|
||||
{
|
||||
#ifdef SH_IN_FRAMES
|
||||
NS_ENSURE_TRUE(mSessionHistory, NS_ERROR_UNEXPECTED);
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mSessionHistory));
|
||||
webNav->GotoIndex(aIndex);
|
||||
#else
|
||||
|
||||
nsCOMPtr<nsIWebShell> webShell(do_QueryInterface(GetContentAreaDocShell()));
|
||||
webShell->GoTo(aIndex);
|
||||
#endif
|
||||
return NS_OK;
|
||||
|
||||
}
|
||||
|
@ -944,9 +982,17 @@ nsBrowserInstance::SetContentWindow(nsIDOMWindow* aWin)
|
|||
nsCOMPtr<nsIWebProgress> webProgress(do_GetInterface(docShell));
|
||||
webProgress->AddProgressListener(NS_STATIC_CAST(nsIWebProgressListener*, this));
|
||||
nsCOMPtr<nsISHistory> sessionHistory(do_CreateInstance(NS_SHISTORY_PROGID));
|
||||
#ifdef SH_IN_FRAMES
|
||||
mSessionHistory = sessionHistory;
|
||||
if (!mSessionHistory) {
|
||||
printf("#### Error initialising Session History ####\n");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mSessionHistory->SetRootDocShell(docShell);
|
||||
#endif
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(docShell));
|
||||
webNav->SetSessionHistory(sessionHistory);
|
||||
|
||||
|
||||
|
||||
// Cache the Document Loader for the content area webshell. This is a
|
||||
// weak reference that is *not* reference counted...
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "nsIWebProgressListener.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIUrlbarHistory.h"
|
||||
#include "nsISHistory.h"
|
||||
|
||||
class nsIDocShell;
|
||||
class nsIScriptContext;
|
||||
|
@ -58,6 +59,7 @@ class nsIFindComponent;
|
|||
|
||||
|
||||
#define SHISTORY_POPUP_LIST 10
|
||||
//#define SH_IN_FRAMES
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsBrowserInstance:
|
||||
|
@ -103,7 +105,9 @@ class nsBrowserInstance : public nsIBrowserInstance,
|
|||
PRBool mIsClosed;
|
||||
|
||||
nsCOMPtr<nsIXULBrowserWindow> mXULBrowserWindow;
|
||||
|
||||
#ifdef SH_IN_FRAMES
|
||||
nsCOMPtr<nsISHistory> mSessionHistory;
|
||||
#endif
|
||||
nsIScriptContext *mContentScriptContext; // weak reference
|
||||
|
||||
nsWeakPtr mContentWindowWeak;
|
||||
|
|
|
@ -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<nsIDocShell> docShell;
|
||||
nsCOMPtr<nsISHEntry> shEntry;
|
||||
|
@ -450,22 +459,26 @@ nsSHistory::GotoIndex(PRInt32 aIndex)
|
|||
nsCOMPtr<nsISHEntry> 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<nsIURI> nexturi;
|
||||
nsCOMPtr<nsIDocShellLoadInfo> 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);
|
||||
|
||||
|
|
|
@ -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<nsISHTransaction> mListRoot;
|
||||
|
|
Загрузка…
Ссылка в новой задаче