Bug 1396953 - Fix flexible space widget disappearing when adding to toolbar. r=Gijs, a=sledru
authorMaya Messinger <maya.messinger@duke.edu>
Sat, 30 Sep 2017 18:42:24 -0400
changeset 677856 bc4443239c37288a8c7701238080e37cb75b10c6
parent 677855 90fad10968db8890412fda2e3c0c9fc13f5d07a1
child 677857 76a43510d785e7cb2b4f53d77c96faca46433cdc
push id83805
push userbmo:rail@mozilla.com
push dateTue, 10 Oct 2017 19:01:30 +0000
reviewersGijs, sledru
bugs1396953
milestone57.0
Bug 1396953 - Fix flexible space widget disappearing when adding to toolbar. r=Gijs, a=sledru MozReview-Commit-ID: BuYzvBX439p
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) {