From 40f0d430883b76cf6cf7e70bca189cb502677e8a Mon Sep 17 00:00:00 2001 From: Alexandre Poirot Date: Thu, 25 Jul 2019 11:54:22 +0000 Subject: [PATCH] Bug 1567860 - Make inspector panel's destroy synchronous. r=rcaliman Differential Revision: https://phabricator.services.mozilla.com/D39303 --HG-- extra : moz-landing-system : lando --- devtools/client/inspector/inspector.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/devtools/client/inspector/inspector.js b/devtools/client/inspector/inspector.js index a7f1dae71f9d..f0225dc54dc5 100644 --- a/devtools/client/inspector/inspector.js +++ b/devtools/client/inspector/inspector.js @@ -322,7 +322,7 @@ Inspector.prototype = { * while still initializing (and making protocol requests). */ _handleRejectionIfNotDestroyed: function(e) { - if (!this._panelDestroyer) { + if (!this._destroyed) { console.error(e); } }, @@ -1378,7 +1378,7 @@ Inspector.prototype = { * reload */ set selectionCssSelector(cssSelector = null) { - if (this._panelDestroyer) { + if (this._destroyed) { return; } @@ -1563,9 +1563,10 @@ Inspector.prototype = { * Destroy the inspector. */ destroy: function() { - if (this._panelDestroyer) { - return this._panelDestroyer; + if (this._destroyed) { + return; } + this._destroyed = true; this._target.threadFront.off("paused", this.handleThreadPaused); this._target.threadFront.off("resumed", this.handleThreadResumed); @@ -1641,10 +1642,6 @@ Inspector.prototype = { this.sidebar = null; this.store = null; this.telemetry = null; - - this._panelDestroyer = Promise.resolve(); - - return this._panelDestroyer; }, _initMarkup: function() {