Bug 1401152 - Disable 'add to overflow menu' in the customize mode *palette* context menu for flexible space. r=Gijs, a=ritu
authorErica Wright <ewright@mozilla.com>
Thu, 21 Sep 2017 18:15:02 -0400
changeset 432171 f82b141026857dab37f9302bd1dd8e8249969217
parent 432170 71427522fcd59802437718c37b6ace0fef110734
child 432172 fd0f5f771d44e1edc000fc3c27d0ce991f7b54dc
push id7896
push userryanvm@gmail.com
push dateThu, 05 Oct 2017 00:26:16 +0000
treeherdermozilla-beta@8c7645234f86 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs, ritu
bugs1401152
milestone57.0
Bug 1401152 - Disable 'add to overflow menu' in the customize mode *palette* context menu for flexible space. r=Gijs, a=ritu 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
@@ -2328,16 +2328,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
@@ -457,17 +457,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;"/>