Bug 580901 - Directly call loadOneTab instead of Tabs.open

Remove Tabs.open and BrowserWindow.addTab and directly deal with xul tabs.
This commit is contained in:
Edward Lee 2010-07-22 12:34:23 -07:00
parent feb4cee8cc
commit c7e09a7426
2 changed files with 2 additions and 25 deletions

View File

@ -1267,7 +1267,7 @@ window.Group.prototype = iQ.extend(new Item(), new Subscribable(), {
// Creates a new tab within this group.
newTab: function(url) {
Groups.setActiveGroup(this);
var newTab = Tabs.open(url || "about:blank", true);
let newTab = gBrowser.loadOneTab(url || "about:blank", {inBackground: true});
// Because opening a new tab happens in a different thread(?)
// calling Page.hideChrome() inline won't do anything. Instead
@ -1308,7 +1308,7 @@ window.Group.prototype = iQ.extend(new Item(), new Subscribable(), {
duration: 270,
complete: function(){
iQ(tab.container).css({opacity: 1});
newTab.focus();
gBrowser.selectedTab = newTab;
Page.showChrome()
gWindow.gURLBar.focus();
$anim.remove();

View File

@ -170,22 +170,6 @@ window.TabsManager = iQ.extend(new Subscribable(), {
return null;
},
// ----------
open: function open(url, inBackground) {
if (typeof(inBackground) == 'undefined')
inBackground = false;
var browserWindow = windows.focused;
// TODO: What to do if we have no focused window?
// make a new one?
var tab = browserWindow.addTab(url);
if (!inBackground)
browserWindow.selectedTab = tab; // TODO doesn't seem to be working
return tab;
},
// ----------
toString: function toString() {
return "[Tabs]";
@ -276,13 +260,6 @@ window.TabsManager = iQ.extend(new Subscribable(), {
tabbrowser.tabContainer.addEventListener(eventType, onEvent, true);
});
this.addTab = function addTab(url) {
var chromeTab = tabbrowser.addTab(url);
// The TabOpen event has just been triggered, so we
// just need to fetch its BrowserTab object now.
return chromeTab.tabcandyBrowserTab;
};
this.getFocusedTab = function getFocusedTab() {
return tabbrowser.selectedTab.tabcandyBrowserTab;
};