From ff201583ca02273e67eef58edfe55773534cbe73 Mon Sep 17 00:00:00 2001 From: yulia Date: Mon, 17 Dec 2018 12:29:52 +0000 Subject: [PATCH] Bug 1508660 - make storage front and changes front async; r=ochameau Depends on D13110 Differential Revision: https://phabricator.services.mozilla.com/D13336 --HG-- extra : moz-landing-system : lando --- .../accessibility/accessibility-startup.js | 31 +++++++++++-------- .../client/inspector/changes/ChangesView.js | 2 +- devtools/client/storage/panel.js | 4 +-- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/devtools/client/accessibility/accessibility-startup.js b/devtools/client/accessibility/accessibility-startup.js index 30ea4c9fe3df..2631963a605c 100644 --- a/devtools/client/accessibility/accessibility-startup.js +++ b/devtools/client/accessibility/accessibility-startup.js @@ -44,23 +44,28 @@ class AccessibilityStartup { // We must call a method on an accessibility front here (such as getWalker), in // oreder to be able to check actor's backward compatibility via actorHasMethod. // See targe.js@getActorDescription for more information. - this._walker = await this._accessibility.getWalker(); + try { + this._walker = await this._accessibility.getWalker(); - this._supports = {}; - // Only works with FF61+ targets - this._supports.enableDisable = - await this.target.actorHasMethod("accessibility", "enable"); + this._supports = {}; + // Only works with FF61+ targets + this._supports.enableDisable = + await this.target.actorHasMethod("accessibility", "enable"); - if (this._supports.enableDisable) { - ([ this._supports.relations, this._supports.snapshot ] = await Promise.all([ - this.target.actorHasMethod("accessible", "getRelations"), - this.target.actorHasMethod("accessible", "snapshot"), - ])); + if (this._supports.enableDisable) { + ([ this._supports.relations, this._supports.snapshot ] = await Promise.all([ + this.target.actorHasMethod("accessible", "getRelations"), + this.target.actorHasMethod("accessible", "snapshot"), + ])); - await this._accessibility.bootstrap(); + await this._accessibility.bootstrap(); + } + + return true; + } catch (e) { + // toolbox may be destroyed during this step. + return false; } - - return true; } /** diff --git a/devtools/client/inspector/changes/ChangesView.js b/devtools/client/inspector/changes/ChangesView.js index 0aa7c7dbb7cf..07469c9a67ef 100644 --- a/devtools/client/inspector/changes/ChangesView.js +++ b/devtools/client/inspector/changes/ChangesView.js @@ -54,7 +54,7 @@ class ChangesView { } this.changesFrontPromise = new Promise(async resolve => { const target = this.inspector.target; - const front = target.getFront("changes"); + const front = await target.getFront("changes"); this.onChangesFront(front); resolve(front); }); diff --git a/devtools/client/storage/panel.js b/devtools/client/storage/panel.js index 825db7c7aabe..d37a4d42f731 100644 --- a/devtools/client/storage/panel.js +++ b/devtools/client/storage/panel.js @@ -33,9 +33,9 @@ class StoragePanel { /** * open is effectively an asynchronous constructor */ - open() { + async open() { this.target.on("close", this.destroy); - this._front = this.target.getFront("storage"); + this._front = await this.target.getFront("storage"); this.UI = new StorageUI(this._front, this._target, this._panelWin, this._toolbox);