From eff7e52e5af6ef2700816cc22aa0531a5aefe42e Mon Sep 17 00:00:00 2001 From: Gijs Kruitbosch Date: Wed, 2 Jul 2014 23:23:48 +0100 Subject: [PATCH] Bug 1014313 - part 1: add tabs options to tabstrip context menu, r=dao --- browser/base/content/browser.js | 25 ++++++++++-- browser/base/content/browser.xul | 20 ++++++++++ ...wser_880164_customization_context_menus.js | 38 +++++++++++++++++++ .../components/customizableui/test/head.js | 5 ++- .../locales/en-US/chrome/browser/browser.dtd | 4 ++ 5 files changed, 88 insertions(+), 4 deletions(-) diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index ea25acc7f94..4da0da3b115 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -4299,9 +4299,28 @@ function onViewToolbarsPopupShowing(aEvent, aInsertPoint) { toolbarItem = null; } - // Right-clicking on an empty part of the tabstrip will exit - // the above loop with toolbarItem being the xul:document. - // That has no parentNode, and we should disable the items in + let showTabStripItems = toolbarItem && toolbarItem.id == "tabbrowser-tabs"; + for (let node of popup.querySelectorAll('menuitem[contexttype="toolbaritem"]')) { + node.hidden = showTabStripItems; + } + + for (let node of popup.querySelectorAll('menuitem[contexttype="tabbar"]')) { + node.hidden = !showTabStripItems; + } + + if (showTabStripItems) { + PlacesCommandHook.updateBookmarkAllTabsCommand(); + + let haveMultipleTabs = gBrowser.visibleTabs.length > 1; + document.getElementById("toolbar-context-reloadAllTabs").disabled = !haveMultipleTabs; + + document.getElementById("toolbar-context-undoCloseTab").disabled = + SessionStore.getClosedTabCount(window) == 0; + return; + } + + // In some cases, we will exit the above loop with toolbarItem being the + // xul:document. That has no parentNode, and we should disable the items in // this case. let movable = toolbarItem && toolbarItem.parentNode && CustomizableUI.isWidgetRemovable(toolbarItem); diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul index 29b78f3adf3..df9966ad68c 100644 --- a/browser/base/content/browser.xul +++ b/browser/base/content/browser.xul @@ -286,11 +286,31 @@ + + + + + + +