Bug 1498235 - only initialize accessibility actor when the toolbox opens or when a11y panel opens as a default panel. r=gl
☠☠ backed out by 4ef080fed9d2 ☠ ☠
authorYura Zenevich <yura.zenevich@gmail.com>
Wed, 24 Oct 2018 04:15:33 +0000
changeset 491261 9e51e98475621798e4a42aa66b118bda54cecdbf
parent 491260 62d141436b6fe23e04086c2bd2ee5d371926ab67
child 491262 50d5e01b6dda142fc4f1123634d48b337a0cc9f5
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersgl
bugs1498235
milestone65.0a1
Bug 1498235 - only initialize accessibility actor when the toolbox opens or when a11y panel opens as a default panel. r=gl MozReview-Commit-ID: CzOTdDDU8fv Differential Revision: https://phabricator.services.mozilla.com/D9578
devtools/client/accessibility/accessibility-startup.js
--- a/devtools/client/accessibility/accessibility-startup.js
+++ b/devtools/client/accessibility/accessibility-startup.js
@@ -37,16 +37,21 @@ class AccessibilityStartup {
    * Fully initialize accessibility front. Also add listeners for accessibility
    * service lifecycle events that affect the state of the tool tab highlight.
    * @return {Promise}
    *         A promise for when accessibility front is fully initialized.
    */
   initAccessibility() {
     if (!this._initAccessibility) {
       this._initAccessibility = (async function() {
+        await Promise.race([
+          this.toolbox.isOpen,
+          this.toolbox.once("accessibility-init"),
+        ]);
+
         this._accessibility = this.target.getFront("accessibility");
         // 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();
         this._supports = {};
         // Only works with FF61+ targets
         this._supports.enableDisable =