diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index 257d8ecf141..b5f7a92cff9 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -57,6 +57,7 @@ #include "nsIHTTPChannel.h" #include "nsIDataChannel.h" #include "nsIProgressEventSink.h" +#include "nsIWebProgress.h" #include "nsILayoutHistoryState.h" #include "nsILocaleService.h" #include "nsIPlatformCharset.h" @@ -138,6 +139,7 @@ NS_INTERFACE_MAP_BEGIN(nsDocShell) NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor) NS_INTERFACE_MAP_ENTRY(nsIScriptGlobalObjectOwner) NS_INTERFACE_MAP_ENTRY(nsIRefreshURI) + NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener) NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) NS_INTERFACE_MAP_END_THREADSAFE @@ -775,7 +777,7 @@ NS_IMETHODIMP nsDocShell::SetTreeOwner(nsIDocShellTreeOwner* aTreeOwner) { // Don't automatically set the progress based on the tree owner for frames if (!IsFrame()) { - nsCOMPtr webProgress(do_GetInterface(mLoadCookie)); + nsCOMPtr webProgress(do_QueryInterface(mLoadCookie)); if (webProgress) { nsCOMPtr oldListener(do_QueryInterface(mTreeOwner)); @@ -1261,9 +1263,10 @@ NS_IMETHODIMP nsDocShell::Destroy() mScriptGlobal = nsnull; mScriptContext = nsnull; mSessionHistory = nsnull; - mLoadCookie = nsnull; SetTreeOwner(nsnull); + SetLoadCookie(nsnull); + if(mInitInfo) { delete mInitInfo; @@ -2020,6 +2023,31 @@ NS_IMETHODIMP nsDocShell::Embed(nsIContentViewer* aContentViewer, return SetupNewViewer(aContentViewer); } +//***************************************************************************** +// nsDocShell::nsIWebProgressListener +//***************************************************************************** + +NS_IMETHODIMP +nsDocShell::OnProgressChange(nsIWebProgress *aProgress, nsIRequest *aRequest, + PRInt32 aCurSelfProgress, PRInt32 aMaxSelfProgress, + PRInt32 aCurTotalProgress, PRInt32 aMaxTotalProgress) +{ + return NS_OK; +} + +NS_IMETHODIMP +nsDocShell::OnStateChange(nsIWebProgress *aProgress, nsIRequest *aRequest, + PRInt32 aStateFlags, nsresult aStatus) +{ + return NS_OK; +} + +NS_IMETHODIMP +nsDocShell::OnLocationChange(nsIURI *aURI) +{ + return NS_OK; +} + //***************************************************************************** // nsDocShell: Content Viewer Management //***************************************************************************** @@ -3163,6 +3191,40 @@ NS_IMETHODIMP nsDocShell::UpdateCurrentGlobalHistory() // nsDocShell: Helper Routines //***************************************************************************** +nsresult nsDocShell::SetLoadCookie(nsISupports *aCookie) +{ + // Remove the DocShell as a listener of the old WebProgress... + if (mLoadCookie) { + nsCOMPtr webProgress(do_QueryInterface(mLoadCookie)); + + if (webProgress) { + webProgress->RemoveProgressListener(this); + } + } + + mLoadCookie = aCookie; + + // Add the DocShell as a listener to the new WebProgress... + if (mLoadCookie) { + nsCOMPtr webProgress(do_QueryInterface(mLoadCookie)); + + if (webProgress) { + webProgress->AddProgressListener(this); + } + } + return NS_OK; +} + + +nsresult nsDocShell::GetLoadCookie(nsISupports **aResult) +{ + *aResult = mLoadCookie; + NS_IF_ADDREF(*aResult); + + return NS_OK; +} + + nsDocShellInitInfo* nsDocShell::InitInfo() { if(mInitInfo) diff --git a/mozilla/docshell/base/nsDocShell.h b/mozilla/docshell/base/nsDocShell.h index e829c9e79db..e703dfce01f 100644 --- a/mozilla/docshell/base/nsDocShell.h +++ b/mozilla/docshell/base/nsDocShell.h @@ -64,7 +64,6 @@ #include "nsISupportsArray.h" #include "nsITimerCallback.h" #include "nsIWebNavigation.h" -#include "nsIWebProgress.h" #include "nsIWebProgressListener.h" //***************************************************************************** @@ -119,10 +118,10 @@ class nsDocShell : public nsIDocShell, public nsIInterfaceRequestor, public nsIScriptGlobalObjectOwner, public nsIRefreshURI, + public nsIWebProgressListener, public nsSupportsWeakReference { friend class nsDSURIContentListener; -friend class nsDSWebProgressListener; public: // Object Management @@ -139,6 +138,7 @@ public: NS_DECL_NSITEXTSCROLL NS_DECL_NSIINTERFACEREQUESTOR NS_DECL_NSISCRIPTGLOBALOBJECTOWNER + NS_DECL_NSIWEBPROGRESSLISTENER // nsIRefreshURI NS_IMETHOD RefreshURI(nsIURI *aURI, PRInt32 aDelay, PRBool aRepeat); @@ -151,6 +151,9 @@ public: nsISupports* aExtraInfo); + nsresult SetLoadCookie(nsISupports *aCookie); + nsresult GetLoadCookie(nsISupports **aResult); + protected: // Object Management virtual ~nsDocShell();