Bug 1341037 - Use Toolbox react instance in webconsole. r=ochameau
MozReview-Commit-ID: 4ARtkoqWUQP
--- a/devtools/client/webconsole/new-console-output/main.js
+++ b/devtools/client/webconsole/new-console-output/main.js
@@ -1,23 +1,24 @@
/* 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/. */
/* global BrowserLoader */
"use strict";
-var { utils: Cu } = Components;
+const Cu = Components.utils;
const { BrowserLoader } = Cu.import("resource://devtools/client/shared/browser-loader.js", {});
-// 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.
-const NewConsoleOutputWrapper = BrowserLoader({
- baseURI: "resource://devtools/client/webconsole/new-console-output/",
+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,
window}).require("./new-console-output-wrapper");
-this.NewConsoleOutput = function (parentNode, jsterm, toolbox, owner, serviceContainer) {
return new NewConsoleOutputWrapper(
parentNode, jsterm, toolbox, owner, serviceContainer);
};
--- a/devtools/client/webconsole/webconsole.js
+++ b/devtools/client/webconsole/webconsole.js
@@ -221,17 +221,18 @@ function WebConsoleFrame(webConsoleOwner
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({
window: this.window,
- useOnlyShared: true
+ useOnlyShared: true,
+ commonLibRequire: gDevTools.getToolbox(this.owner.target).browserRequire,
}).require;
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();