From 2f4d8826cbc5ace628201910ff884762977b46e3 Mon Sep 17 00:00:00 2001 From: "rpotts%netscape.com" Date: Wed, 29 Jul 1998 10:49:01 +0000 Subject: [PATCH] Added a Destroy() method which is called when the WebShell container is going away... git-svn-id: svn://10.0.0.236/trunk@6733 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsWebShell.cpp | 22 ++++++++++++++++++++-- mozilla/webshell/public/nsIWebShell.h | 2 ++ mozilla/webshell/src/nsWebShell.cpp | 22 ++++++++++++++++++++-- 3 files changed, 42 insertions(+), 4 deletions(-) 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) {