Bug 457776 - 'ASSERTION: didn't call Disconnect', r+sr=jst
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Thu, 09 Oct 2008 09:38:04 +0300
changeset 20195 a19ab72868025003549c496b6292a27184d4cf0b
parent 20194 6f4d98adbb7f740ea26657e1a3c36e671d841ddc
child 20196 b55e95f2997345fc0eba8c7a05130f0190ebf0c5
push idunknown
push userunknown
push dateunknown
bugs457776
milestone1.9.1b2pre
Bug 457776 - 'ASSERTION: didn't call Disconnect', r+sr=jst
content/base/src/nsXMLHttpRequest.cpp
content/base/src/nsXMLHttpRequest.h
--- a/content/base/src/nsXMLHttpRequest.cpp
+++ b/content/base/src/nsXMLHttpRequest.cpp
@@ -824,16 +824,23 @@ nsXHREventTarget::GetContextForEventHand
   nsresult rv = CheckInnerWindowCorrectness();
   NS_ENSURE_SUCCESS(rv, rv);
   NS_IF_ADDREF(*aContext = mScriptContext);
   return NS_OK;
 }
 
 /////////////////////////////////////////////
 
+nsXMLHttpRequestUpload::~nsXMLHttpRequestUpload()
+{
+  if (mListenerManager) {
+    mListenerManager->Disconnect();
+  }
+}
+
 NS_INTERFACE_MAP_BEGIN(nsXMLHttpRequestUpload)
   NS_INTERFACE_MAP_ENTRY(nsIXMLHttpRequestUpload)
   NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(XMLHttpRequestUpload)
 NS_INTERFACE_MAP_END_INHERITING(nsXHREventTarget)
 
 NS_IMPL_ADDREF_INHERITED(nsXMLHttpRequestUpload, nsXHREventTarget)
 NS_IMPL_RELEASE_INHERITED(nsXMLHttpRequestUpload, nsXHREventTarget)
 
--- a/content/base/src/nsXMLHttpRequest.h
+++ b/content/base/src/nsXMLHttpRequest.h
@@ -224,16 +224,17 @@ class nsXMLHttpRequestUpload : public ns
 {
 public:
   nsXMLHttpRequestUpload(nsPIDOMWindow* aOwner,
                          nsIScriptContext* aScriptContext)
   {
     mOwner = aOwner;
     mScriptContext = aScriptContext;
   }
+  virtual ~nsXMLHttpRequestUpload();
   NS_DECL_ISUPPORTS_INHERITED
   NS_FORWARD_NSIXMLHTTPREQUESTEVENTTARGET(nsXHREventTarget::)
   NS_FORWARD_NSIDOMEVENTTARGET(nsXHREventTarget::)
   NS_FORWARD_NSIDOMNSEVENTTARGET(nsXHREventTarget::)
   NS_DECL_NSIXMLHTTPREQUESTUPLOAD
 
   PRBool HasListeners()
   {