From 1b4eb1cd8ae0ddc6f0e2984555c73a5c95ab7468 Mon Sep 17 00:00:00 2001 From: Piro / YUKI Hiroshi Date: Tue, 19 Nov 2013 23:23:25 +0900 Subject: [PATCH] Disable "TabsInTitlebar" if tabs are not on the top --- modules/window.js | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/modules/window.js b/modules/window.js index 5a7f4013..0d16044d 100644 --- a/modules/window.js +++ b/modules/window.js @@ -1006,38 +1006,41 @@ TreeStyleTabWindow.prototype = { updateTabsOnTop : function TSTWindow_updateTabsOnTop() { - var w = this.window; if ( this.isPopupWindow || this.tabsOnTopChangingByUI || - this.tabsOnTopChangingByTST || - !('TabsOnTop' in w) || - !('enabled' in w.TabsOnTop) + this.tabsOnTopChangingByTST ) return; + var TabsOnTop = this.window.TabsOnTop; + var TabsInTitlebar = this.window.TabsInTitlebar; + var isTopTabbar = this.browser.treeStyleTab.position == 'top'; + this.tabsOnTopChangingByTST = true; try { - var TabsOnTop = w.TabsOnTop; - var originalState = utils.getTreePref('tabsOnTop.originalState'); - if (originalState === null) { - let current = prefs.getDefaultPref('browser.tabs.onTop') === null ? - TabsOnTop.enabled : - prefs.getPref('browser.tabs.onTop') ; - utils.setTreePref('tabsOnTop.originalState', originalState = current); - } + if (TabsOnTop) { + let originalState = utils.getTreePref('tabsOnTop.originalState'); + if (originalState === null) { + let current = prefs.getDefaultPref('browser.tabs.onTop') === null ? + TabsOnTop.enabled : + prefs.getPref('browser.tabs.onTop') ; + utils.setTreePref('tabsOnTop.originalState', originalState = current); + } - if (this.browser.treeStyleTab.position != 'top' || - !this.browser.treeStyleTab.fixed) { - if (TabsOnTop.enabled) - TabsOnTop.enabled = false; - } - else { - if (TabsOnTop.enabled != originalState) - TabsOnTop.enabled = originalState; - utils.clearTreePref('tabsOnTop.originalState'); + if (!isTopTabbar || !this.browser.treeStyleTab.fixed) { + if (TabsOnTop.enabled) + TabsOnTop.enabled = false; + } + else { + if (TabsOnTop.enabled != originalState) + TabsOnTop.enabled = originalState; + utils.clearTreePref('tabsOnTop.originalState'); + } } + if (TabsInTitlebar) + TabsInTitlebar.allowedBy('TreeStyleTab', isTopTabbar); } finally { this.tabsOnTopChangingByTST = false;