Bug 1249709 - Expose console through worker loader;r=ejpbruel draft
authorBrian Grinstead <bgrinstead@mozilla.com>
Thu, 24 Mar 2016 15:09:50 -0700
changeset 344588 35992e6334dac755e841566f8c63c31b63e4f18d
parent 344587 5e287404e4f8fd81330cd704e42fba5e3baa5f49
child 516993 47349b0b5ce8fdec3bbe9bfd46a4f5d258886fa8
push id13868
push userbgrinstead@mozilla.com
push dateThu, 24 Mar 2016 22:11:44 +0000
reviewersejpbruel
bugs1249709
milestone48.0a1
Bug 1249709 - Expose console through worker loader;r=ejpbruel MozReview-Commit-ID: LqQozx0MIiV
devtools/shared/worker/loader.js
--- a/devtools/shared/worker/loader.js
+++ b/devtools/shared/worker/loader.js
@@ -364,16 +364,17 @@ var loader = {
 // object to implement them. On worker threads, we use the APIs provided by
 // the worker debugger.
 
 var {
   Debugger,
   URL,
   createSandbox,
   dump,
+  console,
   rpc,
   loadSubScript,
   reportError,
   setImmediate,
   xpcInspector
 } = (function () {
   if (typeof Components === "object") { // Main thread
     let {
@@ -427,16 +428,17 @@ var {
     let xpcInspector = Cc["@mozilla.org/jsinspector;1"].
                        getService(Ci.nsIJSInspector);
 
     return {
       Debugger,
       URL: this.URL,
       createSandbox,
       dump: this.dump,
+      console: this.console,
       rpc,
       loadSubScript,
       reportError,
       setImmediate,
       xpcInspector
     };
   } else { // Worker thread
     let requestors = [];
@@ -465,16 +467,17 @@ var {
       }
     };
 
     return {
       Debugger: this.Debugger,
       URL: this.URL,
       createSandbox: this.createSandbox,
       dump: this.dump,
+      console: this.console,
       rpc: this.rpc,
       loadSubScript: this.loadSubScript,
       reportError: this.reportError,
       setImmediate: this.setImmediate,
       xpcInspector: xpcInspector
     };
   }
 }).call(this);
@@ -482,16 +485,17 @@ var {
 // Create the default instance of the worker loader, using the APIs we defined
 // above.
 
 this.worker = new WorkerDebuggerLoader({
   createSandbox: createSandbox,
   globals: {
     "isWorker": true,
     "dump": dump,
+    "console": console,
     "loader": loader,
     "reportError": reportError,
     "rpc": rpc,
     "setImmediate": setImmediate
   },
   loadSubScript: loadSubScript,
   modules: {
     "Debugger": Debugger,