Bug 591448 - On tab switch, 'gWindow is not defined' after closing a window that opened Panorama [r=dao a=gavin]

--HG--
extra : rebase_source : d9d049b80efac0297dd40a58e5c733cbecaf3ef3
This commit is contained in:
Raymond Lee 2010-08-31 15:22:10 +08:00
Родитель 69a452586d
Коммит abb1d247f7
1 изменённых файлов: 22 добавлений и 6 удалений

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

@ -81,6 +81,10 @@ var UIManager = {
// Used to facilitate zooming down from a previous tab.
_currentTab : null,
// Variable: _eventListeners
// Keeps track of event listeners added to the AllTabs object.
_eventListeners: {},
// ----------
// Function: init
// Must be called after the object is created.
@ -238,6 +242,7 @@ var UIManager = {
GroupItems.uninit();
Storage.uninit();
this._removeTabActionHandlers();
this._currentTab = null;
this._pageBounds = null;
this._reorderTabItemsOnShow = null;
@ -407,7 +412,7 @@ var UIManager = {
_addTabActionHandlers: function() {
var self = this;
AllTabs.register("close", function(tab) {
this._eventListeners.close = function(tab) {
if (tab.ownerDocument.defaultView != gWindow)
return;
@ -438,23 +443,34 @@ var UIManager = {
}
}
}
});
};
AllTabs.register("move", function(tab) {
this._eventListeners.move = function(tab) {
if (tab.ownerDocument.defaultView != gWindow)
return;
let activeGroupItem = GroupItems.getActiveGroupItem();
if (activeGroupItem)
self.setReorderTabItemsOnShow(activeGroupItem);
});
};
AllTabs.register("select", function(tab) {
this._eventListeners.select = function(tab) {
if (tab.ownerDocument.defaultView != gWindow)
return;
self.onTabSelect(tab);
});
};
for (let name in this._eventListeners)
AllTabs.register(name, this._eventListeners[name]);
},
// ----------
// Function: _removeTabActionHandlers
// Removes handlers to handle tab actions.
_removeTabActionHandlers: function() {
for (let name in this._eventListeners)
AllTabs.unregister(name, this._eventListeners[name]);
},
// ----------