Bug 581078 - Get rid of Utils.activeTab to avoid iterating over all Tabs

Directly access gBrowser.selectedTab and compare other raw tabs against it until BrowserTab goes away. Get the reference to the BrowserTab instead of iterating over Tabs through .tabcandyBrowserTab.
This commit is contained in:
Edward Lee 2010-07-22 12:36:17 -07:00
parent 6d2a905722
commit 81b6842558
4 changed files with 3 additions and 24 deletions

View File

@ -696,7 +696,7 @@ window.Group.prototype = iQ.extend(new Item(), new Subscribable(), {
if (typeof(item.setResizable) == 'function')
item.setResizable(false);
if (item.tab == Utils.activeTab)
if (item.tab.raw == gBrowser.selectedTab)
Groups.setActiveGroup(this);
}

View File

@ -745,7 +745,7 @@ window.TabItems = {
if (group) {
group.add(item);
if (item.tab == Utils.activeTab)
if (item.tab.raw == gBrowser.selectedTab)
Groups.setActiveGroup(item.parent);
}
}

View File

@ -625,7 +625,7 @@ function UIClass() {
// Variable: currentTab
// Keeps track of which <Tabs> tab we are currently on.
// Used to facilitate zooming down from a previous tab.
this.currentTab = Utils.activeTab;
this.currentTab = gBrowser.selectedTab.tabcandyBrowserTab;
} catch(e) {
Utils.log(e);
}

View File

@ -523,27 +523,6 @@ window.Subscribable.prototype = {
// Class: Utils
// Singelton with common utility functions.
var Utils = {
// ___ Windows and Tabs
// ----------
// Variable: activeTab
// The <Tabs> tab that represents the active tab in the active window.
get activeTab(){
try {
Utils.assert('tabBrowser', gBrowser);
var rawTab = gBrowser.selectedTab;
for ( var i=0; i<Tabs.length; i++){
if (Tabs[i].raw == rawTab)
return Tabs[i];
}
} catch(e) {
Utils.log(e);
}
return null;
},
// ___ Logging
// ----------