Bug 1453280 - Clear and destroy tabbrowser tab's listener when adopting the last tab of a window.
MozReview-Commit-ID: 4XA866P0HJl
--- a/browser/base/content/tabbrowser.js
+++ b/browser/base/content/tabbrowser.js
@@ -2740,18 +2740,24 @@ window._gBrowser = {
}
newTab = true;
}
aTab._endRemoveArgs = [closeWindow, newTab];
// swapBrowsersAndCloseOther will take care of closing the window without animation.
if (closeWindow && aAdoptedByTab) {
- // Remove the tab's filter to avoid leaking.
+ // Remove the tab's filter and progress listener to avoid leaking.
if (aTab.linkedPanel) {
+ const filter = this._tabFilters.get(aTab);
+ browser.webProgress.removeProgressListener(filter);
+ const listener = this._tabListeners.get(aTab);
+ filter.removeProgressListener(listener);
+ listener.destroy();
+ this._tabListeners.delete(aTab);
this._tabFilters.delete(aTab);
}
return true;
}
if (!aTab._fullyOpen) {
// If the opening tab animation hasn't finished before we start closing the
// tab, decrement the animation count since _handleNewTab will not get called.