+ this marks the checkin where Ian has switched to Minefield and is no longer paying attention to 3.6

+ the TabCandy button/hot key now works to make a separate TabCandy for each window
+ Fixed a number of startup issues relating to multiple tab candies running at the same time
This commit is contained in:
Ian Gilman 2010-05-20 16:56:19 -07:00
parent af4689c99a
commit 797197e1d4
2 changed files with 27 additions and 10 deletions

View File

@ -328,16 +328,8 @@ window.TabsManager = $.extend(new Subscribable(), {
// Sets up the TabsManager and window.Tabs
init: function() {
var self = this;
/*
var wm = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator);
var chromeWindow = wm.getMostRecentWindow("navigator:browser");
*/
var chromeWindow = Utils.activeWindow;
if(!chromeWindow.getBrowser || !chromeWindow.getBrowser())
chromeWindow = null;
if(!chromeWindow) {
var chromeWindow = Utils.getCurrentWindow();
if(!chromeWindow || !chromeWindow.getBrowser || !chromeWindow.getBrowser()) {
setTimeout(function() {
self.init();
}, 100);

View File

@ -358,7 +358,31 @@ var Utils = {
return null;
},
// ----------
// Function: getCurrentWindow
// Returns the nsIDOMWindowInternal for the currently active window,
// i.e. the window belonging to the active page's DOM "window" object.
getCurrentWindow: function() {
var wm = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator);
var browserEnumerator = wm.getEnumerator("navigator:browser");
while (browserEnumerator.hasMoreElements()) {
var browserWin = browserEnumerator.getNext();
var tabbrowser = browserWin.gBrowser;
// Check each tab of this browser instance
var numTabs = tabbrowser.browsers.length;
for (var index = 0; index < numTabs; index++) {
var currentBrowser = tabbrowser.getBrowserAtIndex(index);
if(currentBrowser.contentWindow == window)
return browserWin;
}
}
return null;
},
// ___ Files
getInstallDirectory: function(id, callback) {
if (Cc["@mozilla.org/extensions/manager;1"]) {
@ -443,6 +467,7 @@ var Utils = {
log: function() { // pass as many arguments as you want, it'll print them all
var text = this.expandArgumentsForLog(arguments);
/* $('body').prepend(text + '<br>'); */
consoleService.logStringMessage(text);
},