Bug 1163917 - Remove the widget from its area if the conditionalDestroy promise is resolved truthy. r=gijs, a=sledru
authorJared Wein <jwein@mozilla.com>
Mon, 18 May 2015 12:49:25 -0400
changeset 260522 f9328a6ea6bd
parent 260521 4bfd19d00ed4
child 260523 e6f89a184268
push id806
push userryanvm@gmail.com
push date2015-05-18 18:34 +0000
treeherdermozilla-release@f9328a6ea6bd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgijs, sledru
bugs1163917
milestone38.0.5
Bug 1163917 - Remove the widget from its area if the conditionalDestroy promise is resolved truthy. r=gijs, a=sledru
browser/components/customizableui/CustomizableUI.jsm
--- a/browser/components/customizableui/CustomizableUI.jsm
+++ b/browser/components/customizableui/CustomizableUI.jsm
@@ -2175,35 +2175,36 @@ let CustomizableUIInternal = {
 
   createBuiltinWidget: function(aData) {
     // This should only ever be called on startup, before any windows are
     // opened - so we know there's no build areas to handle. Also, builtin
     // widgets are expected to be (mostly) static, so shouldn't affect the
     // current placement settings.
 
     // This allows a widget to be both built-in by default but also able to be
-    // destroyed based on criteria that may not be available when the widget is
-    // created -- for example, because some other feature in the browser
-    // supersedes the widget.
+    // destroyed and removed from the area based on criteria that may not be
+    // available when the widget is created -- for example, because some other
+    // feature in the browser supersedes the widget.
     let conditionalDestroyPromise = aData.conditionalDestroyPromise || null;
     delete aData.conditionalDestroyPromise;
 
     let widget = this.normalizeWidget(aData, CustomizableUI.SOURCE_BUILTIN);
     if (!widget) {
       ERROR("Error creating builtin widget: " + aData.id);
       return;
     }
 
     LOG("Creating built-in widget with id: " + widget.id);
     gPalette.set(widget.id, widget);
 
     if (conditionalDestroyPromise) {
       conditionalDestroyPromise.then(shouldDestroy => {
         if (shouldDestroy) {
           this.destroyWidget(widget.id);
+          this.removeWidgetFromArea(widget.id);
         }
       }, err => {
         Cu.reportError(err);
       });
     }
   },
 
   // Returns true if the area will eventually lazily restore (but hasn't yet).