Bug 1270596 - Fix devtools after ESLint 2.9.0 upgrade. r=tromey
authorJ. Ryan Stinnett <jryans@gmail.com>
Thu, 05 May 2016 13:47:40 -0500
changeset 296399 9ef531371d453933f63ad0fd27b53535211c93af
parent 296398 a745ab1bf3bf883c2d02f1badd765f077d2d0445
child 296400 8c4044b1f2c9ece4b8f83e5646fb267b8fc13e77
push id19103
push userjryans@gmail.com
push dateFri, 06 May 2016 15:49:54 +0000
treeherderfx-team@9ef531371d45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstromey
bugs1270596
milestone49.0a1
Bug 1270596 - Fix devtools after ESLint 2.9.0 upgrade. r=tromey MozReview-Commit-ID: 7LmcHCcIv1Q
devtools/client/inspector/markup/markup.js
devtools/client/webconsole/jsterm.js
devtools/client/webconsole/panel.js
--- a/devtools/client/inspector/markup/markup.js
+++ b/devtools/client/inspector/markup/markup.js
@@ -717,17 +717,18 @@ MarkupView.prototype = {
         this._inspector.scrollNodeIntoView(selection);
         break;
       }
       case Ci.nsIDOMKeyEvent.DOM_VK_ESCAPE: {
         if (this.isDragging) {
           this.cancelDragging();
           break;
         }
-        // falls through
+        handled = false;
+        break;
       }
       default:
         handled = false;
     }
     if (handled) {
       event.stopPropagation();
       event.preventDefault();
     }
--- a/devtools/client/webconsole/jsterm.js
+++ b/devtools/client/webconsole/jsterm.js
@@ -1,17 +1,17 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set ft=javascript ts=2 et sw=2 tw=80: */
 /* 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/. */
 
 "use strict";
 
-const {Ci, Cu} = require("chrome");
+const {Ci} = require("chrome");
 
 const {Utils: WebConsoleUtils} =
   require("devtools/shared/webconsole/utils");
 const promise = require("promise");
 const Debugger = require("Debugger");
 const Services = require("Services");
 
 loader.lazyServiceGetter(this, "clipboardHelper",
@@ -74,17 +74,17 @@ function JSTerm(webConsoleFrame) {
 
 JSTerm.prototype = {
   SELECTED_FRAME: -1,
 
   /**
    * Load the console history from previous sessions.
    * @private
    */
-  _loadHistory: function() {
+  _loadHistory: function () {
     this.history = [];
     this.historyIndex = this.historyPlaceHolder = 0;
 
     this.historyLoaded = asyncStorage.getItem("webConsoleHistory")
       .then(value => {
         if (Array.isArray(value)) {
           // Since it was gotten asynchronously, there could be items already in
           // the history.  It's not likely but stick them onto the end anyway.
@@ -104,28 +104,28 @@ JSTerm.prototype = {
 
   /**
    * Clear the console history altogether.  Note that this will not affect
    * other consoles that are already opened (since they have their own copy),
    * but it will reset the array for all newly-opened consoles.
    * @returns Promise
    *          Resolves once the changes have been persisted.
    */
-  clearHistory: function() {
+  clearHistory: function () {
     this.history = [];
     this.historyIndex = this.historyPlaceHolder = 0;
     return this.storeHistory();
   },
 
   /**
    * Stores the console history for future console instances.
    * @returns Promise
    *          Resolves once the changes have been persisted.
    */
-  storeHistory: function() {
+  storeHistory: function () {
     return asyncStorage.setItem("webConsoleHistory", this.history);
   },
 
   /**
    * Stores the data for the last completion.
    * @type object
    */
   lastCompletion: null,
@@ -237,17 +237,17 @@ JSTerm.prototype = {
   COMPLETE_BACKWARD: 1,
   COMPLETE_HINT_ONLY: 2,
   COMPLETE_PAGEUP: 3,
   COMPLETE_PAGEDOWN: 4,
 
   /**
    * Initialize the JSTerminal UI.
    */
-  init: function() {
+  init: function () {
     let autocompleteOptions = {
       onSelect: this.onAutocompleteSelect.bind(this),
       onClick: this.acceptProposedCompletion.bind(this),
       panelId: "webConsole_autocompletePopup",
       listBoxId: "webConsole_autocompletePopupListBox",
       position: "before_start",
       theme: "auto",
       direction: "ltr",
@@ -277,33 +277,33 @@ JSTerm.prototype = {
       this.inputNode.addEventListener("keyup", this._inputEventHandler, false);
       this.inputNode.addEventListener("focus", this._focusEventHandler, false);
     }
 
     this.hud.window.addEventListener("blur", this._blurEventHandler, false);
     this.lastInputValue && this.setInputValue(this.lastInputValue);
   },
 
-  focus: function() {
+  focus: function () {
     if (!this.inputNode.getAttribute("focused")) {
       this.inputNode.focus();
     }
   },
 
   /**
    * The JavaScript evaluation response handler.
    *
    * @private
    * @param function [callback]
    *        Optional function to invoke when the evaluation result is added to
    *        the output.
    * @param object response
    *        The message received from the server.
    */
-  _executeResultCallback: function(callback, response) {
+  _executeResultCallback: function (callback, response) {
     if (!this.hud) {
       return;
     }
     if (response.error) {
       console.error("Evaluation error " + response.error + ": " +
                     response.message);
       return;
     }
@@ -413,19 +413,19 @@ JSTerm.prototype = {
    *        The string you want to execute. If this is not provided, the current
    *        user input is used - taken from |this.getInputValue()|.
    * @param function [callback]
    *        Optional function to invoke when the result is displayed.
    *        This is deprecated - please use the promise return value instead.
    * @returns Promise
    *          Resolves with the message once the result is displayed.
    */
-  execute: function(executeString, callback) {
+  execute: function (executeString, callback) {
     let deferred = promise.defer();
-    let resultCallback = function(msg) {
+    let resultCallback = function (msg) {
       deferred.resolve(msg);
       if (callback) {
         callback(msg);
       }
     };
 
     // attempt to execute the content of the inputNode
     executeString = executeString || this.getInputValue();
@@ -489,17 +489,17 @@ JSTerm.prototype = {
    *        global content window.
    *        - selectedNodeActor: tells the NodeActor ID of the current selection
    *        in the Inspector, if such a selection exists. This is used by
    *        helper functions that can evaluate on the current selection.
    * @return object
    *         A promise object that is resolved when the server response is
    *         received.
    */
-  requestEvaluation: function(str, options = {}) {
+  requestEvaluation: function (str, options = {}) {
     let deferred = promise.defer();
 
     function onResult(response) {
       if (!response.error) {
         deferred.resolve(response);
       } else {
         deferred.reject(response);
       }
@@ -524,17 +524,17 @@ JSTerm.prototype = {
   /**
    * Retrieve the FrameActor ID given a frame depth.
    *
    * @param number frame
    *        Frame depth.
    * @return string|null
    *         The FrameActor ID for the given frame depth.
    */
-  getFrameActor: function(frame) {
+  getFrameActor: function (frame) {
     let state = this.hud.owner.getDebuggerFrames();
     if (!state) {
       return null;
     }
 
     let grip;
     if (frame == this.SELECTED_FRAME) {
       grip = state.frames[state.selected];
@@ -561,17 +561,17 @@ JSTerm.prototype = {
    *        to. An iframe element is used as a container for the view. If this
    *        option is not used, then the variables view opens in the sidebar.
    *        - autofocus: optional boolean, |true| if you want to give focus to
    *        the variables view window after open, |false| otherwise.
    * @return object
    *         A promise object that is resolved when the variables view has
    *         opened. The new variables view instance is given to the callbacks.
    */
-  openVariablesView: function(options) {
+  openVariablesView: function (options) {
     let onContainerReady = (window) => {
       let container = window.document.querySelector("#variables");
       let view = this._variablesView;
       if (!view || options.targetElement) {
         let viewOptions = {
           container: container,
           hideFilterInput: options.hideFilterInput,
         };
@@ -620,31 +620,31 @@ JSTerm.prototype = {
   },
 
   /**
    * Create the Web Console sidebar.
    *
    * @see devtools/framework/sidebar.js
    * @private
    */
-  _createSidebar: function() {
+  _createSidebar: function () {
     let tabbox = this.hud.document.querySelector("#webconsole-sidebar");
     this.sidebar = new ToolSidebar(tabbox, this, "webconsole");
     this.sidebar.show();
     this.emit("sidebar-opened");
   },
 
   /**
    * Add the variables view tab to the sidebar.
    *
    * @private
    * @return object
    *         A promise object for the adding of the new tab.
    */
-  _addVariablesViewSidebarTab: function() {
+  _addVariablesViewSidebarTab: function () {
     let deferred = promise.defer();
 
     let onTabReady = () => {
       let window = this.sidebar.getWindowForTab("variablesview");
       deferred.resolve(window);
     };
 
     let tabPanel = this.sidebar.getTabPanel("variablesview");
@@ -666,17 +666,17 @@ JSTerm.prototype = {
   /**
    * The keypress event handler for the Variables View sidebar. Currently this
    * is used for removing the sidebar when Escape is pressed.
    *
    * @private
    * @param nsIDOMEvent event
    *        The keypress DOM event object.
    */
-  _onKeypressInVariablesView: function(event) {
+  _onKeypressInVariablesView: function (event) {
     let tag = event.target.nodeName;
     if (event.keyCode != Ci.nsIDOMKeyEvent.DOM_VK_ESCAPE || event.shiftKey ||
         event.altKey || event.ctrlKey || event.metaKey ||
         ["input", "textarea", "select", "textbox"].indexOf(tag) > -1) {
       return;
     }
 
     this._sidebarDestroy();
@@ -691,17 +691,17 @@ JSTerm.prototype = {
    * @param object options
    *        Options for the new Variables View instance:
    *        - container: the DOM element where the variables view is inserted.
    *        - hideFilterInput: boolean, if true the variables filter input is
    *        hidden.
    * @return object
    *         The new Variables View instance.
    */
-  _createVariablesView: function(options) {
+  _createVariablesView: function (options) {
     let view = new VariablesView(options.container);
     view.toolbox = gDevTools.getToolbox(this.hud.owner.target);
     view.searchPlaceholder = l10n.getStr("propertiesFilterPlaceholder");
     view.emptyText = l10n.getStr("emptyPropertiesList");
     view.searchEnabled = !options.hideFilterInput;
     view.lazyEmpty = this._lazyVariablesView;
 
     VariablesViewController.attach(view, {
@@ -737,17 +737,17 @@ JSTerm.prototype = {
    * @param object options
    *        Options for updating the variables view:
    *        - view: the view you want to update.
    *        - objectActor: the grip of the new ObjectActor you want to show in
    *        the view.
    *        - rawObject: the new raw object you want to show.
    *        - label: the new label for the inspected object.
    */
-  _updateVariablesView: function(options) {
+  _updateVariablesView: function (options) {
     let view = options.view;
     view.empty();
 
     // We need to avoid pruning the object inspection starting point.
     // That one is pruned when the console message is removed.
     view.controller.releaseActors(actor => {
       return view._consoleLastObjectActor != actor;
     });
@@ -789,17 +789,17 @@ JSTerm.prototype = {
    * @private
    * @param object options
    *        The options used for |this._updateVariablesView()|.
    * @param object variableObject
    *        The Variable object instance for the edited property.
    * @param string value
    *        The value the edited property was changed to.
    */
-  _variablesViewEvaluate: function(options, variableObject, value) {
+  _variablesViewEvaluate: function (options, variableObject, value) {
     let updater = this._updateVariablesView.bind(this, options);
     let onEval = this._silentEvalCallback.bind(this, updater);
     let string = variableObject.evaluationMacro(variableObject, value);
 
     let evalOptions = {
       frame: this.SELECTED_FRAME,
       bindObjectActor: options.objectActor.actor,
     };
@@ -812,17 +812,17 @@ JSTerm.prototype = {
    * is deleted.
    *
    * @private
    * @param object options
    *        The options used for |this._updateVariablesView()|.
    * @param object variableObject
    *        The Variable object instance for the deleted property.
    */
-  _variablesViewDelete: function(options, variableObject) {
+  _variablesViewDelete: function (options, variableObject) {
     let onEval = this._silentEvalCallback.bind(this, null);
 
     let evalOptions = {
       frame: this.SELECTED_FRAME,
       bindObjectActor: options.objectActor.actor,
     };
 
     this.requestEvaluation("delete _self" +
@@ -836,17 +836,17 @@ JSTerm.prototype = {
    * @private
    * @param object options
    *        The options used for |this._updateVariablesView()|.
    * @param object variableObject
    *        The Variable object instance for the renamed property.
    * @param string newName
    *        The new name for the property.
    */
-  _variablesViewSwitch: function(options, variableObject, newName) {
+  _variablesViewSwitch: function (options, variableObject, newName) {
     let updater = this._updateVariablesView.bind(this, options);
     let onEval = this._silentEvalCallback.bind(this, updater);
 
     let evalOptions = {
       frame: this.SELECTED_FRAME,
       bindObjectActor: options.objectActor.actor,
     };
 
@@ -872,17 +872,17 @@ JSTerm.prototype = {
    * Exceptions are displayed in the output.
    *
    * @private
    * @param function callback
    *        Function to invoke once the response is received.
    * @param object response
    *        The response packet received from the server.
    */
-  _silentEvalCallback: function(callback, response) {
+  _silentEvalCallback: function (callback, response) {
     if (response.error) {
       console.error("Web Console evaluation failed. " + response.error + ":" +
                     response.message);
 
       callback && callback(response);
       return;
     }
 
@@ -919,17 +919,17 @@ JSTerm.prototype = {
    * Clear the Web Console output.
    *
    * This method emits the "messages-cleared" notification.
    *
    * @param boolean clearStorage
    *        True if you want to clear the console messages storage associated to
    *        this Web Console.
    */
-  clearOutput: function(clearStorage) {
+  clearOutput: function (clearStorage) {
     let hud = this.hud;
     let outputNode = hud.outputNode;
     let node;
     while ((node = outputNode.firstChild)) {
       hud.removeOutputMessage(node);
     }
 
     hud.groupDepth = 0;
@@ -951,30 +951,30 @@ JSTerm.prototype = {
     this.emit("messages-cleared");
   },
 
   /**
    * Remove all of the private messages from the Web Console output.
    *
    * This method emits the "private-messages-cleared" notification.
    */
-  clearPrivateMessages: function() {
+  clearPrivateMessages: function () {
     let nodes = this.hud.outputNode.querySelectorAll(".message[private]");
     for (let node of nodes) {
       this.hud.removeOutputMessage(node);
     }
     this.emit("private-messages-cleared");
   },
 
   /**
    * Updates the size of the input field (command line) to fit its contents.
    *
    * @returns void
    */
-  resizeInput: function() {
+  resizeInput: function () {
     let inputNode = this.inputNode;
 
     // Reset the height so that scrollHeight will reflect the natural height of
     // the contents of the input field.
     inputNode.style.height = "auto";
 
     // Now resize the input field to fit its contents.
     let scrollHeight = inputNode.inputField.scrollHeight;
@@ -987,64 +987,64 @@ JSTerm.prototype = {
    * Sets the value of the input field (command line), and resizes the field to
    * fit its contents. This method is preferred over setting "inputNode.value"
    * directly, because it correctly resizes the field.
    *
    * @param string newValue
    *        The new value to set.
    * @returns void
    */
-  setInputValue: function(newValue) {
+  setInputValue: function (newValue) {
     this.inputNode.value = newValue;
     this.lastInputValue = newValue;
     this.completeNode.value = "";
     this.resizeInput();
     this._inputChanged = true;
     this.emit("set-input-value");
   },
 
   /**
    * Gets the value from the input field
    * @returns string
    */
-  getInputValue: function() {
+  getInputValue: function () {
     return this.inputNode.value || "";
   },
 
   /**
    * The inputNode "input" and "keyup" event handler.
    * @private
    */
-  _inputEventHandler: function() {
+  _inputEventHandler: function () {
     if (this.lastInputValue != this.getInputValue()) {
       this.resizeInput();
       this.complete(this.COMPLETE_HINT_ONLY);
       this.lastInputValue = this.getInputValue();
       this._inputChanged = true;
     }
   },
 
   /**
    * The window "blur" event handler.
    * @private
    */
-  _blurEventHandler: function() {
+  _blurEventHandler: function () {
     if (this.autocompletePopup) {
       this.clearCompletion();
     }
   },
 
   /* eslint-disable complexity */
   /**
    * The inputNode "keypress" event handler.
    *
    * @private
    * @param nsIDOMEvent event
    */
-  _keyPress: function(event) {
+  _keyPress: function (event) {
     let inputNode = this.inputNode;
     let inputValue = this.getInputValue();
     let inputUpdated = false;
 
     if (event.ctrlKey) {
       switch (event.charCode) {
         case 101:
           // control-e
@@ -1259,30 +1259,30 @@ JSTerm.prototype = {
     }
   },
   /* eslint-enable complexity */
 
   /**
    * The inputNode "focus" event handler.
    * @private
    */
-  _focusEventHandler: function() {
+  _focusEventHandler: function () {
     this._inputChanged = false;
   },
 
   /**
    * Go up/down the history stack of input values.
    *
    * @param number direction
    *        History navigation direction: HISTORY_BACK or HISTORY_FORWARD.
    *
    * @returns boolean
    *          True if the input value changed, false otherwise.
    */
-  historyPeruse: function(direction) {
+  historyPeruse: function (direction) {
     if (!this.history.length) {
       return false;
     }
 
     // Up Arrow key
     if (direction == HISTORY_BACK) {
       if (this.historyPlaceHolder <= 0) {
         return false;
@@ -1314,30 +1314,30 @@ JSTerm.prototype = {
   },
 
   /**
    * Test for multiline input.
    *
    * @return boolean
    *         True if CR or LF found in node value; else false.
    */
-  hasMultilineInput: function() {
+  hasMultilineInput: function () {
     return /[\r\n]/.test(this.getInputValue());
   },
 
   /**
    * Check if the caret is at a location that allows selecting the previous item
    * in history when the user presses the Up arrow key.
    *
    * @return boolean
    *         True if the caret is at a location that allows selecting the
    *         previous item in history when the user presses the Up arrow key,
    *         otherwise false.
    */
-  canCaretGoPrevious: function() {
+  canCaretGoPrevious: function () {
     let node = this.inputNode;
     if (node.selectionStart != node.selectionEnd) {
       return false;
     }
 
     let multiline = /[\r\n]/.test(node.value);
     return node.selectionStart == 0 ? true :
            node.selectionStart == node.value.length && !multiline;
@@ -1347,17 +1347,17 @@ JSTerm.prototype = {
    * Check if the caret is at a location that allows selecting the next item in
    * history when the user presses the Down arrow key.
    *
    * @return boolean
    *         True if the caret is at a location that allows selecting the next
    *         item in history when the user presses the Down arrow key, otherwise
    *         false.
    */
-  canCaretGoNext: function() {
+  canCaretGoNext: function () {
     let node = this.inputNode;
     if (node.selectionStart != node.selectionEnd) {
       return false;
     }
 
     let multiline = /[\r\n]/.test(node.value);
     return node.selectionStart == node.value.length ? true :
            node.selectionStart == 0 && !multiline;
@@ -1392,17 +1392,17 @@ JSTerm.prototype = {
    *          is set from the current cursor position to the end of the
    *          completed text.
    * @param function callback
    *        Optional function invoked when the autocomplete properties are
    *        updated.
    * @returns boolean true if there existed a completion for the current input,
    *          or false otherwise.
    */
-  complete: function(type, callback) {
+  complete: function (type, callback) {
     let inputNode = this.inputNode;
     let inputValue = this.getInputValue();
     let frameActor = this.getFrameActor(this.SELECTED_FRAME);
 
     // If the inputNode has no value, then don't try to complete on it.
     if (!inputValue) {
       this.clearCompletion();
       callback && callback(this);
@@ -1451,17 +1451,17 @@ JSTerm.prototype = {
    * fetching updated results from the content process.
    *
    * @private
    * @param int type
    *        Completion type. See this.complete() for details.
    * @param function [callback]
    *        Optional, function to invoke when completion results are received.
    */
-  _updateCompletionResult: function(type, callback) {
+  _updateCompletionResult: function (type, callback) {
     let frameActor = this.getFrameActor(this.SELECTED_FRAME);
     if (this.lastCompletion.value == this.getInputValue() &&
         frameActor == this._lastFrameActorId) {
       return;
     }
 
     let requestId = gSequenceId();
     let cursor = this.inputNode.selectionStart;
@@ -1484,17 +1484,17 @@ JSTerm.prototype = {
       // Find the last non-alphanumeric other than _ or $ if it exists.
       let lastNonAlpha = input.match(/[^a-zA-Z0-9_$][a-zA-Z0-9_$]*$/);
       // If input contains non-alphanumerics, use the part after the last one
       // to filter the cache
       if (lastNonAlpha) {
         filterBy = input.substring(input.lastIndexOf(lastNonAlpha) + 1);
       }
 
-      let newList = cache.sort().filter(function(l) {
+      let newList = cache.sort().filter(function (l) {
         return l.startsWith(filterBy);
       });
 
       this.lastCompletion = {
         requestId: null,
         completionType: type,
         value: null,
       };
@@ -1527,17 +1527,17 @@ JSTerm.prototype = {
    * @param number requestId
    *        Request ID.
    * @param function [callback=null]
    *        Optional, function to invoke when the completion result is received.
    * @param object message
    *        The JSON message which holds the completion results received from
    *        the content process.
    */
-  _receiveAutocompleteProperties: function(requestId, callback, message) {
+  _receiveAutocompleteProperties: function (requestId, callback, message) {
     let inputNode = this.inputNode;
     let inputValue = this.getInputValue();
     if (this.lastCompletion.value == inputValue ||
         requestId != this.lastCompletion.requestId) {
       return;
     }
     // Cache whatever came from the server if the last char is
     // alphanumeric or '.'
@@ -1553,17 +1553,17 @@ JSTerm.prototype = {
     let lastPart = message.matchProp;
     if (!matches.length) {
       this.clearCompletion();
       callback && callback(this);
       this.emit("autocomplete-updated");
       return;
     }
 
-    let items = matches.reverse().map(function(match) {
+    let items = matches.reverse().map(function (match) {
       return { preLabel: lastPart, label: match };
     });
 
     let popup = this.autocompletePopup;
     popup.setItems(items);
 
     let completionType = this.lastCompletion.completionType;
     this.lastCompletion = {
@@ -1595,17 +1595,17 @@ JSTerm.prototype = {
     } else if (completionType == this.COMPLETE_FORWARD) {
       popup.selectNextItem();
     }
 
     callback && callback(this);
     this.emit("autocomplete-updated");
   },
 
-  onAutocompleteSelect: function() {
+  onAutocompleteSelect: function () {
     // Render the suggestion only if the cursor is at the end of the input.
     if (this.inputNode.selectionStart != this.getInputValue().length) {
       return;
     }
 
     let currentItem = this.autocompletePopup.selectedItem;
     if (currentItem && this.lastCompletion.value) {
       let suffix =
@@ -1615,34 +1615,34 @@ JSTerm.prototype = {
       this.updateCompleteNode("");
     }
   },
 
   /**
    * Clear the current completion information and close the autocomplete popup,
    * if needed.
    */
-  clearCompletion: function() {
+  clearCompletion: function () {
     this.autocompletePopup.clearItems();
     this.lastCompletion = { value: null };
     this.updateCompleteNode("");
     if (this.autocompletePopup.isOpen) {
       this.autocompletePopup.hidePopup();
       this._autocompletePopupNavigated = false;
     }
   },
 
   /**
    * Accept the proposed input completion.
    *
    * @return boolean
    *         True if there was a selected completion item and the input value
    *         was updated, false otherwise.
    */
-  acceptProposedCompletion: function() {
+  acceptProposedCompletion: function () {
     let updated = false;
 
     let currentItem = this.autocompletePopup.selectedItem;
     if (currentItem && this.lastCompletion.value) {
       let suffix =
         currentItem.label.substring(this.lastCompletion.matchProp.length);
       let cursor = this.inputNode.selectionStart;
       let value = this.getInputValue();
@@ -1659,27 +1659,27 @@ JSTerm.prototype = {
   },
 
   /**
    * Update the node that displays the currently selected autocomplete proposal.
    *
    * @param string suffix
    *        The proposed suffix for the inputNode value.
    */
-  updateCompleteNode: function(suffix) {
+  updateCompleteNode: function (suffix) {
     // completion prefix = input, with non-control chars replaced by spaces
     let prefix = suffix ? this.getInputValue().replace(/[\S]/g, " ") : "";
     this.completeNode.value = prefix + suffix;
   },
 
   /**
    * Destroy the sidebar.
    * @private
    */
-  _sidebarDestroy: function() {
+  _sidebarDestroy: function () {
     if (this._variablesView) {
       this._variablesView.controller.releaseActors();
       this._variablesView = null;
     }
 
     if (this.sidebar) {
       this.sidebar.hide();
       this.sidebar.destroy();
@@ -1687,17 +1687,17 @@ JSTerm.prototype = {
     }
 
     this.emit("sidebar-closed");
   },
 
   /**
    * Destroy the JSTerm object. Call this method to avoid memory leaks.
    */
-  destroy: function() {
+  destroy: function () {
     this._sidebarDestroy();
 
     this.clearCompletion();
     this.clearOutput();
 
     this.autocompletePopup.destroy();
     this.autocompletePopup = null;
 
--- a/devtools/client/webconsole/panel.js
+++ b/devtools/client/webconsole/panel.js
@@ -1,17 +1,16 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set ft= javascript ts=2 et sw=2 tw=80: */
 /* 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/. */
 
 "use strict";
 
-const {Cu} = require("chrome");
 const promise = require("promise");
 
 loader.lazyGetter(this, "HUDService", () => require("devtools/client/webconsole/hudservice"));
 loader.lazyGetter(this, "EventEmitter", () => require("devtools/shared/event-emitter"));
 
 /**
  * A DevToolPanel that controls the Web Console.
  */
@@ -26,27 +25,27 @@ exports.WebConsolePanel = WebConsolePane
 WebConsolePanel.prototype = {
   hud: null,
 
   /**
    * Called by the WebConsole's onkey command handler.
    * If the WebConsole is opened, check if the JSTerm's input line has focus.
    * If not, focus it.
    */
-  focusInput: function() {
+  focusInput: function () {
     this.hud.jsterm.focus();
   },
 
   /**
    * Open is effectively an asynchronous constructor.
    *
    * @return object
    *         A promise that is resolved when the Web Console completes opening.
    */
-  open: function() {
+  open: function () {
     let parentDoc = this._toolbox.doc;
     let iframe = parentDoc.getElementById("toolbox-panel-iframe-webconsole");
 
     // Make sure the iframe content window is ready.
     let deferredIframe = promise.defer();
     let win, doc;
     if ((win = iframe.contentWindow) &&
         (doc = win.document) &&
@@ -97,17 +96,17 @@ WebConsolePanel.prototype = {
     return this._toolbox.target;
   },
 
   _isReady: false,
   get isReady() {
     return this._isReady;
   },
 
-  destroy: function() {
+  destroy: function () {
     if (this._destroyer) {
       return this._destroyer;
     }
 
     this._destroyer = this.hud.destroy();
     this._destroyer.then(() => this.emit("destroyed"));
 
     return this._destroyer;