Bug 1304178 - Run less code on startup of new console frontend;r=linclark
MozReview-Commit-ID: HdSEyDR6cB0
--- a/devtools/client/webconsole/new-console-output/main.js
+++ b/devtools/client/webconsole/new-console-output/main.js
@@ -14,11 +14,10 @@ const { BrowserLoader } = Cu.import("res
// 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/",
window}).require("./new-console-output-wrapper");
this.NewConsoleOutput = function (parentNode, jsterm, toolbox, owner, serviceContainer) {
- console.log("Creating NewConsoleOutput", parentNode, NewConsoleOutputWrapper);
return new NewConsoleOutputWrapper(parentNode, jsterm, toolbox, owner, serviceContainer);
};
--- a/devtools/client/webconsole/webconsole.js
+++ b/devtools/client/webconsole/webconsole.js
@@ -537,47 +537,25 @@ WebConsoleFrame.prototype = {
*/
_initUI: function () {
this.document = this.window.document;
this.rootElement = this.document.documentElement;
this.NEW_CONSOLE_OUTPUT_ENABLED = !this.isBrowserConsole
&& !this.owner.target.chrome
&& Services.prefs.getBoolPref(PREF_NEW_FRONTEND_ENABLED);
- this._initDefaultFilterPrefs();
-
- // Register the controller to handle "select all" properly.
- this._commandController = new CommandController(this);
- this.window.controllers.insertControllerAt(0, this._commandController);
-
- this._contextMenuHandler = new ConsoleContextMenu(this);
-
- let doc = this.document;
-
- this.filterBox = doc.querySelector(".hud-filter-box");
- this.outputNode = doc.getElementById("output-container");
- this.outputWrapper = doc.getElementById("output-wrapper");
-
- this.completeNode = doc.querySelector(".jsterm-complete-node");
- this.inputNode = doc.querySelector(".jsterm-input-node");
-
- this._setFilterTextBoxEvents();
- this._initFilterButtons();
+ this.outputNode = this.document.getElementById("output-container");
+ this.outputWrapper = this.document.getElementById("output-wrapper");
+ this.completeNode = this.document.querySelector(".jsterm-complete-node");
+ this.inputNode = this.document.querySelector(".jsterm-input-node");
// Update the character width and height needed for the popup offset
// calculations.
this._updateCharSize();
- let clearButton =
- doc.getElementsByClassName("webconsole-clear-console-button")[0];
- clearButton.addEventListener("command", () => {
- this.owner._onClearButton();
- this.jsterm.clearOutput(true);
- });
-
this.jsterm = new JSTerm(this);
this.jsterm.init();
let toolbox = gDevTools.getToolbox(this.owner.target);
if (this.NEW_CONSOLE_OUTPUT_ENABLED) {
// @TODO Remove this once JSTerm is handled with React/Redux.
this.window.jsterm = this.jsterm;
@@ -591,20 +569,37 @@ WebConsoleFrame.prototype = {
this.experimentalOutputNode.removeAttribute("tabindex");
this.outputNode.hidden = true;
this.outputNode.parentNode.appendChild(this.experimentalOutputNode);
// @TODO Once the toolbox has been converted to React, see if passing
// in JSTerm is still necessary.
this.newConsoleOutput = new this.window.NewConsoleOutput(
this.experimentalOutputNode, this.jsterm, toolbox, this.owner);
- console.log("Created newConsoleOutput", this.newConsoleOutput);
-
- let filterToolbar = doc.querySelector(".hud-console-filter-toolbar");
+
+ let filterToolbar = this.document.querySelector(".hud-console-filter-toolbar");
filterToolbar.hidden = true;
+ } else {
+ // Register the controller to handle "select all" properly.
+ this._commandController = new CommandController(this);
+ this.window.controllers.insertControllerAt(0, this._commandController);
+
+ this._contextMenuHandler = new ConsoleContextMenu(this);
+
+ this._initDefaultFilterPrefs();
+ this.filterBox = this.document.querySelector(".hud-filter-box");
+ this._setFilterTextBoxEvents();
+ this._initFilterButtons();
+ let clearButton =
+ this.document.getElementsByClassName("webconsole-clear-console-button")[0];
+ clearButton.addEventListener("command", () => {
+ this.owner._onClearButton();
+ this.jsterm.clearOutput(true);
+ });
+
}
this.resize();
this.window.addEventListener("resize", this.resize, true);
this.jsterm.on("sidebar-opened", this.resize);
this.jsterm.on("sidebar-closed", this.resize);
if (toolbox) {