From 0896f3fae176698bba4d91a5f4460a521b356504 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Wed, 14 Jul 2010 11:21:07 -0700 Subject: [PATCH] + Fixed a typo in iQ.each that was breaking everything + Rearranged the UIClass initialization sequence a little, to make sure everything happens in the right sequence --- browser/base/content/tabcandy/app/ui.js | 71 +++++++++++++----------- browser/base/content/tabcandy/core/iq.js | 2 +- 2 files changed, 41 insertions(+), 32 deletions(-) diff --git a/browser/base/content/tabcandy/app/ui.js b/browser/base/content/tabcandy/app/ui.js index b6168d5c6bb..e370da04ec9 100644 --- a/browser/base/content/tabcandy/app/ui.js +++ b/browser/base/content/tabcandy/app/ui.js @@ -568,13 +568,28 @@ window.Page = { // Class: UIClass // Singleton top-level UI manager. TODO: Integrate with . function UIClass(){ - if (window.Tabs) - this.init(); - else { - var self = this; - TabsManager.addSubscriber(this, 'load', function() { - self.init(); - }); + try { + Utils.log('TabCandy init --------------------'); + + // Variable: navBar + // A reference to the , for manipulating the browser's nav bar. + this.navBar = Navbar; + + // Variable: tabBar + // A reference to the , for manipulating the browser's tab bar. + this.tabBar = Tabbar; + + // Variable: devMode + // If true (set by an url parameter), adds extra features to the screen. + // TODO: Integrate with the dev menu + this.devMode = false; + + // Variable: currentTab + // Keeps track of which tab we are currently on. + // Used to facilitate zooming down from a previous tab. + this.currentTab = Utils.activeTab; + } catch(e) { + Utils.log(e); } }; @@ -583,26 +598,22 @@ UIClass.prototype = { // ---------- init: function() { try { - Utils.log('TabCandy init --------------------'); - - // Variable: navBar - // A reference to the , for manipulating the browser's nav bar. - this.navBar = Navbar; - - // Variable: tabBar - // A reference to the , for manipulating the browser's tab bar. - this.tabBar = Tabbar; - - // Variable: devMode - // If true (set by an url parameter), adds extra features to the screen. - // TODO: Integrate with the dev menu - this.devMode = false; - - // Variable: currentTab - // Keeps track of which tab we are currently on. - // Used to facilitate zooming down from a previous tab. - this.currentTab = Utils.activeTab; - + if (window.Tabs) + this._secondaryInit(); + else { + var self = this; + TabsManager.addSubscriber(this, 'load', function() { + self._secondaryInit(); + }); + } + } catch(e) { + Utils.log(e); + } + }, + + // ----------- + _secondaryInit: function() { + try { var self = this; this.setBrowserKeyHandler(); @@ -650,10 +661,7 @@ UIClass.prototype = { self.delayInit(); }); } catch(e) { - Utils.log("Error in UIClass(): " + e); - Utils.log(e.fileName); - Utils.log(e.lineNumber); - Utils.log(e.stack); + Utils.log(e); } }, @@ -1145,5 +1153,6 @@ UIClass.prototype = { // ---------- window.UI = new UIClass(); +window.UI.init(); })(); diff --git a/browser/base/content/tabcandy/core/iq.js b/browser/base/content/tabcandy/core/iq.js index 29807ccfb21..c1610c84037 100644 --- a/browser/base/content/tabcandy/core/iq.js +++ b/browser/base/content/tabcandy/core/iq.js @@ -227,7 +227,7 @@ iQ.fn = iQ.prototype = { // Function: each // Execute a callback for every element in the matched set. each: function( callback ) { - if ( !iQ.isFunction(value) ) { + if ( !iQ.isFunction(callback) ) { Utils.assert("each's argument must be a function", false); return null; }