Bug 944403 - disable Australis' add to toolbar/menu items when clicking empty bits of the tabstrip, r=mconley

--HG--
extra : rebase_source : ae2108d8e0f1fa8db60205dc19c2620d8c1d379b
This commit is contained in:
Gijs Kruitbosch 2013-11-28 15:53:02 +01:00
parent dd99c0c9f0
commit 225944ff63

View File

@ -4149,6 +4149,14 @@ function onViewToolbarsPopupShowing(aEvent, aInsertPoint) {
}
}
let addToPanel = popup.querySelector(".customize-context-addToPanel");
let removeFromToolbar = popup.querySelector(".customize-context-removeFromToolbar");
// View -> Toolbars menu doesn't have the addToPanel or removeFromToolbar items.
if (!addToPanel || !removeFromToolbar) {
return;
}
// The explicitOriginalTarget can be a nested child element of a toolbaritem.
let toolbarItem = aEvent.explicitOriginalTarget;
@ -4167,17 +4175,10 @@ function onViewToolbarsPopupShowing(aEvent, aInsertPoint) {
// Right-clicking on an empty part of the tabstrip will exit
// the above loop with toolbarItem being the xul:document.
if (!toolbarItem.parentNode) {
return;
}
let addToPanel = popup.querySelector(".customize-context-addToPanel");
let removeFromToolbar = popup.querySelector(".customize-context-removeFromToolbar");
// View -> Toolbars menu doesn't have the addToPanel or removeFromToolbar items.
if (!addToPanel || !removeFromToolbar) {
return;
}
let movable = toolbarItem && CustomizableUI.isWidgetRemovable(toolbarItem);
// That has no parentNode, and we should disable the items in
// this case.
let movable = toolbarItem && toolbarItem.parentNode &&
CustomizableUI.isWidgetRemovable(toolbarItem);
if (movable) {
addToPanel.removeAttribute("disabled");
removeFromToolbar.removeAttribute("disabled");