Leak fix for bug 539843. Make sure that .cleanup() is called in all the error conditions so that the pending-submit list is cleaned up. r=Mossop
authorBenjamin Smedberg <benjamin@smedbergs.us>
Wed, 10 Feb 2010 12:20:37 -0500
changeset 38041 c830d4e68f95dbf48555ad039d9e93f44251e1b6
parent 38040 75beeb8eed5eda3d8df78e3648c506dbcfe73803
child 38042 cb493a28046ec17de4a212c74863f60d0c9097a6
push id11582
push userbsmedberg@mozilla.com
push dateWed, 10 Feb 2010 17:21:20 +0000
treeherdermozilla-central@c830d4e68f95 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMossop
bugs539843
milestone1.9.3a2pre
Leak fix for bug 539843. Make sure that .cleanup() is called in all the error conditions so that the pending-submit list is cleaned up. r=Mossop
browser/base/content/browser.js
toolkit/crashreporter/CrashSubmit.jsm
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -1405,16 +1405,17 @@ function BrowserShutdown()
   catch(ex) {
     Components.utils.reportError(ex);
   }
 
   var os = Components.classes["@mozilla.org/observer-service;1"]
     .getService(Components.interfaces.nsIObserverService);
   os.removeObserver(gSessionHistoryObserver, "browser:purge-session-history");
   os.removeObserver(gXPInstallObserver, "xpinstall-install-blocked");
+  os.removeObserver(gMissingPluginInstaller.pluginCrashed, "plugin-crashed");
 
   try {
     gBrowser.removeProgressListener(window.XULBrowserWindow);
     gBrowser.removeTabsProgressListener(window.TabsProgressListener);
   } catch (ex) {
   }
 
   PlacesStarButton.uninit();
--- a/toolkit/crashreporter/CrashSubmit.jsm
+++ b/toolkit/crashreporter/CrashSubmit.jsm
@@ -268,28 +268,28 @@ Submitter.prototype = {
     if(aFlag & STATE_STOP) {
       this.iframe.docShell.removeProgressListener(this);
 
       // check general request status first
       if (!Components.isSuccessCode(aStatus)) {
         this.element.removeChild(this.iframe);
         if (this.errorCallback) {
           this.errorCallback(this.id);
-          this.cleanup();
         }
+        this.cleanup();
         return 0;
       }
       // check HTTP status
       if (aRequest instanceof Ci.nsIHttpChannel &&
           aRequest.responseStatus != 200) {
         this.element.removeChild(this.iframe);
         if (this.errorCallback) {
           this.errorCallback(this.id);
-          this.cleanup();
         }
+        this.cleanup();
         return 0;
       }
 
       var ret = parseKeyValuePairs(this.iframe.contentDocument.documentElement.textContent);
       this.element.removeChild(this.iframe);
       this.submitSuccess(ret);
     }
     return 0;
@@ -298,29 +298,32 @@ Submitter.prototype = {
   onLocationChange: function(aProgress, aRequest, aURI) {return 0;},
   onProgressChange: function() {return 0;},
   onStatusChange: function() {return 0;},
   onSecurityChange: function() {return 0;},
 
   submit: function Submitter_submit()
   {
     let [dump, extra] = getPendingMinidump(this.id);
-    if (!dump.exists() || !extra.exists())
+    if (!dump.exists() || !extra.exists()) {
+      this.cleanup();
       return false;
+    }
     this.dump = dump;
     this.extra = extra;
     let iframe = this.document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "iframe");
     iframe.setAttribute("type", "content");
 
     let self = this;
     function loadHandler() {
       if (iframe.contentWindow.location == "about:blank")
         return;
       iframe.removeEventListener("load", loadHandler, true);
-      self.submitForm();
+      if (!self.submitForm())
+        self.cleanup();
     }
 
     iframe.addEventListener("load", loadHandler, true);
     this.element.appendChild(iframe);
     this.iframe = iframe;
     iframe.webNavigation.loadURI("chrome://global/content/crash-submit-form.xhtml", 0, null, null, null);
     return true;
   }