Bug 1569676 - Make accessibility panel's destroy synchronous. r=jdescottes

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alexandre Poirot 2019-08-12 13:47:06 +00:00
Родитель 88686d7850
Коммит 0284ed4bdb
1 изменённых файлов: 3 добавлений и 10 удалений

Просмотреть файл

@ -274,16 +274,11 @@ AccessibilityPanel.prototype = {
return this._toolbox.target;
},
async destroy() {
if (this._destroying) {
await this._destroying;
destroy() {
if (this._destroyed) {
return;
}
let resolver;
this._destroying = new Promise(resolve => {
resolver = resolve;
});
this._destroyed = true;
this.target.off("navigate", this.onTabNavigated);
this._toolbox.off("select", this.onPanelVisibilityChange);
@ -316,8 +311,6 @@ AccessibilityPanel.prototype = {
this.panelWin.gTelemetry = null;
this.emit("destroyed");
resolver();
},
};