Bug 1569676 - Make DOM and application panel's destroy synchronous. r=jdescottes
authorAlexandre Poirot <poirot.alex@gmail.com>
Mon, 12 Aug 2019 13:47:07 +0000
changeset 487466 2b3e0300ef3bbeeb3a79c985d9602fff073e35e8
parent 487465 37bd619b82a9497ebfc8b031bbff1637c98bb812
child 487467 f5373b558e6f67d5ff87ac55a6bb669412d876ba
push id92271
push userapoirot@mozilla.com
push dateMon, 12 Aug 2019 14:17:52 +0000
treeherderautoland@b22b74e628da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdescottes
bugs1569676
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1569676 - Make DOM and application panel's destroy synchronous. r=jdescottes Differential Revision: https://phabricator.services.mozilla.com/D39709
devtools/client/application/panel.js
devtools/client/dom/panel.js
--- a/devtools/client/application/panel.js
+++ b/devtools/client/application/panel.js
@@ -33,14 +33,12 @@ class ApplicationPanel {
     return this;
   }
 
   destroy() {
     this.panelWin.Application.destroy();
     this.panelWin = null;
     this.toolbox = null;
     this.emit("destroyed");
-
-    return this;
   }
 }
 
 exports.ApplicationPanel = ApplicationPanel;
--- a/devtools/client/dom/panel.js
+++ b/devtools/client/dom/panel.js
@@ -84,29 +84,25 @@ DomPanel.prototype = {
     };
 
     exportIntoContentScope(this.panelWin, provider, "DomProvider");
 
     this.shouldRefresh = true;
   },
 
   destroy() {
-    if (this._destroying) {
-      return this._destroying;
+    if (this._destroyed) {
+      return;
     }
+    this._destroyed = true;
 
-    this._destroying = new Promise(resolve => {
-      this.target.off("navigate", this.onTabNavigated);
-      this._toolbox.off("select", this.onPanelVisibilityChange);
+    this.target.off("navigate", this.onTabNavigated);
+    this._toolbox.off("select", this.onPanelVisibilityChange);
 
-      this.emit("destroyed");
-      resolve();
-    });
-
-    return this._destroying;
+    this.emit("destroyed");
   },
 
   // Events
 
   refresh: function() {
     // Do not refresh if the panel isn't visible.
     if (!this.isPanelVisible()) {
       return;