Bug 1003095 - Make the xpcInspector a built-in module;r=past
authorEddy Bruel <ejpbruel@mozilla.com>
Wed, 21 May 2014 15:55:53 +0200
changeset 184225 54526e9f8c3135d643fa755141bce30f53d118b0
parent 184224 cb54921d1abcbf840062647a45fa137b23ac23f9
child 184226 0597b5dc141df1cfaa2a8ad35cdcd81fee04bea9
push id43779
push userryanvm@gmail.com
push dateWed, 21 May 2014 20:20:12 +0000
treeherdermozilla-inbound@a37bca3fafae [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspast
bugs1003095
milestone32.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1003095 - Make the xpcInspector a built-in module;r=past
toolkit/devtools/Loader.jsm
toolkit/devtools/server/main.js
toolkit/devtools/worker-loader.js
--- a/toolkit/devtools/Loader.jsm
+++ b/toolkit/devtools/Loader.jsm
@@ -25,16 +25,18 @@ Cu.import("resource://gre/modules/XPCOMU
 Cu.import("resource://gre/modules/Services.jsm");
 let Timer = Cu.import("resource://gre/modules/Timer.jsm", {});
 
 XPCOMUtils.defineLazyModuleGetter(this, "NetUtil", "resource://gre/modules/NetUtil.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "FileUtils", "resource://gre/modules/FileUtils.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "console", "resource://gre/modules/devtools/Console.jsm");
 
+let xpcInspector = Cc["@mozilla.org/jsinspector;1"].getService(Ci.nsIJSInspector);
+
 let loader = Cu.import("resource://gre/modules/commonjs/toolkit/loader.js", {}).Loader;
 let promise = Cu.import("resource://gre/modules/Promise.jsm", {}).Promise;
 
 this.EXPORTED_SYMBOLS = ["DevToolsLoader", "devtools", "BuiltinProvider",
                          "SrcdirProvider"];
 
 /**
  * Providers are different strategies for loading the devtools.
@@ -59,16 +61,17 @@ BuiltinProvider.prototype = {
   load: function() {
     this.loader = new loader.Loader({
       id: "fx-devtools",
       modules: {
         "Debugger": Debugger,
         "Services": Object.create(Services),
         "Timer": Object.create(Timer),
         "toolkit/loader": loader,
+        "xpcInspector": xpcInspector,
       },
       paths: {
         // When you add a line to this mapping, don't forget to make a
         // corresponding addition to the SrcdirProvider mapping below as well.
         "": "resource://gre/modules/commonjs/",
         "main": "resource:///modules/devtools/main.js",
         "devtools": "resource:///modules/devtools",
         "devtools/toolkit": "resource://gre/modules/devtools",
@@ -144,16 +147,17 @@ SrcdirProvider.prototype = {
     let sourceMapURI = this.fileURI(OS.Path.join(toolkitDir), "SourceMap.jsm");
     this.loader = new loader.Loader({
       id: "fx-devtools",
       modules: {
         "Debugger": Debugger,
         "Services": Object.create(Services),
         "Timer": Object.create(Timer),
         "toolkit/loader": loader,
+        "xpcInspector": xpcInspector,
       },
       paths: {
         "": "resource://gre/modules/commonjs/",
         "main": mainURI,
         "devtools": devtoolsURI,
         "devtools/toolkit": toolkitURI,
         "devtools/server": serverURI,
         "devtools/toolkit/webconsole": webconsoleURI,
--- a/toolkit/devtools/server/main.js
+++ b/toolkit/devtools/server/main.js
@@ -217,17 +217,17 @@ var DebuggerServer = {
    *        The embedder-provider callback, that decides whether an incoming
    *        remote protocol conection should be allowed or refused.
    */
   init: function DS_init(aAllowConnectionCallback) {
     if (this.initialized) {
       return;
     }
 
-    this.xpcInspector = Cc["@mozilla.org/jsinspector;1"].getService(Ci.nsIJSInspector);
+    this.xpcInspector = require("xpcInspector");
     this.initTransport(aAllowConnectionCallback);
 
     this._initialized = true;
   },
 
   protocol: require("devtools/server/protocol"),
 
   /**
--- a/toolkit/devtools/worker-loader.js
+++ b/toolkit/devtools/worker-loader.js
@@ -337,29 +337,32 @@ if (typeof Components === "object") {
     const { Promise } = Cu.import("resource://gre/modules/Promise.jsm", {});;
     const { Services } = Cu.import("resource://gre/modules/Services.jsm", {});;
     let SourceMap = {};
     Cu.import("resource://gre/modules/devtools/SourceMap.jsm", SourceMap);
     const Timer = Cu.import("resource://gre/modules/Timer.jsm", {});
     const chrome = { CC: Function.bind.call(CC, Components), Cc: Cc,
                      ChromeWorker: ChromeWorker, Cm: Cm, Ci: Ci, Cu: Cu,
                      Cr: Cr, components: Components };
+    const xpcInspector = Cc["@mozilla.org/jsinspector;1"].
+                         getService(Ci.nsIJSInspector);
 
     this.worker = new WorkerDebuggerLoader({
       createSandbox: createSandbox,
       globals: {
         "promise": Promise,
       },
       loadInSandbox: loadInSandbox,
       modules: {
         "Debugger": Debugger,
         "Services": Object.create(Services),
         "Timer": Object.create(Timer),
         "chrome": chrome,
         "source-map": SourceMap,
+        "xpcInspector": xpcInspector,
       },
       paths: {
         "": "resource://gre/modules/commonjs/",
         "devtools": "resource:///modules/devtools",
         "devtools/server": "resource://gre/modules/devtools/server",
         "devtools/toolkit": "resource://gre/modules/devtools",
         "xpcshell-test": "resource://test",
       }