diff --git a/mozilla/docshell/base/nsWebShell.cpp b/mozilla/docshell/base/nsWebShell.cpp index adf9417e33d..13d6e9c0151 100644 --- a/mozilla/docshell/base/nsWebShell.cpp +++ b/mozilla/docshell/base/nsWebShell.cpp @@ -95,6 +95,7 @@ public: NS_IMETHOD Init(nsNativeWidget aNativeParent, const nsRect& aBounds, nsScrollPreference aScrolling = nsScrollPreference_kAuto); + NS_IMETHOD Destroy(void); NS_IMETHOD GetBounds(nsRect& aResult); NS_IMETHOD SetBounds(const nsRect& aBounds); NS_IMETHOD MoveTo(PRInt32 aX, PRInt32 aY); @@ -455,16 +456,33 @@ nsWebShell::Init(nsNativeWidget aNativeParent, NS_RELEASE(mInnerWindow); } else { - // Get rid of extra reference count - mWindow->Release(); mWindow->Create(aNativeParent, aBounds, nsWebShell::HandleEvent, mDeviceContext, nsnull); + // Get rid of extra reference count + mWindow->Release(); } done: return rv; } +NS_IMETHODIMP +nsWebShell::Destroy() +{ + nsresult rv = NS_OK; + + // Stop any URLs that are currently being loaded... + mDocLoader->Stop(); + + SetContainer(nsnull); + SetObserver(nsnull); + + NS_IF_RELEASE(mContentViewer); + + return rv; +} + + NS_IMETHODIMP nsWebShell::GetBounds(nsRect& aResult) { diff --git a/mozilla/webshell/public/nsIWebShell.h b/mozilla/webshell/public/nsIWebShell.h index f9a54f4f807..3a193d2a31c 100644 --- a/mozilla/webshell/public/nsIWebShell.h +++ b/mozilla/webshell/public/nsIWebShell.h @@ -86,6 +86,8 @@ public: const nsRect& aBounds, nsScrollPreference aScrolling = nsScrollPreference_kAuto)=0; + NS_IMETHOD Destroy() = 0; + NS_IMETHOD GetBounds(nsRect& aResult) = 0; NS_IMETHOD SetBounds(const nsRect& aBounds) = 0; diff --git a/mozilla/webshell/src/nsWebShell.cpp b/mozilla/webshell/src/nsWebShell.cpp index adf9417e33d..13d6e9c0151 100644 --- a/mozilla/webshell/src/nsWebShell.cpp +++ b/mozilla/webshell/src/nsWebShell.cpp @@ -95,6 +95,7 @@ public: NS_IMETHOD Init(nsNativeWidget aNativeParent, const nsRect& aBounds, nsScrollPreference aScrolling = nsScrollPreference_kAuto); + NS_IMETHOD Destroy(void); NS_IMETHOD GetBounds(nsRect& aResult); NS_IMETHOD SetBounds(const nsRect& aBounds); NS_IMETHOD MoveTo(PRInt32 aX, PRInt32 aY); @@ -455,16 +456,33 @@ nsWebShell::Init(nsNativeWidget aNativeParent, NS_RELEASE(mInnerWindow); } else { - // Get rid of extra reference count - mWindow->Release(); mWindow->Create(aNativeParent, aBounds, nsWebShell::HandleEvent, mDeviceContext, nsnull); + // Get rid of extra reference count + mWindow->Release(); } done: return rv; } +NS_IMETHODIMP +nsWebShell::Destroy() +{ + nsresult rv = NS_OK; + + // Stop any URLs that are currently being loaded... + mDocLoader->Stop(); + + SetContainer(nsnull); + SetObserver(nsnull); + + NS_IF_RELEASE(mContentViewer); + + return rv; +} + + NS_IMETHODIMP nsWebShell::GetBounds(nsRect& aResult) {