Bug 1395535 - wait for async initDevTools in devtools shim inspectNode method;r=ochameau
MozReview-Commit-ID: 29Fsd63VLMM
--- 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);
}