From e9c74dd11210a917e0df71d2e1043b21b9ebada2 Mon Sep 17 00:00:00 2001 From: Benjamin Smedberg Date: Wed, 10 Feb 2010 12:20:37 -0500 Subject: [PATCH] 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 | 1 + toolkit/crashreporter/CrashSubmit.jsm | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 37f5de130f33..7be6a14efc4d 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -1410,6 +1410,7 @@ function BrowserShutdown() .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); diff --git a/toolkit/crashreporter/CrashSubmit.jsm b/toolkit/crashreporter/CrashSubmit.jsm index cf723de7ea18..6be3ecf80f1d 100644 --- a/toolkit/crashreporter/CrashSubmit.jsm +++ b/toolkit/crashreporter/CrashSubmit.jsm @@ -273,8 +273,8 @@ Submitter.prototype = { this.element.removeChild(this.iframe); if (this.errorCallback) { this.errorCallback(this.id); - this.cleanup(); } + this.cleanup(); return 0; } // check HTTP status @@ -283,8 +283,8 @@ Submitter.prototype = { this.element.removeChild(this.iframe); if (this.errorCallback) { this.errorCallback(this.id); - this.cleanup(); } + this.cleanup(); return 0; } @@ -303,8 +303,10 @@ Submitter.prototype = { 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"); @@ -315,7 +317,8 @@ Submitter.prototype = { if (iframe.contentWindow.location == "about:blank") return; iframe.removeEventListener("load", loadHandler, true); - self.submitForm(); + if (!self.submitForm()) + self.cleanup(); } iframe.addEventListener("load", loadHandler, true);