Bug 1396953 Fix flexible space disappearing from palette after add to toolbar r?Gijs draft
authorMaya Messinger <maya.messinger@duke.edu>
Sat, 30 Sep 2017 13:27:37 -0400
changeset 673076 4cf76f399ed68f7398d848ac7e602a258ffb0fc6
parent 673075 f90acd5a42b3474fa44f1494422a87e523335331
child 733993 ec0cb4de94c4931847074a46df5d5158cc2b2b45
push id82453
push userbmo:maya.messinger@duke.edu
push dateSat, 30 Sep 2017 17:27:55 +0000
reviewersGijs
bugs1396953
milestone58.0a1
Bug 1396953 Fix flexible space disappearing from palette after add to toolbar r?Gijs MozReview-Commit-ID: 8heXGLPir6i
browser/components/customizableui/CustomizeMode.jsm
--- a/browser/components/customizableui/CustomizeMode.jsm
+++ b/browser/components/customizableui/CustomizeMode.jsm
@@ -579,17 +579,22 @@ CustomizeMode.prototype = {
   },
 
   addToToolbar(aNode) {
     aNode = this._getCustomizableChildForNode(aNode);
     if (aNode.localName == "toolbarpaletteitem" && aNode.firstChild) {
       aNode = aNode.firstChild;
     }
 
-    CustomizableUI.addWidgetToArea(aNode.id, CustomizableUI.AREA_NAVBAR);
+    let widgetToAdd = aNode.id;
+    if (CustomizableUI.isSpecialWidget(widgetToAdd) && aNode.closest("#customization-palette")) {
+      widgetToAdd = widgetToAdd.match(/^customizableui-special-(spring|spacer|separator)/)[1];
+    }
+
+    CustomizableUI.addWidgetToArea(widgetToAdd, CustomizableUI.AREA_NAVBAR);
     if (!this._customizing) {
       CustomizableUI.dispatchToolboxEvent("customizationchange");
     }
 
     // If the user explicitly moves this item, turn off autohide.
     if (aNode.id == "downloads-button") {
       Services.prefs.setBoolPref(kDownloadAutoHidePref, false);
       if (this._customizing) {
@@ -600,17 +605,17 @@ CustomizeMode.prototype = {
 
   addToPanel(aNode) {
     aNode = this._getCustomizableChildForNode(aNode);
     if (aNode.localName == "toolbarpaletteitem" && aNode.firstChild) {
       aNode = aNode.firstChild;
     }
 
     let panel = CustomizableUI.AREA_FIXED_OVERFLOW_PANEL;
-    CustomizableUI.addWidgetToArea(aNode.id, panel);
+    CustomizableUI.addWidgetToArea(widgetToAdd, panel);
     if (!this._customizing) {
       CustomizableUI.dispatchToolboxEvent("customizationchange");
     }
 
     // If the user explicitly moves this item, turn off autohide.
     if (aNode.id == "downloads-button") {
       Services.prefs.setBoolPref(kDownloadAutoHidePref, false);
       if (this._customizing) {