Bug 933699 - TabView.uninit() leaks the TabView window r=gijs

From eb90c41f6a6d3f1b2d9d4dcbfa1bb32de497c597 Mon Sep 17 00:00:00 2001
This commit is contained in:
Tim Taubert 2013-11-01 11:28:40 +01:00
parent abb2cad8d6
commit 2fdb29e9ea
3 changed files with 21 additions and 6 deletions

View File

@ -151,6 +151,15 @@ let TabView = {
"SSWindowStateReady", this._SSWindowStateReadyListener, false);
this._initialized = false;
if (this._window) {
this._window = null;
}
if (this._iframe) {
this._iframe.remove();
this._iframe = null;
}
},
// ----------
@ -253,10 +262,9 @@ let TabView = {
// ----------
hide: function TabView_hide() {
if (!this.isVisible())
return;
this._window.UI.exit();
if (this.isVisible() && this._window) {
this._window.UI.exit();
}
},
// ----------

View File

@ -804,6 +804,8 @@ let TabItems = {
AllTabs.unregister(name, this._eventListeners[name]);
}
this.items.forEach(function(tabItem) {
delete tabItem.tab._tabViewTabItem;
for (let x in tabItem) {
if (typeof tabItem[x] == "object")
tabItem[x] = null;

View File

@ -214,7 +214,7 @@ let UI = {
});
// ___ setup event listener to save canvas images
gWindow.addEventListener("SSWindowClosing", function onWindowClosing() {
let onWindowClosing = function () {
gWindow.removeEventListener("SSWindowClosing", onWindowClosing, false);
// XXX bug #635975 - don't unlink the tab if the dom window is closing.
@ -226,7 +226,12 @@ let UI = {
TabItems.saveAll();
self._save();
}, false);
};
gWindow.addEventListener("SSWindowClosing", onWindowClosing);
this._cleanupFunctions.push(function () {
gWindow.removeEventListener("SSWindowClosing", onWindowClosing);
});
// ___ load frame script
let frameScript = "chrome://browser/content/tabview-content.js";