Bug 1382173 - DevToolsShim initializes DevTools using devtools-startup;r=ochameau
MozReview-Commit-ID: 6zAXakS0DW2
--- a/devtools/shim/DevToolsShim.jsm
+++ b/devtools/shim/DevToolsShim.jsm
@@ -1,17 +1,22 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
-const Cu = Components.utils;
-const Ci = Components.interfaces;
+const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
const { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
+const { XPCOMUtils } = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {});
+
+XPCOMUtils.defineLazyGetter(this, "DevToolsStartup", function () {
+ return Cc["@mozilla.org/devtools/startup-clh;1"].getService(Ci.nsISupports)
+ .wrappedJSObject;
+});
this.EXPORTED_SYMBOLS = [
"DevToolsShim",
];
function removeItem(array, callback) {
let index = array.findIndex(callback);
if (index >= 0) {
@@ -223,17 +228,17 @@ this.DevToolsShim = {
if (this.isInstalled && !this.isInitialized()) {
this._initDevTools();
}
return this.gDevTools.inspectNode(tab, selectors);
},
_initDevTools: function () {
- // Should call Startup.initDevTools.
+ DevToolsStartup.initDevTools();
},
_onDevToolsRegistered: function () {
// Register all pending event listeners on the real gDevTools object.
for (let [event, listener] of this.listeners) {
this.gDevTools.on(event, listener);
}