зеркало из https://github.com/mozilla/gecko-dev.git
Reworked the nsIWebProgress interfaces and implementation...
This commit is contained in:
Родитель
578b2bbee5
Коммит
44dfb4b825
|
@ -45,7 +45,7 @@ CPPSRCS = \
|
|||
nsDocShell.cpp \
|
||||
nsDocShellLoadInfo.cpp \
|
||||
nsDSURIContentListener.cpp \
|
||||
nsDSWebProgressListener.cpp \
|
||||
# nsDSWebProgressListener.cpp \
|
||||
$(NULL)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a
|
||||
|
|
|
@ -43,7 +43,7 @@ CPP_OBJS= \
|
|||
.\$(OBJDIR)\nsDocShell.obj \
|
||||
.\$(OBJDIR)\nsDocShellLoadInfo.obj \
|
||||
.\$(OBJDIR)\nsDSURIContentListener.obj \
|
||||
.\$(OBJDIR)\nsDSWebProgressListener.obj \
|
||||
# .\$(OBJDIR)\nsDSWebProgressListener.obj \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
|
|
@ -92,7 +92,7 @@ NS_IMETHODIMP nsDSURIContentListener::DoContent(const char* aContentType,
|
|||
aOpenedChannel->GetLoadAttributes(&loadAttribs);
|
||||
|
||||
if(loadAttribs & nsIChannel::LOAD_RETARGETED_DOCUMENT_URI)
|
||||
mDocShell->StopCurrentLoads();
|
||||
mDocShell->StopLoad();
|
||||
|
||||
mDocShell->OnLoadingSite(aOpenedChannel);
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
* Contributor(s):
|
||||
* Travis Bogard <travis@netscape.com>
|
||||
*/
|
||||
#if 0 /* This file is now longer used... */
|
||||
|
||||
// Local Includes
|
||||
#include "nsDocShell.h"
|
||||
|
@ -140,3 +141,5 @@ nsDocShell* nsDSWebProgressListener::DocShell()
|
|||
{
|
||||
return mDocShell;
|
||||
}
|
||||
|
||||
#endif /* 0 */
|
||||
|
|
|
@ -80,7 +80,6 @@ static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CI
|
|||
|
||||
nsDocShell::nsDocShell() :
|
||||
mContentListener(nsnull),
|
||||
mWebProgressListener(nsnull),
|
||||
mInitInfo(nsnull),
|
||||
mMarginWidth(0),
|
||||
mMarginHeight(0),
|
||||
|
@ -133,7 +132,6 @@ NS_INTERFACE_MAP_BEGIN(nsDocShell)
|
|||
NS_INTERFACE_MAP_ENTRY(nsIDocShellTreeItem)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDocShellTreeNode)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebNavigation)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebProgress)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIBaseWindow)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIScrollable)
|
||||
NS_INTERFACE_MAP_ENTRY(nsITextScroll)
|
||||
|
@ -154,9 +152,6 @@ NS_IMETHODIMP nsDocShell::GetInterface(const nsIID& aIID, void** aSink)
|
|||
if(aIID.Equals(NS_GET_IID(nsIURIContentListener)) &&
|
||||
NS_SUCCEEDED(EnsureContentListener()))
|
||||
*aSink = mContentListener;
|
||||
else if(aIID.Equals(NS_GET_IID(nsIWebProgressListener)) &&
|
||||
NS_SUCCEEDED(EnsureWebProgressListener()))
|
||||
*aSink = mWebProgressListener;
|
||||
else if(aIID.Equals(NS_GET_IID(nsIScriptGlobalObject)) &&
|
||||
NS_SUCCEEDED(EnsureScriptEnvironment()))
|
||||
*aSink = mScriptGlobal;
|
||||
|
@ -179,15 +174,18 @@ NS_IMETHODIMP nsDocShell::GetInterface(const nsIID& aIID, void** aSink)
|
|||
else
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
else if (aIID.Equals(NS_GET_IID(nsIProgressEventSink)))
|
||||
else if (aIID.Equals(NS_GET_IID(nsIProgressEventSink)) ||
|
||||
aIID.Equals(NS_GET_IID(nsIWebProgress)))
|
||||
{
|
||||
nsCOMPtr<nsIURILoader> uriLoader(do_GetService(NS_URI_LOADER_PROGID));
|
||||
NS_ENSURE_TRUE(uriLoader, NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsIDocumentLoader> docLoader;
|
||||
NS_ENSURE_SUCCESS(uriLoader->GetDocumentLoaderForContext(NS_STATIC_CAST(nsIDocShell*, this),
|
||||
getter_AddRefs(docLoader)), NS_ERROR_FAILURE);
|
||||
if (docLoader)
|
||||
return docLoader->QueryInterface(aIID, aSink);
|
||||
if (docLoader) {
|
||||
nsCOMPtr<nsIInterfaceRequestor> requestor(do_QueryInterface(docLoader));
|
||||
return requestor->GetInterface(aIID, aSink);
|
||||
}
|
||||
else
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -775,15 +773,25 @@ NS_IMETHODIMP nsDocShell::GetTreeOwner(nsIDocShellTreeOwner** aTreeOwner)
|
|||
|
||||
NS_IMETHODIMP nsDocShell::SetTreeOwner(nsIDocShellTreeOwner* aTreeOwner)
|
||||
{
|
||||
mTreeOwner = aTreeOwner; // Weak reference per API
|
||||
// Don't automatically set the progress based on the tree owner for frames
|
||||
if(!IsFrame())
|
||||
{
|
||||
nsCOMPtr<nsIWebProgressListener> progressListener(do_QueryInterface(aTreeOwner));
|
||||
mOwnerProgressListener = progressListener; // Weak reference per API
|
||||
if (!IsFrame()) {
|
||||
nsCOMPtr<nsIWebProgress> webProgress(do_GetInterface(mLoadCookie));
|
||||
|
||||
if (webProgress) {
|
||||
nsCOMPtr<nsIWebProgressListener> oldListener(do_QueryInterface(mTreeOwner));
|
||||
nsCOMPtr<nsIWebProgressListener> newListener(do_QueryInterface(aTreeOwner));
|
||||
|
||||
if (oldListener) {
|
||||
webProgress->RemoveProgressListener(oldListener);
|
||||
}
|
||||
else
|
||||
mOwnerProgressListener = nsnull;
|
||||
|
||||
if (newListener) {
|
||||
webProgress->AddProgressListener(newListener);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mTreeOwner = aTreeOwner; // Weak reference per API
|
||||
|
||||
PRInt32 i, n = mChildren.Count();
|
||||
for(i = 0; i < n; i++)
|
||||
|
@ -1188,96 +1196,6 @@ NS_IMETHODIMP nsDocShell::GetSessionHistory(nsISHistory** aSessionHistory)
|
|||
NS_IF_ADDREF(*aSessionHistory);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsDocShell::nsIWebProgress
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP nsDocShell::AddProgressListener(nsIWebProgressListener* aListener)
|
||||
{
|
||||
if(!mWebProgressListenerList)
|
||||
NS_ENSURE_SUCCESS(NS_NewISupportsArray(getter_AddRefs(mWebProgressListenerList)),
|
||||
NS_ERROR_FAILURE);
|
||||
|
||||
// Make sure it isn't already in the list... This is bad!
|
||||
NS_ENSURE_ARG(mWebProgressListenerList->IndexOf(aListener) == -1);
|
||||
|
||||
NS_ENSURE_SUCCESS(mWebProgressListenerList->AppendElement(aListener),
|
||||
NS_ERROR_FAILURE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShell::RemoveProgressListener(nsIWebProgressListener* aListener)
|
||||
{
|
||||
NS_ENSURE_STATE(mWebProgressListenerList);
|
||||
NS_ENSURE_ARG(aListener);
|
||||
|
||||
NS_ENSURE_TRUE(mWebProgressListenerList->RemoveElement(aListener),
|
||||
NS_ERROR_INVALID_ARG);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShell::GetProgressStatusFlags(PRInt32* aProgressStatusFlags)
|
||||
{
|
||||
//XXXTAB First Check
|
||||
//XXX First Check
|
||||
/*
|
||||
Current connection Status of the browser. This will be one of the enumerated
|
||||
connection progress steps.
|
||||
*/
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShell::GetCurSelfProgress(PRInt32* curSelfProgress)
|
||||
{
|
||||
//XXXTAB First Check
|
||||
//XXX First Check
|
||||
/*
|
||||
The current position of progress. This is between 0 and maxSelfProgress.
|
||||
This is the position of only this progress object. It doesn not include
|
||||
the progress of all children.
|
||||
*/
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShell::GetMaxSelfProgress(PRInt32* maxSelfProgress)
|
||||
{
|
||||
//XXXTAB First Check
|
||||
//XXX First Check
|
||||
/*
|
||||
The maximum position that progress will go to. This sets a relative
|
||||
position point for the current progress to relate to. This is the max
|
||||
position of only this progress object. It does not include the progress of
|
||||
all the children.
|
||||
*/
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShell::GetCurTotalProgress(PRInt32* curTotalProgress)
|
||||
{
|
||||
//XXXTAB First Check
|
||||
//XXX First Check
|
||||
/*
|
||||
The current position of progress for this object and all children added
|
||||
together. This is between 0 and maxTotalProgress.
|
||||
*/
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShell::GetMaxTotalProgress(PRInt32* maxTotalProgress)
|
||||
{
|
||||
//XXXTAB First Check
|
||||
//XXX First Check
|
||||
/*
|
||||
The maximum position that progress will go to for the max of this progress
|
||||
object and all children. This sets the relative position point for the
|
||||
current progress to relate to.
|
||||
*/
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsDocShell::nsIBaseWindow
|
||||
//*****************************************************************************
|
||||
|
@ -1328,7 +1246,6 @@ NS_IMETHODIMP nsDocShell::Destroy()
|
|||
mParentWidget = nsnull;
|
||||
mPrefs = nsnull;
|
||||
mCurrentURI = nsnull;
|
||||
mWebProgressListenerList = nsnull;
|
||||
|
||||
if(mScriptGlobal)
|
||||
{
|
||||
|
@ -1359,12 +1276,6 @@ NS_IMETHODIMP nsDocShell::Destroy()
|
|||
NS_RELEASE(mContentListener);
|
||||
}
|
||||
|
||||
if(mWebProgressListener)
|
||||
{
|
||||
mWebProgressListener->DocShell(nsnull);
|
||||
NS_RELEASE(mWebProgressListener);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2396,7 +2307,7 @@ NS_IMETHODIMP nsDocShell::InternalLoad(nsIURI* aURI, nsIURI* aReferrer,
|
|||
}
|
||||
}
|
||||
|
||||
NS_ENSURE_SUCCESS(StopCurrentLoads(), NS_ERROR_FAILURE);
|
||||
NS_ENSURE_SUCCESS(StopLoad(), NS_ERROR_FAILURE);
|
||||
// Cancel any timers that were set for this loader.
|
||||
CancelRefreshURITimers();
|
||||
|
||||
|
@ -2759,12 +2670,6 @@ NS_IMETHODIMP nsDocShell::DoURILoad(nsIURI* aURI, nsIURI* aReferrerURI,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShell::StopCurrentLoads()
|
||||
{
|
||||
StopLoad();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShell::ScrollIfAnchor(nsIURI* aURI, PRBool* aWasAnchor)
|
||||
{
|
||||
NS_ASSERTION(aURI, "null uri arg");
|
||||
|
@ -2883,7 +2788,6 @@ void nsDocShell::OnNewURI(nsIURI *aURI, nsIChannel *aChannel, loadType aLoadType
|
|||
NS_ASSERTION(aURI, "uri is null");
|
||||
|
||||
UpdateCurrentGlobalHistory();
|
||||
|
||||
PRBool updateHistory = PR_TRUE;
|
||||
|
||||
// Determine if this type of load should update history
|
||||
|
@ -3026,7 +2930,13 @@ NS_IMETHODIMP nsDocShell::OnLoadingSite(nsIChannel* aChannel)
|
|||
void nsDocShell::SetCurrentURI(nsIURI* aURI)
|
||||
{
|
||||
mCurrentURI = aURI; //This assignment addrefs
|
||||
FireOnLocationChange(aURI);
|
||||
|
||||
nsCOMPtr<nsIDocumentLoader> loader(do_GetInterface(mLoadCookie));
|
||||
|
||||
NS_ASSERTION(loader, "No document loader");
|
||||
if (loader) {
|
||||
loader->FireOnLocationChange(aURI);
|
||||
}
|
||||
}
|
||||
|
||||
void nsDocShell::SetReferrerURI(nsIURI* aURI)
|
||||
|
@ -3249,143 +3159,6 @@ NS_IMETHODIMP nsDocShell::UpdateCurrentGlobalHistory()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsDocShell: WebProgressListener Firing
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP nsDocShell::EnsureWebProgressListener()
|
||||
{
|
||||
if(mWebProgressListener)
|
||||
return NS_OK;
|
||||
|
||||
mWebProgressListener = new nsDSWebProgressListener();
|
||||
NS_ENSURE_TRUE(mWebProgressListener, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_ADDREF(mWebProgressListener);
|
||||
mWebProgressListener->DocShell(this);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShell::FireOnProgressChange(nsIChannel* aChannel,
|
||||
PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress,
|
||||
PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress)
|
||||
{
|
||||
if(mOwnerProgressListener)
|
||||
mOwnerProgressListener->OnProgressChange(aChannel, aCurSelfProgress,
|
||||
aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress);
|
||||
|
||||
if(!mWebProgressListenerList)
|
||||
return NS_OK;
|
||||
|
||||
PRUint32 count = 0;
|
||||
mWebProgressListenerList->Count(&count);
|
||||
for(PRUint32 x = 0; x < count; x++)
|
||||
{
|
||||
nsCOMPtr<nsISupports> element;
|
||||
mWebProgressListenerList->GetElementAt(x, getter_AddRefs(element));
|
||||
nsCOMPtr<nsIWebProgressListener> listener(do_QueryInterface(element));
|
||||
if(!listener)
|
||||
continue;
|
||||
listener->OnProgressChange(aChannel, aCurSelfProgress, aMaxSelfProgress,
|
||||
aCurTotalProgress, aMaxTotalProgress);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShell::FireOnChildProgressChange(nsIChannel* aChannel,
|
||||
PRInt32 aCurChildProgress, PRInt32 aMaxChildProgress)
|
||||
{
|
||||
if(mOwnerProgressListener)
|
||||
mOwnerProgressListener->OnChildProgressChange(aChannel, aCurChildProgress,
|
||||
aMaxChildProgress);
|
||||
|
||||
if(!mWebProgressListenerList)
|
||||
return NS_OK;
|
||||
|
||||
PRUint32 count = 0;
|
||||
mWebProgressListenerList->Count(&count);
|
||||
for(PRUint32 x = 0; x < count; x++)
|
||||
{
|
||||
nsCOMPtr<nsISupports> element;
|
||||
mWebProgressListenerList->GetElementAt(x, getter_AddRefs(element));
|
||||
nsCOMPtr<nsIWebProgressListener> listener(do_QueryInterface(element));
|
||||
if(!listener)
|
||||
continue;
|
||||
listener->OnChildProgressChange(aChannel, aCurChildProgress,
|
||||
aMaxChildProgress);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShell::FireOnStatusChange(nsIChannel* aChannel,
|
||||
PRInt32 aProgressStatusFlags)
|
||||
{
|
||||
if(mOwnerProgressListener)
|
||||
mOwnerProgressListener->OnStatusChange(aChannel, aProgressStatusFlags);
|
||||
|
||||
if(!mWebProgressListenerList)
|
||||
return NS_OK;
|
||||
|
||||
PRUint32 count = 0;
|
||||
mWebProgressListenerList->Count(&count);
|
||||
for(PRUint32 x = 0; x < count; x++)
|
||||
{
|
||||
nsCOMPtr<nsISupports> element;
|
||||
mWebProgressListenerList->GetElementAt(x, getter_AddRefs(element));
|
||||
nsCOMPtr<nsIWebProgressListener> listener(do_QueryInterface(element));
|
||||
if(!listener)
|
||||
continue;
|
||||
listener->OnStatusChange(aChannel, aProgressStatusFlags);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShell::FireOnChildStatusChange(nsIChannel* aChannel,
|
||||
PRInt32 aProgressStatusFlags)
|
||||
{
|
||||
if(mOwnerProgressListener)
|
||||
mOwnerProgressListener->OnStatusChange(aChannel, aProgressStatusFlags);
|
||||
|
||||
if(!mWebProgressListenerList)
|
||||
return NS_OK;
|
||||
|
||||
PRUint32 count = 0;
|
||||
mWebProgressListenerList->Count(&count);
|
||||
for(PRUint32 x = 0; x < count; x++)
|
||||
{
|
||||
nsCOMPtr<nsISupports> element;
|
||||
mWebProgressListenerList->GetElementAt(x, getter_AddRefs(element));
|
||||
nsCOMPtr<nsIWebProgressListener> listener(do_QueryInterface(element));
|
||||
if(!listener)
|
||||
continue;
|
||||
listener->OnChildStatusChange(aChannel, aProgressStatusFlags);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShell::FireOnLocationChange(nsIURI* aURI)
|
||||
{
|
||||
if(mOwnerProgressListener)
|
||||
mOwnerProgressListener->OnLocationChange(aURI);
|
||||
|
||||
if(!mWebProgressListenerList)
|
||||
return NS_OK;
|
||||
|
||||
PRUint32 count = 0;
|
||||
mWebProgressListenerList->Count(&count);
|
||||
for(PRUint32 x = 0; x < count; x++)
|
||||
{
|
||||
nsCOMPtr<nsISupports> element;
|
||||
mWebProgressListenerList->GetElementAt(x, getter_AddRefs(element));
|
||||
nsCOMPtr<nsIWebProgressListener> listener(do_QueryInterface(element));
|
||||
if(!listener)
|
||||
continue;
|
||||
listener->OnLocationChange(aURI);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//*****************************************************************************
|
||||
// nsDocShell: Helper Routines
|
||||
//*****************************************************************************
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
|
||||
// Local Includes
|
||||
#include "nsDSURIContentListener.h"
|
||||
#include "nsDSWebProgressListener.h"
|
||||
|
||||
// Helper Classes
|
||||
#include "nsCOMPtr.h"
|
||||
|
@ -113,7 +112,6 @@ class nsDocShell : public nsIDocShell,
|
|||
public nsIDocShellTreeItem,
|
||||
public nsIDocShellTreeNode,
|
||||
public nsIWebNavigation,
|
||||
public nsIWebProgress,
|
||||
public nsIBaseWindow,
|
||||
public nsIScrollable,
|
||||
public nsITextScroll,
|
||||
|
@ -136,7 +134,6 @@ public:
|
|||
NS_DECL_NSIDOCSHELLTREEITEM
|
||||
NS_DECL_NSIDOCSHELLTREENODE
|
||||
NS_DECL_NSIWEBNAVIGATION
|
||||
NS_DECL_NSIWEBPROGRESS
|
||||
NS_DECL_NSIBASEWINDOW
|
||||
NS_DECL_NSISCROLLABLE
|
||||
NS_DECL_NSITEXTSCROLL
|
||||
|
@ -196,7 +193,6 @@ protected:
|
|||
NS_IMETHOD DoURILoad(nsIURI* aURI, nsIURI* aReferrer, nsISupports *aOwner,
|
||||
nsURILoadCommand aLoadCmd, const char* aWindowTarget,
|
||||
nsIInputStream* aPostData);
|
||||
NS_IMETHOD StopCurrentLoads();
|
||||
NS_IMETHOD ScrollIfAnchor(nsIURI* aURI, PRBool* aWasAnchor);
|
||||
NS_IMETHOD OnLoadingSite(nsIChannel* aChannel);
|
||||
virtual void OnNewURI(nsIURI *aURI, nsIChannel* aChannel, loadType aLoadType);
|
||||
|
@ -215,19 +211,6 @@ protected:
|
|||
NS_IMETHOD AddToGlobalHistory(nsIURI* aURI);
|
||||
NS_IMETHOD UpdateCurrentGlobalHistory();
|
||||
|
||||
// WebProgressListener Management
|
||||
NS_IMETHOD EnsureWebProgressListener();
|
||||
|
||||
NS_IMETHOD FireOnProgressChange(nsIChannel* aChannel,
|
||||
PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress,
|
||||
PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress);
|
||||
NS_IMETHOD FireOnChildProgressChange(nsIChannel* aChannel,
|
||||
PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress);
|
||||
NS_IMETHOD FireOnStatusChange(nsIChannel* aChannel, PRInt32 aProgressStatusFlags);
|
||||
NS_IMETHOD FireOnChildStatusChange(nsIChannel* aChannel,
|
||||
PRInt32 aProgressStatusFlags);
|
||||
NS_IMETHOD FireOnLocationChange(nsIURI* aURI);
|
||||
|
||||
// Helper Routines
|
||||
nsDocShellInitInfo* InitInfo();
|
||||
NS_IMETHOD GetPromptAndStringBundle(nsIPrompt** aPrompt, nsIStringBundle**
|
||||
|
@ -257,7 +240,6 @@ protected:
|
|||
nsVoidArray mChildren;
|
||||
nsCOMPtr<nsISupportsArray> mRefreshURIList;
|
||||
nsDSURIContentListener* mContentListener;
|
||||
nsDSWebProgressListener* mWebProgressListener;
|
||||
nsDocShellInitInfo* mInitInfo;
|
||||
nsCOMPtr<nsIContentViewer> mContentViewer;
|
||||
nsCOMPtr<nsIDocumentCharsetInfo> mDocumentCharsetInfo;
|
||||
|
@ -272,7 +254,6 @@ protected:
|
|||
nsCOMPtr<nsIScriptContext> mScriptContext;
|
||||
nsCOMPtr<nsISHistory> mSessionHistory;
|
||||
nsCOMPtr<nsIGlobalHistory> mGlobalHistory;
|
||||
nsCOMPtr<nsISupportsArray> mWebProgressListenerList;
|
||||
nsCOMPtr<nsISupports> mLoadCookie; // the load cookie associated with the window context.
|
||||
PRInt32 mMarginWidth;
|
||||
PRInt32 mMarginHeight;
|
||||
|
@ -294,7 +275,6 @@ protected:
|
|||
For that reasons don't use nsCOMPtr.*/
|
||||
nsIDocShellTreeItem* mParent; // Weak Reference
|
||||
nsIDocShellTreeOwner* mTreeOwner; // Weak Reference
|
||||
nsIWebProgressListener* mOwnerProgressListener; // Weak Reference
|
||||
nsIChromeEventHandler* mChromeEventHandler; //Weak Reference
|
||||
};
|
||||
|
||||
|
|
|
@ -402,6 +402,7 @@ nsWebShell::~nsWebShell()
|
|||
mDocLoader->Stop();
|
||||
mDocLoader->RemoveObserver((nsIDocumentLoaderObserver*)this);
|
||||
mDocLoader->SetContainer(nsnull);
|
||||
mDocLoader->Destroy();
|
||||
NS_RELEASE(mDocLoader);
|
||||
}
|
||||
// Cancel any timers that were set for this loader.
|
||||
|
@ -1138,7 +1139,7 @@ nsWebShell::OnEndDocumentLoad(nsIDocumentLoader* loader,
|
|||
during this load handler. */
|
||||
nsCOMPtr<nsIWebShell> kungFuDeathGrip(this);
|
||||
|
||||
if(mScriptGlobal && !mEODForCurrentDocument)
|
||||
if(mScriptGlobal && !mEODForCurrentDocument && NS_SUCCEEDED(aStatus))
|
||||
{
|
||||
if(mContentViewer)
|
||||
{
|
||||
|
|
|
@ -154,8 +154,8 @@ NS_IMETHODIMP CWebBrowserContainer::UniversalDialog(const PRUnichar *inTitleMess
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsIWebProgressListener
|
||||
|
||||
/* void onProgressChange (in nsIChannel channel, in long curSelfProgress, in long maxSelfProgress, in long curTotalProgress, in long maxTotalProgress); */
|
||||
NS_IMETHODIMP CWebBrowserContainer::OnProgressChange(nsIChannel *channel, PRInt32 curSelfProgress, PRInt32 maxSelfProgress, PRInt32 curTotalProgress, PRInt32 maxTotalProgress)
|
||||
/* void onProgressChange (in nsIWebProgress aProgress, in nsIRequest aRequest, in long curSelfProgress, in long maxSelfProgress, in long curTotalProgress, in long maxTotalProgress); */
|
||||
NS_IMETHODIMP CWebBrowserContainer::OnProgressChange(nsIWebProgress *aProgress, nsIRequest *aRequest, PRInt32 curSelfProgress, PRInt32 maxSelfProgress, PRInt32 curTotalProgress, PRInt32 maxTotalProgress)
|
||||
{
|
||||
NG_TRACE(_T("CWebBrowserContainer::OnProgressChange(...)\n"));
|
||||
|
||||
|
@ -181,84 +181,76 @@ NS_IMETHODIMP CWebBrowserContainer::OnProgressChange(nsIChannel *channel, PRInt3
|
|||
}
|
||||
|
||||
|
||||
/* void onChildProgressChange (in nsIChannel channel, in long curChildProgress, in long maxChildProgress); */
|
||||
NS_IMETHODIMP CWebBrowserContainer::OnChildProgressChange(nsIChannel *channel, PRInt32 curChildProgress, PRInt32 maxChildProgress)
|
||||
|
||||
|
||||
/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest request, in long progressStateFlags, in unsinged long aStatus); */
|
||||
NS_IMETHODIMP CWebBrowserContainer::OnStateChange(nsIWebProgress* aWebProgress, nsIRequest *aRequest, PRInt32 progressStateFlags, nsresult aStatus)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
NG_TRACE(_T("CWebBrowserContainer::OnStateChange(...)\n"));
|
||||
|
||||
if (progressStateFlags & flag_is_network)
|
||||
{
|
||||
|
||||
/* void onStatusChange (in nsIChannel channel, in long progressStatusFlags); */
|
||||
NS_IMETHODIMP CWebBrowserContainer::OnStatusChange(nsIChannel *channel, PRInt32 progressStatusFlags)
|
||||
{
|
||||
NG_TRACE(_T("CWebBrowserContainer::OnStatusChange(...)\n"));
|
||||
if (progressStateFlags & flag_start)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
if (progressStatusFlags & nsIWebProgress::flag_net_start)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
if (progressStateFlags & flag_stop)
|
||||
{
|
||||
nsXPIDLCString aURI;
|
||||
if (m_pCurrentURI)
|
||||
{
|
||||
m_pCurrentURI->GetSpec(getter_Copies(aURI));
|
||||
}
|
||||
|
||||
if (progressStatusFlags & nsIWebProgress::flag_net_stop)
|
||||
{
|
||||
nsXPIDLCString aURI;
|
||||
if (m_pCurrentURI)
|
||||
{
|
||||
m_pCurrentURI->GetSpec(getter_Copies(aURI));
|
||||
}
|
||||
// Fire a NavigateComplete event
|
||||
USES_CONVERSION;
|
||||
BSTR bstrURI = SysAllocString(A2OLE((const char *) aURI));
|
||||
m_pEvents1->Fire_NavigateComplete(bstrURI);
|
||||
|
||||
// Fire a NavigateComplete event
|
||||
USES_CONVERSION;
|
||||
BSTR bstrURI = SysAllocString(A2OLE((const char *) aURI));
|
||||
m_pEvents1->Fire_NavigateComplete(bstrURI);
|
||||
// Fire a NavigateComplete2 event
|
||||
CComVariant vURI(bstrURI);
|
||||
m_pEvents2->Fire_NavigateComplete2(m_pOwner, &vURI);
|
||||
|
||||
// Fire a NavigateComplete2 event
|
||||
CComVariant vURI(bstrURI);
|
||||
m_pEvents2->Fire_NavigateComplete2(m_pOwner, &vURI);
|
||||
// Cleanup
|
||||
SysFreeString(bstrURI);
|
||||
|
||||
// Cleanup
|
||||
SysFreeString(bstrURI);
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(m_pOwner->mWebBrowser));
|
||||
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(m_pOwner->mWebBrowser));
|
||||
// Fire the new NavigateForward state
|
||||
VARIANT_BOOL bEnableForward = VARIANT_FALSE;
|
||||
PRBool aCanGoForward = PR_FALSE;
|
||||
webNav->GetCanGoForward(&aCanGoForward);
|
||||
if (aCanGoForward == PR_TRUE)
|
||||
{
|
||||
bEnableForward = VARIANT_TRUE;
|
||||
}
|
||||
m_pEvents2->Fire_CommandStateChange(CSC_NAVIGATEFORWARD, bEnableForward);
|
||||
|
||||
// Fire the new NavigateForward state
|
||||
VARIANT_BOOL bEnableForward = VARIANT_FALSE;
|
||||
PRBool aCanGoForward = PR_FALSE;
|
||||
webNav->GetCanGoForward(&aCanGoForward);
|
||||
if (aCanGoForward == PR_TRUE)
|
||||
{
|
||||
bEnableForward = VARIANT_TRUE;
|
||||
}
|
||||
m_pEvents2->Fire_CommandStateChange(CSC_NAVIGATEFORWARD, bEnableForward);
|
||||
// Fire the new NavigateBack state
|
||||
VARIANT_BOOL bEnableBack = VARIANT_FALSE;
|
||||
PRBool aCanGoBack = PR_FALSE;
|
||||
webNav->GetCanGoBack(&aCanGoBack);
|
||||
if (aCanGoBack == PR_TRUE)
|
||||
{
|
||||
bEnableBack = VARIANT_TRUE;
|
||||
}
|
||||
m_pEvents2->Fire_CommandStateChange(CSC_NAVIGATEBACK, bEnableBack);
|
||||
|
||||
// Fire the new NavigateBack state
|
||||
VARIANT_BOOL bEnableBack = VARIANT_FALSE;
|
||||
PRBool aCanGoBack = PR_FALSE;
|
||||
webNav->GetCanGoBack(&aCanGoBack);
|
||||
if (aCanGoBack == PR_TRUE)
|
||||
{
|
||||
bEnableBack = VARIANT_TRUE;
|
||||
}
|
||||
m_pEvents2->Fire_CommandStateChange(CSC_NAVIGATEBACK, bEnableBack);
|
||||
m_pOwner->mBusyFlag = FALSE;
|
||||
|
||||
m_pOwner->mBusyFlag = FALSE;
|
||||
|
||||
if (m_pCurrentURI)
|
||||
{
|
||||
NS_RELEASE(m_pCurrentURI);
|
||||
}
|
||||
}
|
||||
if (m_pCurrentURI)
|
||||
{
|
||||
NS_RELEASE(m_pCurrentURI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/* void onChildStatusChange (in nsIChannel channel, in long progressStatusFlags); */
|
||||
NS_IMETHODIMP CWebBrowserContainer::OnChildStatusChange(nsIChannel *channel, PRInt32 progressStatusFlags)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
/* void onLocationChange (in nsIURI location); */
|
||||
NS_IMETHODIMP CWebBrowserContainer::OnLocationChange(nsIURI *location)
|
||||
{
|
||||
|
|
|
@ -621,7 +621,8 @@ NS_IMETHODIMP GtkMozEmbedChrome::SetParentContentListener(nsIURIContentListener
|
|||
|
||||
// nsIWebProgressListener
|
||||
|
||||
NS_IMETHODIMP GtkMozEmbedChrome::OnProgressChange(nsIChannel *channel, PRInt32 curSelfProgress,
|
||||
NS_IMETHODIMP GtkMozEmbedChrome::OnProgressChange(nsIWebProgress *progress, nsIRequest *request,
|
||||
PRInt32 curSelfProgress,
|
||||
PRInt32 maxSelfProgress, PRInt32 curTotalProgress,
|
||||
PRInt32 maxTotalProgress)
|
||||
{
|
||||
|
@ -644,55 +645,35 @@ NS_IMETHODIMP GtkMozEmbedChrome::OnProgressChange(nsIChannel *channel, PRInt32 c
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP GtkMozEmbedChrome::OnChildProgressChange(nsIChannel *channel, PRInt32 curChildProgress,
|
||||
PRInt32 maxChildProgress)
|
||||
NS_IMETHODIMP GtkMozEmbedChrome::OnStateChange(nsIWebProgress *progress, nsIRequest *request,
|
||||
PRInt32 aStateFlags, nsresult aStatus)
|
||||
{
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::OnChildProgressChange\n"));
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP GtkMozEmbedChrome::OnStatusChange(nsIChannel *channel, PRInt32 aStatus)
|
||||
{
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::OnStatusChange\n"));
|
||||
if (aStatus & nsIWebProgress::flag_net_start)
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("flag_net_start\n"));
|
||||
if (aStatus & nsIWebProgress::flag_net_dns)
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("flag_net_dns\n"));
|
||||
if (aStatus & nsIWebProgress::flag_net_connecting)
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("flag_net_connecting\n"));
|
||||
if (aStatus & nsIWebProgress::flag_net_redirecting)
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("flag_net_redirecting\n"));
|
||||
if (aStatus & nsIWebProgress::flag_net_negotiating)
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("flag_net_negotiating\n"));
|
||||
if (aStatus & nsIWebProgress::flag_net_transferring)
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("flag_net_transferring\n"));
|
||||
if (aStatus & nsIWebProgress::flag_net_failedDNS)
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("flag_net_failedDNS\n"));
|
||||
if (aStatus & nsIWebProgress::flag_net_failedConnect)
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("flag_net_failedConnect\n"));
|
||||
if (aStatus & nsIWebProgress::flag_net_failedTransfer)
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("flag_net_failedTransfer\n"));
|
||||
if (aStatus & nsIWebProgress::flag_net_failedTimeout)
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("flag_net_failedTimeout\n"));
|
||||
if (aStatus & nsIWebProgress::flag_net_userCancelled)
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("flag_net_userCancelled\n"));
|
||||
if (aStatus & nsIWebProgress::flag_win_start)
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("flag_win_start\n"));
|
||||
if (aStatus & nsIWebProgress::flag_win_stop)
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("flag_win_stop\n"));
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::OnStateChange\n"));
|
||||
if (aStateFlags & nsIWebProgressListener::flag_start)
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("flag_start\n"));
|
||||
if (aStateFlags & nsIWebProgressListener::flag_redirecting)
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("flag_redirecting\n"));
|
||||
if (aStateFlags & nsIWebProgressListener::flag_negotiating)
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("flag_negotiating\n"));
|
||||
if (aStateFlags & nsIWebProgressListener::flag_transferring)
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("flag_transferring\n"));
|
||||
if (aStateFlags & nsIWebProgressListener::flag_stop)
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("flag_stop\n"));
|
||||
if (aStateFlags & nsIWebProgressListener::flag_is_request)
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("flag_is_request\n"));
|
||||
if (aStateFlags & nsIWebProgressListener::flag_is_document)
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("flag_is_document\n"));
|
||||
if (aStateFlags & nsIWebProgressListener::flag_is_network)
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("flag_is_network\n"));
|
||||
if (aStateFlags & nsIWebProgressListener::flag_is_window)
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("flag_is_window\n"));
|
||||
|
||||
// if we have a callback registered, call it
|
||||
if (mNetCB)
|
||||
mNetCB(mNetCBData, aStatus);
|
||||
mNetCB(mNetCBData, aStateFlags, aStatus);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP GtkMozEmbedChrome::OnChildStatusChange(nsIChannel *channel, PRInt32 progressStatusFlags)
|
||||
{
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::OnChildStatusChange\n"));
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP GtkMozEmbedChrome::OnLocationChange(nsIURI *aLocation)
|
||||
{
|
||||
PR_LOG(mozEmbedLm, PR_LOG_DEBUG, ("GtkMozEmbedChrome::OnLocationChange\n"));
|
||||
|
|
|
@ -53,7 +53,7 @@ enum {
|
|||
LOCATION,
|
||||
TITLE,
|
||||
PROGRESS,
|
||||
NET_STATUS,
|
||||
NET_STATE,
|
||||
NET_START,
|
||||
NET_STOP,
|
||||
NEW_WINDOW,
|
||||
|
@ -118,7 +118,7 @@ static void
|
|||
gtk_moz_embed_handle_progress(GtkMozEmbed *embed, gint32 curprogress, gint32 maxprogress);
|
||||
|
||||
static void
|
||||
gtk_moz_embed_handle_net(GtkMozEmbed *embed, gint flags);
|
||||
gtk_moz_embed_handle_net(GtkMozEmbed *embed, gint flags, guint status);
|
||||
|
||||
static nsresult
|
||||
gtk_moz_embed_handle_new_window(PRUint32 chromeMask, nsIWebBrowser **_retval, void *aData);
|
||||
|
@ -257,13 +257,13 @@ gtk_moz_embed_class_init(GtkMozEmbedClass *klass)
|
|||
GTK_SIGNAL_OFFSET(GtkMozEmbedClass, progress),
|
||||
gtk_marshal_NONE__INT_INT,
|
||||
GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT);
|
||||
moz_embed_signals[NET_STATUS] =
|
||||
gtk_signal_new("net_status",
|
||||
moz_embed_signals[NET_STATE] =
|
||||
gtk_signal_new("net_state",
|
||||
GTK_RUN_FIRST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET(GtkMozEmbedClass, net_status),
|
||||
GTK_SIGNAL_OFFSET(GtkMozEmbedClass, net_state),
|
||||
gtk_marshal_NONE__INT,
|
||||
GTK_TYPE_NONE, 1, GTK_TYPE_INT);
|
||||
GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_UINT);
|
||||
moz_embed_signals[NET_START] =
|
||||
gtk_signal_new("net_start",
|
||||
GTK_RUN_FIRST,
|
||||
|
@ -352,7 +352,7 @@ gtk_moz_embed_init(GtkMozEmbed *embed)
|
|||
embed);
|
||||
embed_private->embed->SetProgressCallback((void (*)(void *, gint, gint))gtk_moz_embed_handle_progress,
|
||||
embed);
|
||||
embed_private->embed->SetNetCallback((void (*)(void *, gint))gtk_moz_embed_handle_net,
|
||||
embed_private->embed->SetNetCallback((void (*)(void *, gint, guint))gtk_moz_embed_handle_net,
|
||||
embed);
|
||||
embed_private->embed->SetNewBrowserCallback(gtk_moz_embed_handle_new_window, embed);
|
||||
embed_private->embed->SetVisibilityCallback(gtk_moz_embed_handle_visibility, embed);
|
||||
|
@ -850,17 +850,17 @@ gtk_moz_embed_handle_progress(GtkMozEmbed *embed, gint32 curprogress, gint32 max
|
|||
}
|
||||
|
||||
static void
|
||||
gtk_moz_embed_handle_net(GtkMozEmbed *embed, gint32 flags)
|
||||
gtk_moz_embed_handle_net(GtkMozEmbed *embed, gint32 flags, guint32 status)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_MOZ_EMBED(embed));
|
||||
|
||||
// if we've got the start flag, emit the signal
|
||||
if (flags & GTK_MOZ_EMBED_FLAG_WIN_START)
|
||||
if ((flags & GTK_MOZ_EMBED_FLAG_IS_WINDOW) && (flags & GTK_MOZ_EMBED_FLAG_START))
|
||||
gtk_signal_emit(GTK_OBJECT(embed), moz_embed_signals[NET_START]);
|
||||
// for people who know what they are doing
|
||||
gtk_signal_emit(GTK_OBJECT(embed), moz_embed_signals[NET_STATUS], flags);
|
||||
gtk_signal_emit(GTK_OBJECT(embed), moz_embed_signals[NET_STATE], flags, status);
|
||||
// and for stop, too
|
||||
if (flags & GTK_MOZ_EMBED_FLAG_WIN_STOP)
|
||||
if ((flags & GTK_MOZ_EMBED_FLAG_IS_WINDOW) && (flags & GTK_MOZ_EMBED_FLAG_STOP))
|
||||
gtk_signal_emit(GTK_OBJECT(embed), moz_embed_signals[NET_STOP]);
|
||||
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ struct _GtkMozEmbedClass
|
|||
void (* location) (GtkMozEmbed *embed);
|
||||
void (* title) (GtkMozEmbed *embed);
|
||||
void (* progress) (GtkMozEmbed *embed, gint maxprogress, gint curprogress);
|
||||
void (* net_status) (GtkMozEmbed *embed, gint status);
|
||||
void (* net_state) (GtkMozEmbed *embed, gint state, guint status);
|
||||
void (* net_start) (GtkMozEmbed *embed);
|
||||
void (* net_stop) (GtkMozEmbed *embed);
|
||||
void (* new_window) (GtkMozEmbed *embed, GtkMozEmbed **newEmbed, guint chromemask);
|
||||
|
@ -86,22 +86,25 @@ extern void gtk_moz_embed_reload (GtkMozEmbed *embed, gint32 f
|
|||
extern void gtk_moz_embed_set_chrome_mask (GtkMozEmbed *embed, guint32 flags);
|
||||
extern guint32 gtk_moz_embed_get_chrome_mask (GtkMozEmbed *embed);
|
||||
|
||||
/* These are straight out of nsIWebProgress.h */
|
||||
/* These are straight out of nsIWebProgressListener.h */
|
||||
|
||||
enum { GTK_MOZ_EMBED_FLAG_NET_START = 1,
|
||||
GTK_MOZ_EMBED_FLAG_NET_STOP = 2,
|
||||
GTK_MOZ_EMBED_FLAG_NET_DNS = 4,
|
||||
GTK_MOZ_EMBED_FLAG_NET_CONNECTING = 8,
|
||||
GTK_MOZ_EMBED_FLAG_NET_REDIRECTING = 16,
|
||||
GTK_MOZ_EMBED_FLAG_NET_NEGOTIATING = 32,
|
||||
GTK_MOZ_EMBED_FLAG_NET_TRANSFERRING = 64,
|
||||
GTK_MOZ_EMBED_FLAG_NET_FAILEDDNS = 4096,
|
||||
GTK_MOZ_EMBED_FLAG_NET_FAILEDCONNECT = 8192,
|
||||
GTK_MOZ_EMBED_FLAG_NET_FAILEDTRANSFER = 16384,
|
||||
GTK_MOZ_EMBED_FLAG_NET_FAILEDTIMEOUT = 32768,
|
||||
GTK_MOZ_EMBED_FLAG_NET_USERCANCELLED = 65536,
|
||||
GTK_MOZ_EMBED_FLAG_WIN_START = 1048576,
|
||||
GTK_MOZ_EMBED_FLAG_WIN_STOP = 2097152 };
|
||||
enum { GTK_MOZ_EMBED_FLAG_START = 1,
|
||||
GTK_MOZ_EMBED_FLAG_REDIRECTING = 2,
|
||||
GTK_MOZ_EMBED_FLAG_TRANSFERRING = 4,
|
||||
GTK_MOZ_EMBED_FLAG_NEGOTIATING = 8,
|
||||
GTK_MOZ_EMBED_FLAG_STOP = 16,
|
||||
|
||||
GTK_MOZ_EMBED_FLAG_IS_REQUEST = 65536,
|
||||
GTK_MOZ_EMBED_FLAG_IS_DOCUMENT = 131072,
|
||||
GTK_MOZ_EMBED_FLAG_IS_NETWORK = 262144,
|
||||
GTK_MOZ_EMBED_FLAG_IS_WINDOW = 524288 };
|
||||
|
||||
/* These are from various networking headers */
|
||||
|
||||
enum { GTK_MOZ_EMBED_STATUS_FAILED_DNS = 268454686, /* NS_ERROR_UNKNOWN_HOST */
|
||||
GTK_MOZ_EMBED_STATUS_FAILED_CONNECT = 268454669, /* NS_ERROR_CONNECTION_REFUSED */
|
||||
GTK_MOZ_EMBED_STATUS_FAILED_TIMEOUT = 268454670, /* NS_ERROR_NET_TIMEOUT */
|
||||
GTK_MOZ_EMBED_STATUS_FAILED_USERCANCELED = 268454658 }; /* NS_BINDING_ABORTED */
|
||||
|
||||
/* These are straight out of nsIWebNavigation.h */
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ typedef void (GtkMozEmbedLocationCB) (void *aData);
|
|||
typedef void (GtkMozEmbedTitleCB) (void *aData);
|
||||
typedef void (GtkMozEmbedProgressCB) (void *aData, PRInt32 aProgressTotal,
|
||||
PRInt32 aProgressCurrent);
|
||||
typedef void (GtkMozEmbedNetCB) (void *aData, PRInt32 aFlags);
|
||||
typedef void (GtkMozEmbedNetCB) (void *aData, PRInt32 aFlags, nsresult aStatus);
|
||||
typedef PRBool (GtkMozEmbedStartOpenCB) (const char *aURI, void *aData);
|
||||
|
||||
class nsIGtkEmbed : public nsISupports
|
||||
|
|
|
@ -65,7 +65,7 @@ static void location_changed_cb (GtkMozEmbed *embed, TestGtkBrowser *browser);
|
|||
static void title_changed_cb (GtkMozEmbed *embed, TestGtkBrowser *browser);
|
||||
static void load_started_cb (GtkMozEmbed *embed, TestGtkBrowser *browser);
|
||||
static void load_finished_cb (GtkMozEmbed *embed, TestGtkBrowser *browser);
|
||||
static void net_status_change_cb (GtkMozEmbed *embed, gint flags, TestGtkBrowser *browser);
|
||||
static void net_state_change_cb (GtkMozEmbed *embed, gint flags, guint status, TestGtkBrowser *browser);
|
||||
static void progress_change_cb (GtkMozEmbed *embed, gint cur, gint max,
|
||||
TestGtkBrowser *browser);
|
||||
static void link_message_cb (GtkMozEmbed *embed, TestGtkBrowser *browser);
|
||||
|
@ -229,8 +229,8 @@ new_gtk_browser(guint32 chromeMask)
|
|||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "net_stop",
|
||||
GTK_SIGNAL_FUNC(load_finished_cb), browser);
|
||||
// hook up to the change in network status
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "net_status",
|
||||
GTK_SIGNAL_FUNC(net_status_change_cb), browser);
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "net_state",
|
||||
GTK_SIGNAL_FUNC(net_state_change_cb), browser);
|
||||
// hookup to changes in progress
|
||||
gtk_signal_connect(GTK_OBJECT(browser->mozEmbed), "progress",
|
||||
GTK_SIGNAL_FUNC(progress_change_cb), browser);
|
||||
|
@ -397,30 +397,33 @@ load_finished_cb (GtkMozEmbed *embed, TestGtkBrowser *browser)
|
|||
|
||||
|
||||
void
|
||||
net_status_change_cb (GtkMozEmbed *embed, gint flags, TestGtkBrowser *browser)
|
||||
net_state_change_cb (GtkMozEmbed *embed, gint flags, guint status, TestGtkBrowser *browser)
|
||||
{
|
||||
// g_print("net_status_change_cb %d\n", flags);
|
||||
if (flags & GTK_MOZ_EMBED_FLAG_NET_DNS)
|
||||
browser->statusMessage = "Looking up host...";
|
||||
else if (flags & GTK_MOZ_EMBED_FLAG_NET_CONNECTING)
|
||||
browser->statusMessage = "Connecting to site...";
|
||||
else if (flags & GTK_MOZ_EMBED_FLAG_NET_REDIRECTING)
|
||||
browser->statusMessage = "Connecting to site...";
|
||||
else if (flags & GTK_MOZ_EMBED_FLAG_NET_TRANSFERRING)
|
||||
// g_print("net_state_change_cb %d\n", flags);
|
||||
if (flags & GTK_MOZ_EMBED_FLAG_IS_REQUEST) {
|
||||
if (flags & GTK_MOZ_EMBED_FLAG_REDIRECTING)
|
||||
browser->statusMessage = "Redirecting to site...";
|
||||
else if (flags & GTK_MOZ_EMBED_FLAG_TRANSFERRING)
|
||||
browser->statusMessage = "Transferring data from site...";
|
||||
else if (flags & GTK_MOZ_EMBED_FLAG_NET_FAILEDDNS)
|
||||
browser->statusMessage = "Site not found.";
|
||||
else if (flags & GTK_MOZ_EMBED_FLAG_NET_FAILEDCONNECT)
|
||||
browser->statusMessage = "Failed to connect to site.";
|
||||
else if (flags & GTK_MOZ_EMBED_FLAG_NET_FAILEDTRANSFER)
|
||||
browser->statusMessage = "Failed to transfer any data from site.";
|
||||
else if (flags & GTK_MOZ_EMBED_FLAG_NET_USERCANCELLED)
|
||||
browser->statusMessage = "User cancelled connecting to site.";
|
||||
else if (flags & GTK_MOZ_EMBED_FLAG_NEGOTIATING)
|
||||
browser->statusMessage = "Waiting for authorization...";
|
||||
}
|
||||
|
||||
if (flags & GTK_MOZ_EMBED_FLAG_WIN_START)
|
||||
browser->statusMessage = "Loading site...";
|
||||
else if (flags & GTK_MOZ_EMBED_FLAG_WIN_STOP)
|
||||
browser->statusMessage = "Done.";
|
||||
if (status == GTK_MOZ_EMBED_STATUS_FAILED_DNS)
|
||||
browser->statusMessage = "Site not found.";
|
||||
else if (status == GTK_MOZ_EMBED_STATUS_FAILED_CONNECT)
|
||||
browser->statusMessage = "Failed to connect to site.";
|
||||
else if (status == GTK_MOZ_EMBED_STATUS_FAILED_TIMEOUT)
|
||||
browser->statusMessage = "Failed due to connection timeout.";
|
||||
else if (status == GTK_MOZ_EMBED_STATUS_FAILED_USERCANCELED)
|
||||
browser->statusMessage = "User canceled connecting to site.";
|
||||
|
||||
if (flags & GTK_MOZ_EMBED_FLAG_IS_WINDOW) {
|
||||
if (flags & GTK_MOZ_EMBED_FLAG_START)
|
||||
browser->statusMessage = "Loading site...";
|
||||
else if (flags & GTK_MOZ_EMBED_FLAG_STOP)
|
||||
browser->statusMessage = "Done.";
|
||||
}
|
||||
|
||||
update_status_bar_text(browser);
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ NS_IMETHODIMP CBrowserShell::CommonConstruct()
|
|||
NS_ENSURE_TRUE(treeItem, NS_ERROR_FAILURE);
|
||||
mWebBrowserAsTreeItem = treeItem;
|
||||
|
||||
nsCOMPtr<nsIWebProgress> asProgress(do_QueryInterface(mWebBrowser));
|
||||
nsCOMPtr<nsIWebProgress> asProgress(do_GetInterface(mWebBrowser));
|
||||
NS_ENSURE_TRUE(asProgress, NS_ERROR_FAILURE);
|
||||
mWebBrowserAsProgress = asProgress;
|
||||
|
||||
|
|
|
@ -170,35 +170,30 @@ NS_IMETHODIMP CWebBrowserChrome::ShowAsModal(void)
|
|||
// CWebBrowserChrome::nsIWebProgressListener
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP CWebBrowserChrome::OnProgressChange(nsIChannel *channel, PRInt32 curSelfProgress, PRInt32 maxSelfProgress, PRInt32 curTotalProgress, PRInt32 maxTotalProgress)
|
||||
NS_IMETHODIMP CWebBrowserChrome::OnProgressChange(nsIWebProgress *progress, nsIRequest *request,
|
||||
PRInt32 curSelfProgress, PRInt32 maxSelfProgress,
|
||||
PRInt32 curTotalProgress, PRInt32 maxTotalProgress)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CWebBrowserChrome::OnChildProgressChange(nsIChannel *channel, PRInt32 curSelfProgress, PRInt32 curTotalProgress)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CWebBrowserChrome::OnStatusChange(nsIChannel *channel, PRInt32 progressStatusFlags)
|
||||
NS_IMETHODIMP CWebBrowserChrome::OnStateChange(nsIWebProgress *progress, nsIRequest *request,
|
||||
PRInt32 progressStateFlags nsresult status)
|
||||
{
|
||||
NS_ENSURE_TRUE(mBrowserWindow, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
if (progressStatusFlags & nsIWebProgress::flag_net_start)
|
||||
mBrowserWindow->OnStatusNetStart(channel);
|
||||
else if (progressStatusFlags & nsIWebProgress::flag_net_stop)
|
||||
mBrowserWindow->OnStatusNetStop(channel);
|
||||
else if (progressStatusFlags & nsIWebProgress::flag_net_dns)
|
||||
mBrowserWindow->OnStatusDNS(channel);
|
||||
if (progressStateFlags & flag_is_network) {
|
||||
if (progressStateFlags & flag_start)
|
||||
mBrowserWindow->OnStatusNetStart(channel);
|
||||
else if (progressStateFlags & flag_stop)
|
||||
mBrowserWindow->OnStatusNetStop(channel);
|
||||
}
|
||||
/// else if (progressStatusFlags & nsIWebProgress::flag_net_dns)
|
||||
/// mBrowserWindow->OnStatusDNS(channel);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CWebBrowserChrome::OnChildStatusChange(nsIChannel *channel, PRInt32 progressStatusFlags)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP CWebBrowserChrome::OnLocationChange(nsIURI *location)
|
||||
{
|
||||
|
|
|
@ -377,46 +377,38 @@ NS_IMETHODIMP nsDocShellTreeOwner::SetTitle(const PRUnichar* aTitle)
|
|||
// nsDocShellTreeOwner::nsIWebProgressListener
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP nsDocShellTreeOwner::OnProgressChange(nsIChannel* aChannel,
|
||||
PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress,
|
||||
PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress)
|
||||
NS_IMETHODIMP
|
||||
nsDocShellTreeOwner::OnProgressChange(nsIWebProgress* aProgress,
|
||||
nsIRequest* aRequest,
|
||||
PRInt32 aCurSelfProgress,
|
||||
PRInt32 aMaxSelfProgress,
|
||||
PRInt32 aCurTotalProgress,
|
||||
PRInt32 aMaxTotalProgress)
|
||||
{
|
||||
if(!mOwnerProgressListener)
|
||||
return NS_OK;
|
||||
|
||||
return mOwnerProgressListener->OnProgressChange(aChannel,
|
||||
aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress,
|
||||
aMaxTotalProgress);
|
||||
return mOwnerProgressListener->OnProgressChange(aProgress,
|
||||
aRequest,
|
||||
aCurSelfProgress,
|
||||
aMaxSelfProgress,
|
||||
aCurTotalProgress,
|
||||
aMaxTotalProgress);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShellTreeOwner::OnChildProgressChange(nsIChannel* aChannel,
|
||||
PRInt32 aCurChildProgress, PRInt32 aMaxChildProgress)
|
||||
{
|
||||
if(!mOwnerProgressListener)
|
||||
return NS_OK;
|
||||
|
||||
return mOwnerProgressListener->OnChildProgressChange(aChannel,
|
||||
aCurChildProgress, aMaxChildProgress);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShellTreeOwner::OnStatusChange(nsIChannel* aChannel,
|
||||
PRInt32 aProgressStatusFlags)
|
||||
NS_IMETHODIMP
|
||||
nsDocShellTreeOwner::OnStateChange(nsIWebProgress* aProgress,
|
||||
nsIRequest* aRequest,
|
||||
PRInt32 aProgressStateFlags,
|
||||
nsresult aStatus)
|
||||
{
|
||||
if(!mOwnerProgressListener)
|
||||
return NS_OK;
|
||||
|
||||
return mOwnerProgressListener->OnStatusChange(aChannel,
|
||||
aProgressStatusFlags);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShellTreeOwner::OnChildStatusChange(nsIChannel* aChannel,
|
||||
PRInt32 aProgressStatusFlags)
|
||||
{
|
||||
if(!mOwnerProgressListener)
|
||||
return NS_OK;
|
||||
|
||||
return mOwnerProgressListener->OnChildStatusChange(aChannel,
|
||||
aProgressStatusFlags);
|
||||
return mOwnerProgressListener->OnStateChange(aProgress,
|
||||
aRequest,
|
||||
aProgressStateFlags,
|
||||
aStatus);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShellTreeOwner::OnLocationChange(nsIURI* aURI)
|
||||
|
|
|
@ -968,7 +968,7 @@ NS_IMETHODIMP nsWebBrowser::SetDocShell(nsIDocShell* aDocShell)
|
|||
nsCOMPtr<nsIBaseWindow> baseWin(do_QueryInterface(aDocShell));
|
||||
nsCOMPtr<nsIDocShellTreeItem> item(do_QueryInterface(aDocShell));
|
||||
nsCOMPtr<nsIWebNavigation> nav(do_QueryInterface(aDocShell));
|
||||
nsCOMPtr<nsIWebProgress> progress(do_QueryInterface(aDocShell));
|
||||
nsCOMPtr<nsIWebProgress> progress(do_GetInterface(aDocShell));
|
||||
nsCOMPtr<nsIScrollable> scrollable(do_QueryInterface(aDocShell));
|
||||
nsCOMPtr<nsITextScroll> textScroll(do_QueryInterface(aDocShell));
|
||||
NS_ENSURE_TRUE(req && baseWin && item && nav && scrollable && textScroll &&
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "nsIDOMXULDocument.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIChannel.h"
|
||||
|
||||
#define MSGFEEDBACK_TIMER_INTERVAL 500
|
||||
|
||||
|
@ -85,9 +86,13 @@ NS_INTERFACE_MAP_END
|
|||
// nsMsgStatusFeedback::nsIWebProgressListener
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMETHODIMP nsMsgStatusFeedback::OnProgressChange(nsIChannel* aChannel,
|
||||
PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress,
|
||||
PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress)
|
||||
NS_IMETHODIMP
|
||||
nsMsgStatusFeedback::OnProgressChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
PRInt32 aCurSelfProgress,
|
||||
PRInt32 aMaxSelfProgress,
|
||||
PRInt32 aCurTotalProgress,
|
||||
PRInt32 aMaxTotalProgress)
|
||||
{
|
||||
PRInt32 percentage = 0;
|
||||
if (aMaxTotalProgress > 0)
|
||||
|
@ -100,45 +105,39 @@ NS_IMETHODIMP nsMsgStatusFeedback::OnProgressChange(nsIChannel* aChannel,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgStatusFeedback::OnChildProgressChange(nsIChannel* aChannel,
|
||||
PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgStatusFeedback::OnStatusChange(nsIChannel* aChannel,
|
||||
PRInt32 aProgressStatusFlags)
|
||||
NS_IMETHODIMP
|
||||
nsMsgStatusFeedback::OnStateChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
PRInt32 aProgressStateFlags,
|
||||
nsresult aStatus)
|
||||
{
|
||||
nsresult rv;
|
||||
if (aProgressStatusFlags & nsIWebProgress::flag_net_start)
|
||||
if (aProgressStateFlags & flag_is_network)
|
||||
{
|
||||
m_lastPercent = 0;
|
||||
StartMeteors();
|
||||
nsXPIDLString loadingDocument;
|
||||
rv = mBundle->GetStringFromName(NS_ConvertASCIItoUCS2("documentLoading").GetUnicode(),
|
||||
getter_Copies(loadingDocument));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
ShowStatusString(loadingDocument);
|
||||
}
|
||||
else if (aProgressStatusFlags & nsIWebProgress::flag_net_stop)
|
||||
{
|
||||
StopMeteors();
|
||||
nsXPIDLString documentDone;
|
||||
rv = mBundle->GetStringFromName(NS_ConvertASCIItoUCS2("documentDone").GetUnicode(),
|
||||
getter_Copies(documentDone));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
ShowStatusString(documentDone);
|
||||
if (aProgressStateFlags & flag_start)
|
||||
{
|
||||
m_lastPercent = 0;
|
||||
StartMeteors();
|
||||
nsXPIDLString loadingDocument;
|
||||
rv = mBundle->GetStringFromName(NS_ConvertASCIItoUCS2("documentLoading").GetUnicode(),
|
||||
getter_Copies(loadingDocument));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
ShowStatusString(loadingDocument);
|
||||
}
|
||||
else if (aProgressStateFlags & flag_stop)
|
||||
{
|
||||
StopMeteors();
|
||||
nsXPIDLString documentDone;
|
||||
rv = mBundle->GetStringFromName(NS_ConvertASCIItoUCS2("documentDone").GetUnicode(),
|
||||
getter_Copies(documentDone));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
ShowStatusString(documentDone);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgStatusFeedback::OnChildStatusChange(nsIChannel* aChannel,
|
||||
PRInt32 aProgressStatusFlags)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgStatusFeedback::OnLocationChange(nsIURI* aLocation)
|
||||
{
|
||||
return NS_OK;
|
||||
|
@ -336,7 +335,8 @@ nsMsgStatusFeedback::NotifyStopMeteors(nsITimer* aTimer)
|
|||
NS_IMETHODIMP nsMsgStatusFeedback::OnProgress(nsIChannel* channel, nsISupports* ctxt,
|
||||
PRUint32 aProgress, PRUint32 aProgressMax)
|
||||
{
|
||||
return OnProgressChange(channel, aProgress, aProgressMax,
|
||||
// XXX: What should the nsIWebProgress be?
|
||||
return OnProgressChange(nsnull, channel, aProgress, aProgressMax,
|
||||
aProgress /* current total progress */, aProgressMax /* max total progress */);
|
||||
}
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ NS_IMETHODIMP nsMsgWindow::GetStatusFeedback(nsIMsgStatusFeedback * *aStatusFeed
|
|||
NS_IMETHODIMP nsMsgWindow::SetStatusFeedback(nsIMsgStatusFeedback * aStatusFeedback)
|
||||
{
|
||||
|
||||
nsCOMPtr<nsIWebProgress> webProgress(do_QueryInterface(mMessageWindowDocShell));
|
||||
nsCOMPtr<nsIWebProgress> webProgress(do_GetInterface(mMessageWindowDocShell));
|
||||
nsCOMPtr<nsIWebProgressListener> webProgressListener(do_QueryInterface(mStatusFeedback));
|
||||
|
||||
mStatusFeedback = aStatusFeedback;
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -40,6 +40,7 @@
|
|||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
struct nsChannelInfo;
|
||||
|
||||
/****************************************************************************
|
||||
* nsDocLoaderImpl implementation...
|
||||
|
@ -82,7 +83,7 @@ protected:
|
|||
void DocLoaderIsEmpty(nsresult aStatus);
|
||||
|
||||
void FireOnStartDocumentLoad(nsDocLoaderImpl* aLoadInitiator,
|
||||
nsIURI* aURL);
|
||||
nsIChannel* aChannel);
|
||||
|
||||
void FireOnEndDocumentLoad(nsDocLoaderImpl* aLoadInitiator,
|
||||
nsIChannel *aDocChannel,
|
||||
|
@ -94,14 +95,28 @@ protected:
|
|||
void FireOnEndURLLoad(nsDocLoaderImpl* aLoadInitiator,
|
||||
nsIChannel* channel, nsresult aStatus);
|
||||
|
||||
void FireOnProgressChange(nsDocLoaderImpl* aLoadInitiator,
|
||||
nsIChannel* aChannel,
|
||||
PRInt32 aProgress,
|
||||
PRInt32 aProgressMax,
|
||||
PRInt32 aProgressDelta,
|
||||
PRInt32 aTotalProgress,
|
||||
PRInt32 aMaxTotalProgress);
|
||||
|
||||
void FireOnStateChange(nsIWebProgress *aProgress,
|
||||
nsIRequest* aChannel,
|
||||
PRInt32 aStateFlags,
|
||||
nsresult aStatus);
|
||||
|
||||
void doStartDocumentLoad();
|
||||
void doStartURLLoad(nsIChannel *aChannel);
|
||||
void doStopURLLoad(nsIChannel *aChannel, nsresult aStatus);
|
||||
void doStopDocumentLoad(nsIChannel* aChannel, nsresult aStatus);
|
||||
|
||||
// get web progress returns our web progress listener or if
|
||||
// we don't have one, it will look up the doc loader hierarchy
|
||||
// to see if one of our parent doc loaders has one.
|
||||
nsresult GetParentWebProgressListener(nsDocLoaderImpl * aDocLoader, nsIWebProgressListener ** aWebProgres);
|
||||
// if a child doc loader's progress changed, they'll call this method
|
||||
// on their parent docloader. this is so the parent knows to trigger OnProgress
|
||||
// on the progress listener
|
||||
void ChildProgressChange(nsDocLoaderImpl * aDocLoader);
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -113,6 +128,7 @@ protected:
|
|||
|
||||
nsCOMPtr<nsIChannel> mDocumentChannel; // [OWNER] ???compare with document
|
||||
nsVoidArray mDocObservers;
|
||||
nsVoidArray mListenerList;
|
||||
nsISupports* mContainer; // [WEAK] it owns me!
|
||||
|
||||
nsDocLoaderImpl* mParent; // [WEAK]
|
||||
|
@ -132,10 +148,23 @@ protected:
|
|||
// The following member variables are related to the new nsIWebProgress
|
||||
// feedback interfaces that travis cooked up.
|
||||
nsCOMPtr<nsIWebProgressListener> mProgressListener;
|
||||
PRInt32 mProgressStatusFlags;
|
||||
PRInt32 mProgressStateFlags;
|
||||
|
||||
PRInt32 mCurrentSelfProgress;
|
||||
PRInt32 mMaxSelfProgress;
|
||||
|
||||
|
||||
PRInt32 mCurrentTotalProgress;
|
||||
PRInt32 mMaxTotalProgress;
|
||||
|
||||
nsVoidArray mChannelInfoList;
|
||||
|
||||
private:
|
||||
nsresult AddChannelInfo(nsIChannel *aChannel);
|
||||
nsChannelInfo *GetChannelInfo(nsIChannel *aChannel);
|
||||
nsresult ClearChannelInfoList(void);
|
||||
void CalculateMaxProgress(PRInt32 *aMax);
|
||||
/// void DumpChannelInfo(void);
|
||||
|
||||
// used to clear our internal progress state between loads...
|
||||
void ClearInternalProgress();
|
||||
};
|
||||
|
|
|
@ -49,5 +49,7 @@ interface nsIDocumentLoader : nsISupports
|
|||
// this should really be in a private interface as it is only
|
||||
// called between a parent doc loader and it's child.
|
||||
void clearParentDocLoader();
|
||||
|
||||
void fireOnLocationChange(in nsIURI aUri);
|
||||
};
|
||||
|
||||
|
|
|
@ -23,82 +23,83 @@
|
|||
#include "nsISupports.idl"
|
||||
|
||||
/**
|
||||
* The nsIWebProgressListener is the interface implemented by clients wishing to
|
||||
* listen in on a progress object.
|
||||
* The nsIWebProgressListener interface is implemented by clients wishing to
|
||||
* listen in on the progress associated with the loading of documents.
|
||||
*/
|
||||
|
||||
interface nsIRequest;
|
||||
interface nsIWebProgress;
|
||||
interface nsIChannel;
|
||||
interface nsIURI;
|
||||
|
||||
[scriptable, uuid(570F39D1-EFD0-11d3-B093-00A024FFC08C)]
|
||||
interface nsIWebProgressListener : nsISupports
|
||||
{
|
||||
/*
|
||||
Notification of that the progress has changed for the main object we are
|
||||
tracking progress for.
|
||||
/**
|
||||
* Progress state transition bits.
|
||||
* These flags indicate the various states that documents and requests
|
||||
* may transition through as they are being loaded.
|
||||
*/
|
||||
const long flag_start = 0x00000001;
|
||||
const long flag_redirecting = 0x00000002;
|
||||
const long flag_transferring = 0x00000004;
|
||||
const long flag_negotiating = 0x00000008;
|
||||
const long flag_stop = 0x00000010;
|
||||
|
||||
@param channel - The main channel that is loading that we are tracking
|
||||
progress for.
|
||||
|
||||
@param curSelfProgress - The current position of progress. This is
|
||||
between 0 and maxSelfProgress. This is the position of only this
|
||||
progress object. It doesn not include the progress of all children.
|
||||
|
||||
@param maxSelfProgress - The maximum position that progress will go to.
|
||||
This sets a relative position point for the current progress to relate
|
||||
to. This is the max position of only this progress object. It does not
|
||||
include the progress of all the children.
|
||||
|
||||
@param curTotalProgress - The current position of progress for this object
|
||||
and all children added together. This is between 0 and maxTotalProgress.
|
||||
|
||||
@param maxTotalProgress - The maximum position that progress will go to for
|
||||
the max of this progress object and all children. This sets the relative
|
||||
position point for the current progress to relate to.
|
||||
*/
|
||||
void onProgressChange(in nsIChannel channel, in long curSelfProgress,
|
||||
in long maxSelfProgress, in long curTotalProgress,
|
||||
in long maxTotalProgress);
|
||||
|
||||
/*
|
||||
Notification that the progress has changed for a child of the main object
|
||||
we are tracking progress for.
|
||||
|
||||
@param channel - The child channel that we are getting this progress change
|
||||
for.
|
||||
|
||||
@param curChildProgress - The current position of progress. This is
|
||||
between 0 and maxSelfProgress. This is the position of only this
|
||||
child progress object.
|
||||
|
||||
@param maxChildProgress - The maximum position that progress will go to.
|
||||
This sets a relative position point for the current progress to relate
|
||||
to. This is the max position of only this child progress object.
|
||||
*/
|
||||
void onChildProgressChange(in nsIChannel channel, in long curChildProgress,
|
||||
in long maxChildProgress);
|
||||
|
||||
/*
|
||||
Notification that the progress status flags have changed for the main item
|
||||
we are tracking progress for.
|
||||
|
||||
@param channel - The main channel that is loading that we are tracking
|
||||
progress for.
|
||||
@param progressStatusFlags - This is the current progressStatusFlags. This
|
||||
will be one or a combination of the progress status flags.
|
||||
*/
|
||||
void onStatusChange(in nsIChannel channel, in long progressStatusFlags);
|
||||
|
||||
/*
|
||||
Notification that the progress status flags have changed for a child of the
|
||||
main item we are tracking progress for..
|
||||
|
||||
@param channel - The child channel that this status change message is for.
|
||||
@param progressStatusFlags - This is the current progressStatusFlags. This
|
||||
will be one or a combination of the progress status flags.
|
||||
*/
|
||||
void onChildStatusChange(in nsIChannel channel, in long progressStatusFlags);
|
||||
/**
|
||||
* Progress type bits.
|
||||
* These flags indicate whether the transition is occuring on a document
|
||||
* or an individual request within the document.
|
||||
*/
|
||||
const long flag_is_request = 0x00010000;
|
||||
const long flag_is_document = 0x00020000;
|
||||
const long flag_is_network = 0x00040000;
|
||||
const long flag_is_window = 0x00080000;
|
||||
/**
|
||||
* Notification indicating the state has changed for one of the requests
|
||||
* associated with the document loaded.
|
||||
*
|
||||
* @param aWebProgress The nsIWebProgress instance that fired the
|
||||
* notification
|
||||
*
|
||||
* @param aRequest The nsIRequest which has changed state.
|
||||
*
|
||||
* @param aStateFlags Flags indicating the state change.
|
||||
*
|
||||
* @param aStatus Status code for the state change.
|
||||
*/
|
||||
void onStateChange(in nsIWebProgress aWebProgress,
|
||||
in nsIRequest aRequest,
|
||||
in long aStateFlags,
|
||||
in unsigned long aStatus);
|
||||
|
||||
/**
|
||||
* Notification that the progress has changed for one of the requests being
|
||||
* monitored.
|
||||
*
|
||||
* @param aWebProgress The nsIWebProgress instance that fired the
|
||||
* notification
|
||||
*
|
||||
* @param aRequest The nsIRequest that has new progress.
|
||||
*
|
||||
* @param aCurSelfProgress The current progress for aRequest.
|
||||
*
|
||||
* @param aMaxSelfProgress The maximum progress for aRequest. If this
|
||||
* value is not known then -1 is passed.
|
||||
*
|
||||
* @param aCurTotalProgress The current progress for all the requests
|
||||
* being monitored.
|
||||
*
|
||||
* @param aMaxTotalProgress The total progress for all the requests being
|
||||
* monitored. If this value is not known then
|
||||
* -1 is passed.
|
||||
*/
|
||||
void onProgressChange(in nsIWebProgress aWebProgress,
|
||||
in nsIRequest aRequest,
|
||||
in long aCurSelfProgress,
|
||||
in long aMaxSelfProgress,
|
||||
in long aCurTotalProgress,
|
||||
in long aMaxTotalProgress);
|
||||
/*
|
||||
Called when the window being watched changes the location that is currently.
|
||||
This is not when a load is requested, but rather once it is verified that
|
||||
|
|
|
@ -586,19 +586,6 @@ NS_IMETHODIMP nsURILoader::OpenURIVia(nsIChannel * aChannel,
|
|||
nsCOMPtr<nsIInterfaceRequestor> loadCookie;
|
||||
SetupLoadCookie(retargetedWindowContext, getter_AddRefs(loadCookie));
|
||||
|
||||
// every time we do a load, we should reset the progress listener on it...
|
||||
if (loadCookie)
|
||||
{
|
||||
// bind the web progress listener (if there is one) to the web progress
|
||||
// instance of the doc loader..
|
||||
nsCOMPtr<nsIDocumentLoader> docLoader (do_GetInterface(loadCookie));
|
||||
nsCOMPtr<nsIWebProgress> webProgress (do_QueryInterface(docLoader));
|
||||
nsCOMPtr<nsIWebProgressListener> webProgressListener (do_GetInterface(retargetedWindowContext));
|
||||
if (webProgress && webProgressListener)
|
||||
webProgress->AddProgressListener(webProgressListener);
|
||||
}
|
||||
|
||||
|
||||
loader->Init(retargetedWindowContext, aOriginalWindowContext); // Extra Info
|
||||
|
||||
// now instruct the loader to go ahead and open the url
|
||||
|
|
|
@ -402,6 +402,7 @@ nsWebShell::~nsWebShell()
|
|||
mDocLoader->Stop();
|
||||
mDocLoader->RemoveObserver((nsIDocumentLoaderObserver*)this);
|
||||
mDocLoader->SetContainer(nsnull);
|
||||
mDocLoader->Destroy();
|
||||
NS_RELEASE(mDocLoader);
|
||||
}
|
||||
// Cancel any timers that were set for this loader.
|
||||
|
@ -1138,7 +1139,7 @@ nsWebShell::OnEndDocumentLoad(nsIDocumentLoader* loader,
|
|||
during this load handler. */
|
||||
nsCOMPtr<nsIWebShell> kungFuDeathGrip(this);
|
||||
|
||||
if(mScriptGlobal && !mEODForCurrentDocument)
|
||||
if(mScriptGlobal && !mEODForCurrentDocument && NS_SUCCEEDED(aStatus))
|
||||
{
|
||||
if(mContentViewer)
|
||||
{
|
||||
|
|
|
@ -45,6 +45,8 @@ nsWebBrowserChrome::nsWebBrowserChrome() : mBrowserWindow(nsnull), mTimerSet(PR_
|
|||
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
mActiveDocuments = 0;
|
||||
}
|
||||
|
||||
nsWebBrowserChrome::~nsWebBrowserChrome()
|
||||
|
@ -343,51 +345,84 @@ NS_IMETHODIMP nsWebBrowserChrome::SetTitle(const PRUnichar* aTitle)
|
|||
// nsWebBrowserChrome::nsIWebProgressListener
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP nsWebBrowserChrome::OnProgressChange(nsIChannel* aChannel,
|
||||
PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress,
|
||||
PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress)
|
||||
NS_IMETHODIMP
|
||||
nsWebBrowserChrome::OnProgressChange(nsIWebProgress* aProgress,
|
||||
nsIRequest* aRequest,
|
||||
PRInt32 aCurSelfProgress,
|
||||
PRInt32 aMaxSelfProgress,
|
||||
PRInt32 aCurTotalProgress,
|
||||
PRInt32 aMaxTotalProgress)
|
||||
{
|
||||
mProgress = aCurTotalProgress;
|
||||
mMaxProgress = aMaxTotalProgress;
|
||||
if(mBrowserWindow->mStatus) {
|
||||
nsAutoString buf;
|
||||
PRUint32 size;
|
||||
|
||||
buf.AppendWithConversion("Loaded ");
|
||||
buf.AppendInt(mCurrent);
|
||||
buf.AppendWithConversion(" of ");
|
||||
buf.AppendInt(mTotal);
|
||||
buf.AppendWithConversion(" items. (");
|
||||
buf.AppendInt(mProgress);
|
||||
buf.AppendWithConversion(" bytes of ");
|
||||
buf.AppendInt(mMaxProgress);
|
||||
buf.AppendWithConversion(" bytes)");
|
||||
|
||||
mBrowserWindow->mStatus->SetText(buf,size);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowserChrome::OnChildProgressChange(nsIChannel* aChannel,
|
||||
PRInt32 aCurChildProgress, PRInt32 aMaxChildProgress)
|
||||
NS_IMETHODIMP
|
||||
nsWebBrowserChrome::OnStateChange(nsIWebProgress* aProgress,
|
||||
nsIRequest* aRequest,
|
||||
PRInt32 aProgressStateFlags,
|
||||
nsresult aStatus)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowserChrome::OnStatusChange(nsIChannel* aChannel,
|
||||
PRInt32 aProgressStatusFlags)
|
||||
{
|
||||
if(aProgressStatusFlags & nsIWebProgress::flag_net_start)
|
||||
OnLoadStart(aChannel);
|
||||
else if(aProgressStatusFlags & nsIWebProgress::flag_net_stop)
|
||||
OnLoadFinished(aChannel, aProgressStatusFlags);
|
||||
else if(aProgressStatusFlags & nsIWebProgress::flag_net_dns)
|
||||
OnStatusDNS(aChannel);
|
||||
else if(aProgressStatusFlags & nsIWebProgress::flag_net_connecting)
|
||||
OnStatusConnecting(aChannel);
|
||||
else if(aProgressStatusFlags & nsIWebProgress::flag_net_redirecting)
|
||||
OnStatusRedirecting(aChannel);
|
||||
else if(aProgressStatusFlags & nsIWebProgress::flag_net_negotiating)
|
||||
OnStatusNegotiating(aChannel);
|
||||
else if(aProgressStatusFlags & nsIWebProgress::flag_net_transferring)
|
||||
OnStatusTransferring(aChannel);
|
||||
|
||||
if(aProgressStatusFlags & nsIWebProgress::flag_win_start)
|
||||
if (aProgressStateFlags & flag_start) {
|
||||
if (aProgressStateFlags & flag_is_network) {
|
||||
OnWindowActivityStart();
|
||||
else if(aProgressStatusFlags & nsIWebProgress::flag_win_stop)
|
||||
OnLoadStart(aRequest);
|
||||
}
|
||||
if (aProgressStateFlags & flag_is_request) {
|
||||
mTotal += 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (aProgressStateFlags & flag_stop) {
|
||||
if (aProgressStateFlags & flag_is_request) {
|
||||
mCurrent += 1;
|
||||
|
||||
if(mBrowserWindow->mStatus) {
|
||||
nsAutoString buf;
|
||||
PRUint32 size;
|
||||
|
||||
buf.AppendWithConversion("Loaded ");
|
||||
buf.AppendInt(mCurrent);
|
||||
buf.AppendWithConversion(" of ");
|
||||
buf.AppendInt(mTotal);
|
||||
buf.AppendWithConversion(" items. (");
|
||||
buf.AppendInt(mProgress);
|
||||
buf.AppendWithConversion(" bytes of ");
|
||||
buf.AppendInt(mMaxProgress);
|
||||
buf.AppendWithConversion(" bytes)");
|
||||
|
||||
mBrowserWindow->mStatus->SetText(buf,size);
|
||||
}
|
||||
}
|
||||
|
||||
if (aProgressStateFlags & flag_is_network) {
|
||||
OnLoadFinished(aRequest, aProgressStateFlags);
|
||||
OnWindowActivityFinished();
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
if (aProgressStateFlags & flag_transferring) {
|
||||
OnStatusTransferring(aRequest);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowserChrome::OnChildStatusChange(nsIChannel* aChannel,
|
||||
PRInt32 aProgressStatusFlags)
|
||||
{
|
||||
//XXXTAB Implement
|
||||
NS_ERROR("NotYetImplemented");
|
||||
return NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWebBrowserChrome::OnLocationChange(nsIURI* aURI)
|
||||
|
@ -430,17 +465,20 @@ nsBrowserWindow* nsWebBrowserChrome::BrowserWindow()
|
|||
// nsWebBrowserChrome: Status Change Handling
|
||||
//*****************************************************************************
|
||||
|
||||
void nsWebBrowserChrome::OnLoadStart(nsIChannel* aChannel)
|
||||
void nsWebBrowserChrome::OnLoadStart(nsIRequest* aRequest)
|
||||
{
|
||||
mBrowserWindow->mLoadStartTime = PR_Now();
|
||||
mCurrent=mTotal=mProgress=mMaxProgress=0;
|
||||
|
||||
if(mBrowserWindow->mThrobber)
|
||||
mBrowserWindow->mThrobber->Start();
|
||||
mBrowserWindow->mLoadStartTime = PR_Now();
|
||||
|
||||
if (aChannel) {
|
||||
if (aRequest) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
aChannel->GetURI(getter_AddRefs(uri));
|
||||
channel = do_QueryInterface(aRequest, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
channel->GetURI(getter_AddRefs(uri));
|
||||
|
||||
#ifdef MOZ_PERF_METRICS
|
||||
if (PR_FALSE == mTimerSet) {
|
||||
|
@ -458,8 +496,7 @@ void nsWebBrowserChrome::OnLoadStart(nsIChannel* aChannel)
|
|||
}
|
||||
#endif
|
||||
|
||||
if(mBrowserWindow->mStatus)
|
||||
{
|
||||
if(mBrowserWindow->mStatus) {
|
||||
nsXPIDLCString uriString;
|
||||
|
||||
uri->GetSpec(getter_Copies(uriString));
|
||||
|
@ -468,15 +505,16 @@ void nsWebBrowserChrome::OnLoadStart(nsIChannel* aChannel)
|
|||
url.AppendWithConversion(": start");
|
||||
PRUint32 size;
|
||||
mBrowserWindow->mStatus->SetText(url,size);
|
||||
}
|
||||
} // if (aChannel)
|
||||
}
|
||||
}
|
||||
} // if (aChannel)
|
||||
}
|
||||
|
||||
void nsWebBrowserChrome::OnLoadFinished(nsIChannel* aChannel,
|
||||
PRInt32 aProgressStatusFlags)
|
||||
void nsWebBrowserChrome::OnLoadFinished(nsIRequest* aRequest,
|
||||
PRInt32 aProgressStatusFlags)
|
||||
{
|
||||
#ifdef MOZ_PERF_METRICS
|
||||
if ( (aProgressStatusFlags & nsIWebProgress::flag_win_stop) && mTimerSet ) {
|
||||
if ( /*(aProgressStatusFlags & nsIWebProgress::flag_win_stop) && */mTimerSet ) {
|
||||
MOZ_TIMER_DEBUGLOG(("Stop: nsWebShell::OnEndDocumentLoad(), this=%p\n", this));
|
||||
MOZ_TIMER_STOP(mTotalTime);
|
||||
MOZ_TIMER_LOG(("Total (Layout + Page Load) Time (webBrowserChrome=%p): ", this));
|
||||
|
@ -485,37 +523,40 @@ void nsWebBrowserChrome::OnLoadFinished(nsIChannel* aChannel,
|
|||
}
|
||||
#endif
|
||||
|
||||
nsXPIDLCString uriString;
|
||||
if(aChannel)
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
aChannel->GetURI(getter_AddRefs(uri));
|
||||
nsXPIDLCString uriString;
|
||||
if(aRequest) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
|
||||
channel = do_QueryInterface(channel, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
channel->GetURI(getter_AddRefs(uri));
|
||||
|
||||
uri->GetSpec(getter_Copies(uriString));
|
||||
}
|
||||
|
||||
nsAutoString msg; msg.AssignWithConversion(uriString);
|
||||
}
|
||||
}
|
||||
nsAutoString msg; msg.AssignWithConversion(uriString);
|
||||
|
||||
PRTime endLoadTime = PR_Now();
|
||||
if(mBrowserWindow->mShowLoadTimes)
|
||||
{
|
||||
printf("Loading ");
|
||||
fputs(msg, stdout);
|
||||
PRTime delta;
|
||||
LL_SUB(delta, endLoadTime, mBrowserWindow->mLoadStartTime);
|
||||
double usecs;
|
||||
LL_L2D(usecs, delta);
|
||||
printf(" took %g milliseconds\n", usecs / 1000.0);
|
||||
}
|
||||
if(mBrowserWindow->mThrobber)
|
||||
mBrowserWindow->mThrobber->Stop();
|
||||
if(mBrowserWindow->mStatus)
|
||||
{
|
||||
PRUint32 size;
|
||||
PRTime endLoadTime = PR_Now();
|
||||
if(mBrowserWindow->mShowLoadTimes)
|
||||
{
|
||||
printf("Loading ");
|
||||
fputs(msg, stdout);
|
||||
PRTime delta;
|
||||
LL_SUB(delta, endLoadTime, mBrowserWindow->mLoadStartTime);
|
||||
double usecs;
|
||||
LL_L2D(usecs, delta);
|
||||
printf(" took %g milliseconds\n", usecs / 1000.0);
|
||||
}
|
||||
|
||||
msg.AppendWithConversion(" done.");
|
||||
if(mBrowserWindow->mStatus)
|
||||
{
|
||||
PRUint32 size;
|
||||
|
||||
mBrowserWindow->mStatus->SetText(msg, size);
|
||||
msg.AppendWithConversion(" done.");
|
||||
|
||||
/// mBrowserWindow->mStatus->SetText(msg, size);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -549,14 +590,20 @@ void nsWebBrowserChrome::OnStatusNegotiating(nsIChannel* aChannel)
|
|||
{
|
||||
}
|
||||
|
||||
void nsWebBrowserChrome::OnStatusTransferring(nsIChannel* aChannel)
|
||||
void nsWebBrowserChrome::OnStatusTransferring(nsIRequest* aRequest)
|
||||
{
|
||||
}
|
||||
|
||||
void nsWebBrowserChrome::OnWindowActivityStart()
|
||||
{
|
||||
if(mBrowserWindow->mThrobber)
|
||||
mBrowserWindow->mThrobber->Start();
|
||||
|
||||
}
|
||||
|
||||
void nsWebBrowserChrome::OnWindowActivityFinished()
|
||||
{
|
||||
if(mBrowserWindow->mThrobber)
|
||||
mBrowserWindow->mThrobber->Stop();
|
||||
|
||||
}
|
||||
|
|
|
@ -59,13 +59,13 @@ protected:
|
|||
nsBrowserWindow* BrowserWindow();
|
||||
|
||||
// Status Change Handling
|
||||
void OnLoadStart(nsIChannel* aChannel);
|
||||
void OnLoadFinished(nsIChannel* aChannel, PRInt32 aProgressStatusFlags);
|
||||
void OnLoadStart(nsIRequest* aRequest);
|
||||
void OnLoadFinished(nsIRequest* aRequest, PRInt32 aProgressStatusFlags);
|
||||
void OnStatusDNS(nsIChannel* aChannel);
|
||||
void OnStatusConnecting(nsIChannel* aChannel);
|
||||
void OnStatusRedirecting(nsIChannel* aChannel);
|
||||
void OnStatusNegotiating(nsIChannel* aChannel);
|
||||
void OnStatusTransferring(nsIChannel* aChannel);
|
||||
void OnStatusTransferring(nsIRequest* aRequest);
|
||||
void OnWindowActivityStart();
|
||||
void OnWindowActivityFinished();
|
||||
|
||||
|
@ -74,6 +74,9 @@ protected:
|
|||
|
||||
PRBool mTimerSet;
|
||||
MOZ_TIMER_DECLARE(mTotalTime)
|
||||
|
||||
PRInt32 mActiveDocuments;
|
||||
PRInt32 mCurrent, mTotal, mProgress, mMaxProgress;
|
||||
};
|
||||
|
||||
#endif /* nsWebBrowserChrome_h__ */
|
||||
|
|
|
@ -317,27 +317,22 @@ NS_IMETHODIMP nsChromeTreeOwner::SetTitle(const PRUnichar* aTitle)
|
|||
// nsChromeTreeOwner::nsIWebProgressListener
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP nsChromeTreeOwner::OnProgressChange(nsIChannel* aChannel,
|
||||
PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress,
|
||||
PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress)
|
||||
NS_IMETHODIMP
|
||||
nsChromeTreeOwner::OnProgressChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
PRInt32 aCurSelfProgress,
|
||||
PRInt32 aMaxSelfProgress,
|
||||
PRInt32 aCurTotalProgress,
|
||||
PRInt32 aMaxTotalProgress)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsChromeTreeOwner::OnChildProgressChange(nsIChannel* aChannel,
|
||||
PRInt32 aCurChildProgress, PRInt32 aMaxChildProgress)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsChromeTreeOwner::OnStatusChange(nsIChannel* aChannel,
|
||||
PRInt32 aProgressStatusFlags)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsChromeTreeOwner::OnChildStatusChange(nsIChannel* aChannel,
|
||||
PRInt32 aProgressStatusFlags)
|
||||
NS_IMETHODIMP
|
||||
nsChromeTreeOwner::OnStateChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
PRInt32 aProgressStateFlags,
|
||||
nsresult aStatus)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -62,6 +62,9 @@ catch (ex)
|
|||
var backButton = null;
|
||||
var forwardButton = null;
|
||||
|
||||
var useRealProgressFlag = false;
|
||||
var totalRequests = 0;
|
||||
var finishedRequests = 0;
|
||||
///////////////////////////// DOCUMENT SAVE ///////////////////////////////////
|
||||
|
||||
// focused frame URL
|
||||
|
@ -255,8 +258,12 @@ nsXULBrowserWindow.prototype =
|
|||
if(!statusMeter)
|
||||
statusMeter = document.getElementById("statusbar-icon");
|
||||
var percentage = 0;
|
||||
if (max > 0)
|
||||
{
|
||||
|
||||
if (!useRealProgressFlag && (channel != null)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (max > 0) {
|
||||
percentage = (current * 100) / max ;
|
||||
if (statusMeter.getAttribute("mode") != "normal")
|
||||
statusMeter.setAttribute("mode", "normal");
|
||||
|
@ -279,60 +286,70 @@ nsXULBrowserWindow.prototype =
|
|||
if(!stopMenu)
|
||||
stopMenu = document.getElementById("menuitem-stop");
|
||||
|
||||
if(status & Components.interfaces.nsIWebProgress.flag_net_start)
|
||||
{
|
||||
// Remember when loading commenced.
|
||||
startTime = (new Date()).getTime();
|
||||
// Turn progress meter on.
|
||||
statusMeter.setAttribute("mode","undetermined");
|
||||
throbberElement.setAttribute("busy", true);
|
||||
}
|
||||
else if(status & Components.interfaces.nsIWebProgress.flag_net_stop)
|
||||
{
|
||||
// Record page loading time.
|
||||
var elapsed = ( (new Date()).getTime() - startTime ) / 1000;
|
||||
var msg = bundle.GetStringFromName("nv_done") + " (" + elapsed + " secs)";
|
||||
dump( msg + "\n" );
|
||||
defaultStatus = msg;
|
||||
UpdateStatusField();
|
||||
window.XULBrowserWindow.setDefaultStatus(msg);
|
||||
// Turn progress meter off.
|
||||
statusMeter.setAttribute("mode","normal");
|
||||
statusMeter.value = 0; // be sure to clear the progress bar
|
||||
statusMeter.progresstext = "";
|
||||
throbberElement.setAttribute("busy", false);
|
||||
}
|
||||
else if(status & Components.interfaces.nsIWebProgress.flag_net_dns)
|
||||
{
|
||||
alert("XXX: Not yet Implemented (navigator.js dns network step.");
|
||||
}
|
||||
else if(status & Components.interfaces.nsIWebProgress.flag_net_connecting)
|
||||
{
|
||||
alert("XXX: Not yet Implemented (navigator.js connecting network step.");
|
||||
}
|
||||
else if(status & Components.interfaces.nsIWebProgress.flag_net_transferring)
|
||||
{
|
||||
alert("XXX: Not yet Implemented (navigator.js transferring network step.");
|
||||
}
|
||||
else if(status & Components.interfaces.nsIWebProgress.flag_net_redirecting)
|
||||
{
|
||||
alert("XXX: Not yet Implemented (navigator.js redirecting network step.");
|
||||
}
|
||||
else if(status & Components.interfaces.nsIWebProgress.flag_net_negotiating)
|
||||
{
|
||||
alert("XXX: Not yet Implemented (navigator.js negotiating network step.");
|
||||
}
|
||||
if (status & Components.interfaces.nsIWebProgressListener.flag_start) {
|
||||
if(status & Components.interfaces.nsIWebProgressListener.flag_is_network) {
|
||||
// Remember when loading commenced.
|
||||
startTime = (new Date()).getTime();
|
||||
// Turn progress meter on.
|
||||
statusMeter.setAttribute("mode","undetermined");
|
||||
throbberElement.setAttribute("busy", true);
|
||||
|
||||
// XXX: These need to be based on window activity...
|
||||
stopButton.setAttribute("disabled", false);
|
||||
stopMenu.setAttribute("disabled", false);
|
||||
|
||||
// Initialize the progress stuff...
|
||||
statusMeter.setAttribute("mode","undetermined");
|
||||
useRealProgressFlag = false;
|
||||
totalRequests = 0;
|
||||
finishedRequests = 0;
|
||||
}
|
||||
if (status & Components.interfaces.nsIWebProgressListener.flag_is_request) {
|
||||
totalRequests += 1;
|
||||
}
|
||||
}
|
||||
else if (status & Components.interfaces.nsIWebProgressListener.flag_stop) {
|
||||
if (status & Components.interfaces.nsIWebProgressListener.flag_is_request) {
|
||||
finishedRequests += 1;
|
||||
if (!useRealProgressFlag) {
|
||||
this.onProgress(null, finishedRequests, totalRequests);
|
||||
}
|
||||
}
|
||||
if(status & Components.interfaces.nsIWebProgressListener.flag_is_network) {
|
||||
// Record page loading time.
|
||||
var elapsed = ( (new Date()).getTime() - startTime ) / 1000;
|
||||
var msg = bundle.GetStringFromName("nv_done") + " (" + elapsed + " secs)";
|
||||
dump( msg + "\n" );
|
||||
defaultStatus = msg;
|
||||
UpdateStatusField();
|
||||
window.XULBrowserWindow.setDefaultStatus(msg);
|
||||
// Turn progress meter off.
|
||||
statusMeter.setAttribute("mode","normal");
|
||||
statusMeter.value = 0; // be sure to clear the progress bar
|
||||
statusMeter.progresstext = "";
|
||||
throbberElement.setAttribute("busy", false);
|
||||
|
||||
// XXX: These need to be based on window activity...
|
||||
stopButton.setAttribute("disabled", true);
|
||||
stopMenu.setAttribute("disabled", true);
|
||||
}
|
||||
}
|
||||
else if (status & Components.interfaces.nsIWebProgressListener.flag_transferring) {
|
||||
if (status & Components.interfaces.nsIWebProgressListener.flag_is_document) {
|
||||
var ctype=channel.contentType;
|
||||
|
||||
if (ctype != "text/html") {
|
||||
useRealProgressFlag = true;
|
||||
}
|
||||
statusMeter.setAttribute("mode", "normal");
|
||||
}
|
||||
if (status & Components.interfaces.nsIWebProgressListener.flag_is_request) {
|
||||
if (!useRealProgressFlag) {
|
||||
this.onProgress(null, finishedRequests, totalRequests);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(status & Components.interfaces.nsIWebProgress.flag_win_start)
|
||||
{
|
||||
stopButton.setAttribute("disabled", false);
|
||||
stopMenu.setAttribute("disabled", false);
|
||||
}
|
||||
else if(status & Components.interfaces.nsIWebProgress.flag_win_stop)
|
||||
{
|
||||
stopButton.setAttribute("disabled", true);
|
||||
stopMenu.setAttribute("disabled", true);
|
||||
}
|
||||
},
|
||||
onLocationChange : function(location)
|
||||
{
|
||||
|
|
|
@ -941,7 +941,7 @@ nsBrowserInstance::SetContentWindow(nsIDOMWindow* aWin)
|
|||
mContentAreaDocShellWeak = getter_AddRefs(NS_GetWeakReference(docShell)); // Weak reference
|
||||
docShell->SetDocLoaderObserver((nsIDocumentLoaderObserver *)this);
|
||||
|
||||
nsCOMPtr<nsIWebProgress> webProgress(do_QueryInterface(docShell));
|
||||
nsCOMPtr<nsIWebProgress> webProgress(do_GetInterface(docShell));
|
||||
webProgress->AddProgressListener(NS_STATIC_CAST(nsIWebProgressListener*, this));
|
||||
nsCOMPtr<nsISHistory> sessionHistory(do_CreateInstance(NS_SHISTORY_PROGID));
|
||||
nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(docShell));
|
||||
|
@ -1633,35 +1633,44 @@ nsBrowserInstance::SetLoadCookie(nsISupports * aLoadCookie)
|
|||
// nsBrowserInstance::nsIWebProgressListener
|
||||
//*****************************************************************************
|
||||
|
||||
NS_IMETHODIMP nsBrowserInstance::OnProgressChange(nsIChannel* aChannel,
|
||||
PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress,
|
||||
PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress)
|
||||
NS_IMETHODIMP
|
||||
nsBrowserInstance::OnProgressChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
PRInt32 aCurSelfProgress,
|
||||
PRInt32 aMaxSelfProgress,
|
||||
PRInt32 aCurTotalProgress,
|
||||
PRInt32 aMaxTotalProgress)
|
||||
{
|
||||
EnsureXULBrowserWindow();
|
||||
if(mXULBrowserWindow)
|
||||
mXULBrowserWindow->OnProgress(aChannel, aCurTotalProgress, aMaxTotalProgress);
|
||||
return NS_OK;
|
||||
EnsureXULBrowserWindow();
|
||||
if(mXULBrowserWindow) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
|
||||
channel = do_QueryInterface(aRequest, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mXULBrowserWindow->OnProgress(channel, aCurTotalProgress, aMaxTotalProgress);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsBrowserInstance::OnChildProgressChange(nsIChannel* aChannel,
|
||||
PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress)
|
||||
NS_IMETHODIMP
|
||||
nsBrowserInstance::OnStateChange(nsIWebProgress* aWebProgress,
|
||||
nsIRequest* aRequest,
|
||||
PRInt32 aProgressStateFlags,
|
||||
nsresult aStatus)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
EnsureXULBrowserWindow();
|
||||
if(mXULBrowserWindow) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
|
||||
NS_IMETHODIMP nsBrowserInstance::OnStatusChange(nsIChannel* aChannel,
|
||||
PRInt32 aProgressStatusFlags)
|
||||
{
|
||||
EnsureXULBrowserWindow();
|
||||
if(mXULBrowserWindow)
|
||||
mXULBrowserWindow->OnStatusChange(aChannel, aProgressStatusFlags);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsBrowserInstance::OnChildStatusChange(nsIChannel* aChannel,
|
||||
PRInt32 aProgressStatusFlags)
|
||||
{
|
||||
return NS_OK;
|
||||
channel = do_QueryInterface(aRequest, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mXULBrowserWindow->OnStatusChange(channel, aProgressStateFlags);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsBrowserInstance::OnLocationChange(nsIURI* aLocation)
|
||||
|
|
Загрузка…
Ссылка в новой задаче