Bug 519951 Closing a contentTab leaks an nsBrowserStatusFilter and others. r=bienvenu,a=Standard8
authorMark Banner <bugzilla@standard8.plus.com>
Fri, 02 Oct 2009 10:44:59 +0100
changeset 4012 d4529d3c242951b31137bba32e25f79ff559da65
parent 4011 6e1ba8d29afaae553c0a3fff5fda8b752eb25cd6
child 4013 86f5531e2c875fc5800895c6d17390c8678442c8
push id3132
push userbugzilla@standard8.plus.com
push dateFri, 02 Oct 2009 09:45:56 +0000
treeherdercomm-central@d4529d3c2429 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbienvenu, Standard8
bugs519951
Bug 519951 Closing a contentTab leaks an nsBrowserStatusFilter and others. r=bienvenu,a=Standard8
mail/base/content/specialTabs.js
--- a/mail/base/content/specialTabs.js
+++ b/mail/base/content/specialTabs.js
@@ -242,32 +242,34 @@ var specialTabs = {
 
       // Create a filter and hook it up to our browser
       let filter = Components.classes["@mozilla.org/appshell/component/browser-status-filter;1"]
                              .createInstance(Components.interfaces.nsIWebProgress);
       aTab.filter = filter;
       aTab.browser.webProgress.addProgressListener(filter, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
 
       // Wire up a progress listener to the filter for this browser
-      const listener = new tabProgressListener(aTab, false);
-      filter.addProgressListener(listener, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
+      aTab.progressListener = new tabProgressListener(aTab, false);
+
+      filter.addProgressListener(aTab.progressListener, Components.interfaces.nsIWebProgress.NOTIFY_ALL);
 
       // Now start loading the content.
       aTab.title = this.loadingTabString;
 
       aTab.browser.loadURI(aArgs.contentPage);
 
       this.lastBrowserId++;
     },
     closeTab: function onTabClosed(aTab) {
       aTab.browser.removeEventListener("DOMTitleChanged",
                                        aTab.titleListener, true);
       aTab.browser.removeEventListener("DOMWindowClose",
                                        aTab.closeListener, true);
       aTab.browser.webProgress.removeProgressListener(aTab.filter);
+      aTab.filter.removeProgressListener(aTab.progressListener);
     },
     saveTabState: function onSaveTabState(aTab) {
       aTab.browser.setAttribute("type", "content-targetable");
     },
     showTab: function onShowTab(aTab) {
       aTab.browser.setAttribute("type", "content-primary");
     },
     persistTab: function onPersistTab(aTab) {