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
Родитель 0102e4f958
Коммит 8835a06ac6
3 изменённых файлов: 21 добавлений и 6 удалений

Просмотреть файл

@ -151,6 +151,15 @@ let TabView = {
"SSWindowStateReady", this._SSWindowStateReadyListener, false); "SSWindowStateReady", this._SSWindowStateReadyListener, false);
this._initialized = 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() { hide: function TabView_hide() {
if (!this.isVisible()) if (this.isVisible() && this._window) {
return; this._window.UI.exit();
}
this._window.UI.exit();
}, },
// ---------- // ----------

Просмотреть файл

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

Просмотреть файл

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