Bug 1382173 - DevToolsShim initializes DevTools using devtools-startup;r=ochameau draft
authorJulian Descottes <jdescottes@mozilla.com>
Wed, 19 Jul 2017 14:39:19 +0200
changeset 611308 19ce0f5888456cd65f9c9836d711b7f81d1a3b3c
parent 611307 114118ca2f64da5c56255970aa01b45d622080bb
child 638117 cca675089a888f45013fee3553e7c5001dd62871
push id69172
push userjdescottes@mozilla.com
push dateWed, 19 Jul 2017 12:40:00 +0000
reviewersochameau
bugs1382173
milestone56.0a1
Bug 1382173 - DevToolsShim initializes DevTools using devtools-startup;r=ochameau MozReview-Commit-ID: 6zAXakS0DW2
devtools/shim/DevToolsShim.jsm
--- 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);
     }