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 267489 d2f1f08a52a235a4a64b2f58f6be0aa133e3d732
parent 267488 5a6082956d6c17d88a946a15419a8f1958ea6e26
child 267490 4e9c107c60a60cc38263b0a5e89460951d607768
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgijs, sledru
bugs1163917
milestone39.0
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).