Bug 1395535 - wait for async initDevTools in devtools shim inspectNode method;r=ochameau draft
authorJulian Descottes <jdescottes@mozilla.com>
Tue, 05 Sep 2017 15:15:34 +0200
changeset 659094 7680b9673e9704678013d23e1345ae5cd547ff14
parent 659093 b81455f6e068f8e825df04743ad3b18e6c57908b
child 729878 ed9907ee48ffbffbfed189f701eba0cded09c80e
push id78008
push userjdescottes@mozilla.com
push dateTue, 05 Sep 2017 13:43:47 +0000
reviewersochameau
bugs1395535
milestone57.0a1
Bug 1395535 - wait for async initDevTools in devtools shim inspectNode method;r=ochameau MozReview-Commit-ID: 29Fsd63VLMM
devtools/shim/DevToolsShim.jsm
--- a/devtools/shim/DevToolsShim.jsm
+++ b/devtools/shim/DevToolsShim.jsm
@@ -228,39 +228,39 @@ this.DevToolsShim = {
    *        The browser tab on which inspect node was used.
    * @param {Array} selectors
    *        An array of CSS selectors to find the target node. Several selectors can be
    *        needed if the element is nested in frames and not directly in the root
    *        document.
    * @return {Promise} a promise that resolves when the node is selected in the inspector
    *         markup view or that resolves immediately if DevTools are not installed.
    */
-  inspectNode: function (tab, selectors) {
+  inspectNode: async function (tab, selectors) {
     if (!this.isInstalled()) {
       return Promise.resolve();
     }
 
     // Initialize DevTools explicitly to pass the "ContextMenu" reason to telemetry.
     if (!this.isInitialized()) {
-      this._initDevTools("ContextMenu");
+      await this._initDevTools("ContextMenu");
     }
 
     return this.gDevTools.inspectNode(tab, selectors);
   },
 
   /**
    * Initialize DevTools via the devtools-startup command line handler component.
    * Overridden in tests.
    *
    * @param {String} reason
    *        optional, if provided should be a valid entry point for DEVTOOLS_ENTRY_POINT
    *        in toolkit/components/telemetry/Histograms.json
    */
   _initDevTools: function (reason) {
-    DevtoolsStartup.initDevTools(reason);
+    return DevtoolsStartup.initDevTools(reason);
   },
 
   _onDevToolsRegistered: function () {
     // Register all pending event listeners on the real gDevTools object.
     for (let [event, listener] of this.listeners) {
       this._gDevTools.on(event, listener);
     }