Bug 1341037 - Fix broken Browser Console. r=nchevobbe
authorTim Nguyen <ntim.bugs@gmail.com>
Thu, 23 Feb 2017 16:03:14 +0100
changeset 373523 8593e5ed3fdb836f70a1d79ca6da5c0179a47e6a
parent 373522 ff243ef8853142dd0a99d71569e00d12fb97c1d9
child 373524 8cee574417c0cb0c8f38d8c5c6f4c9021e6e13d3
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnchevobbe
bugs1341037
milestone54.0a1
Bug 1341037 - Fix broken Browser Console. r=nchevobbe MozReview-Commit-ID: 5gIYVBNCILb
devtools/client/webconsole/new-console-output/main.js
devtools/client/webconsole/webconsole.js
--- a/devtools/client/webconsole/new-console-output/main.js
+++ b/devtools/client/webconsole/new-console-output/main.js
@@ -11,15 +11,16 @@ var Cu = Components.utils;
 const { BrowserLoader } = Cu.import("resource://devtools/client/shared/browser-loader.js", {});
 
 this.NewConsoleOutput = function (parentNode, jsterm, toolbox, owner, serviceContainer) {
   // Initialize module loader and load all modules of the new inline
   // preview feature. The entire code-base doesn't need any extra
   // privileges and runs entirely in content scope.
   let NewConsoleOutputWrapper = BrowserLoader({
     baseURI: "resource://devtools/client/webconsole/new-console-output/",
-    commonLibRequire: toolbox.browserRequire,
+    // The toolbox is not available for the browser console.
+    commonLibRequire: toolbox ? toolbox.browserRequire : null,
     window
   }).require("./new-console-output-wrapper");
 
   return new NewConsoleOutputWrapper(
     parentNode, jsterm, toolbox, owner, serviceContainer);
 };
--- a/devtools/client/webconsole/webconsole.js
+++ b/devtools/client/webconsole/webconsole.js
@@ -219,21 +219,23 @@ function WebConsoleFrame(webConsoleOwner
   this._onPanelSelected = this._onPanelSelected.bind(this);
   this._flushMessageQueue = this._flushMessageQueue.bind(this);
   this._onToolboxPrefChanged = this._onToolboxPrefChanged.bind(this);
   this._onUpdateListeners = this._onUpdateListeners.bind(this);
 
   this._outputTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
   this._outputTimerInitialized = false;
 
-  let require = BrowserLoaderModule.BrowserLoader({
+  let toolbox = gDevTools.getToolbox(this.owner.target);
+  let {require} = BrowserLoaderModule.BrowserLoader({
     window: this.window,
     useOnlyShared: true,
-    commonLibRequire: gDevTools.getToolbox(this.owner.target).browserRequire,
-  }).require;
+    // The toolbox isn't available for the browser console.
+    commonLibRequire: toolbox ? toolbox.browserRequire : null,
+  });
 
   this.React = require("devtools/client/shared/vendor/react");
   this.ReactDOM = require("devtools/client/shared/vendor/react-dom");
   this.FrameView = this.React.createFactory(require("devtools/client/shared/components/frame"));
   this.StackTraceView = this.React.createFactory(require("devtools/client/shared/components/stack-trace"));
 
   this._telemetry = new Telemetry();