Bug 930950: also remove location attributes when a widget is removed. r=Gijs
authorMike de Boer <mdeboer@mozilla.com>
Mon, 18 Nov 2013 13:01:46 +0100
changeset 170571 eead57756636e4f0f3a9c98bd26ce967ad7318c8
parent 170570 fc1d24a704186c6c8b3659efdfb69f586620b581
child 170572 70c5061b0fb9747d0455cd57a7f47924c98f4590
push idunknown
push userunknown
push dateunknown
reviewersGijs
bugs930950
milestone28.0a1
Bug 930950: also remove location attributes when a widget is removed. r=Gijs
browser/components/customizableui/src/CustomizableUI.jsm
--- a/browser/components/customizableui/src/CustomizableUI.jsm
+++ b/browser/components/customizableui/src/CustomizableUI.jsm
@@ -594,20 +594,22 @@ let CustomizableUIInternal = {
       let widgetNode = container.ownerDocument.getElementById(aWidgetId);
       if (!widgetNode) {
         ERROR("Widget not found, unable to remove");
         continue;
       }
 
       this.notifyListeners("onWidgetBeforeDOMChange", widgetNode, null, container, true);
 
+      // We remove location attributes here to make sure they're gone too when a
+      // widget is removed from a toolbar to the palette. See bug 930950.
+      this.removeLocationAttributes(widgetNode);
       if (gPalette.has(aWidgetId) || this.isSpecialWidget(aWidgetId)) {
         container.removeChild(widgetNode);
       } else {
-        this.removeLocationAttributes(widgetNode);
         widgetNode.removeAttribute("tabindex");
         if (widgetNode.getAttribute("type") == "wrap") {
           widgetNode.removeAttribute("type");
         }
         areaNode.toolbox.palette.appendChild(widgetNode);
       }
       this.notifyListeners("onWidgetAfterDOMChange", widgetNode, null, container, true);