Bug 1401152 - Disable 'add to overflow menu' in the customize mode *palette* context menu for flexible space. r?Gijs draft
authorErica Wright <ewright@mozilla.com>
Thu, 21 Sep 2017 18:15:02 -0400
changeset 669105 89bc3329d57fce8b6493407ee9e72f355e719d4b
parent 668344 f7e9777221a34f9f23c2e4933307eb38b621b679
child 732854 1cd23c5368dcf7101426055134edc23a930f4a48
push id81211
push userbmo:ewright@mozilla.com
push dateFri, 22 Sep 2017 14:11:47 +0000
reviewersGijs
bugs1401152
milestone57.0a1
Bug 1401152 - Disable 'add to overflow menu' in the customize mode *palette* context menu for flexible space. r?Gijs MozReview-Commit-ID: 5sQPsxVaVYz
browser/components/customizableui/CustomizeMode.jsm
browser/components/customizableui/content/panelUI.inc.xul
--- a/browser/components/customizableui/CustomizeMode.jsm
+++ b/browser/components/customizableui/CustomizeMode.jsm
@@ -2271,16 +2271,21 @@ CustomizeMode.prototype = {
     while (aReferenceNode &&
            aReferenceNode.localName == "toolbarpaletteitem" &&
            aReferenceNode.firstChild.hidden) {
       aReferenceNode = aReferenceNode.previousSibling;
     }
     return aReferenceNode;
   },
 
+  onPaletteContextMenuShowing(event) {
+   let isFlexibleSpace = event.target.triggerNode.id.includes("wrapper-customizableui-special-spring");
+   event.target.querySelector(".customize-context-addToPanel").disabled = isFlexibleSpace;
+ },
+
   onPanelContextMenuShowing(event) {
     let inPermanentArea = !!event.target.triggerNode.closest("#widget-overflow-fixed-list");
     let doc = event.target.ownerDocument;
     doc.getElementById("customizationPanelItemContextMenuUnpin").hidden = !inPermanentArea;
     doc.getElementById("customizationPanelItemContextMenuPin").hidden = inPermanentArea;
   },
 
   _checkForDownloadsClick(event) {
--- a/browser/components/customizableui/content/panelUI.inc.xul
+++ b/browser/components/customizableui/content/panelUI.inc.xul
@@ -459,17 +459,18 @@
                      buttonhighlight="true"
                      hidden="true">
     <popupnotificationcontent id="update-restart-notification-content" orient="vertical">
       <description id="update-restart-description">&updateRestart.message2;</description>
     </popupnotificationcontent>
   </popupnotification>
 </panel>
 
-<menupopup id="customizationPaletteItemContextMenu">
+<menupopup id="customizationPaletteItemContextMenu"
+           onpopupshowing="gCustomizeMode.onPaletteContextMenuShowing(event)">
   <menuitem oncommand="gCustomizeMode.addToToolbar(document.popupNode)"
             class="customize-context-addToToolbar"
             accesskey="&customizeMenu.addToToolbar.accesskey;"
             label="&customizeMenu.addToToolbar.label;"/>
   <menuitem oncommand="gCustomizeMode.addToPanel(document.popupNode)"
             class="customize-context-addToPanel"
             accesskey="&customizeMenu.addToOverflowMenu.accesskey;"
             label="&customizeMenu.addToOverflowMenu.label;"/>