Bug 1569676 - Make DOM and application panel's destroy synchronous. r=jdescottes

Differential Revision: https://phabricator.services.mozilla.com/D39709

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alexandre Poirot 2019-08-05 10:46:52 +00:00
parent d75ac50d93
commit 7bb440be2a
2 changed files with 6 additions and 12 deletions

View File

@ -38,8 +38,6 @@ class ApplicationPanel {
this.panelWin = null;
this.toolbox = null;
this.emit("destroyed");
return this;
}
}

View File

@ -74,19 +74,15 @@ DomPanel.prototype = {
},
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