Bug 1446064 - Clean up webconsole-connection-proxy.js. r=nchevobbe
authorJ. Ryan Stinnett <jryans@gmail.com>
Thu, 15 Mar 2018 13:04:14 -0500
changeset 408405 115ca10fde0e8b7cfb0d34087a030959e0e5b18b
parent 408404 647154f3033288e3cc3552f86d92eb1ad5f8f742
child 408406 02843ed01924ac509010a9aa215f40e31deafcaf
push id33637
push usertoros@mozilla.com
push dateFri, 16 Mar 2018 09:53:55 +0000
treeherdermozilla-central@d8e8ec54ed9d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnchevobbe
bugs1446064
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1446064 - Clean up webconsole-connection-proxy.js. r=nchevobbe MozReview-Commit-ID: LWRuJQJgkrm
.eslintignore
devtools/client/webconsole/webconsole-connection-proxy.js
--- a/.eslintignore
+++ b/.eslintignore
@@ -137,17 +137,16 @@ devtools/client/storage/test/*.html
 !devtools/client/storage/test/storage-overflow.html
 !devtools/client/storage/test/storage-search.html
 !devtools/client/storage/test/storage-unsecured-iframe.html
 !devtools/client/storage/test/storage-unsecured-iframe-usercontextid.html
 devtools/client/webaudioeditor/**
 devtools/client/webconsole/net/**
 !devtools/client/webconsole/new-console-output/test/mochitest/**
 devtools/client/webconsole/test/**
-devtools/client/webconsole/webconsole-connection-proxy.js
 devtools/client/webconsole/webconsole.js
 devtools/client/webide/**
 !devtools/client/webide/components/webideCli.js
 devtools/server/tests/browser/storage-*.html
 !devtools/server/tests/browser/storage-unsecured-iframe.html
 devtools/server/tests/browser/stylesheets-nested-iframes.html
 devtools/server/tests/unit/xpcshell_debugging_script.js
 devtools/client/shared/webpack/shims/test/test_clipboard.html
--- a/devtools/client/webconsole/webconsole-connection-proxy.js
+++ b/devtools/client/webconsole/webconsole-connection-proxy.js
@@ -1,17 +1,14 @@
-/* -*- 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 {Utils: WebConsoleUtils} = require("devtools/client/webconsole/utils");
 const defer = require("devtools/shared/defer");
 const Services = require("Services");
 
 const l10n = require("devtools/client/webconsole/webconsole-l10n");
 
 const PREF_CONNECTION_TIMEOUT = "devtools.debugger.remote-timeout";
 // Web Console connection proxy
 
@@ -110,17 +107,17 @@ WebConsoleConnectionProxy.prototype = {
 
   /**
    * Initialize a debugger client and connect it to the debugger server.
    *
    * @return object
    *         A promise object that is resolved/rejected based on the success of
    *         the connection initialization.
    */
-  connect: function () {
+  connect: function() {
     if (this._connectDefer) {
       return this._connectDefer.promise;
     }
 
     this._connectDefer = defer();
 
     let timeout = Services.prefs.getIntPref(PREF_CONNECTION_TIMEOUT);
     this._connectTimer = setTimeout(this._connectionTimeout, timeout);
@@ -157,30 +154,30 @@ WebConsoleConnectionProxy.prototype = {
 
     return connPromise;
   },
 
   /**
    * Connection timeout handler.
    * @private
    */
-  _connectionTimeout: function () {
+  _connectionTimeout: function() {
     let error = {
       error: "timeout",
       message: l10n.getStr("connectionTimeout"),
     };
 
     this._connectDefer.reject(error);
   },
 
   /**
    * Attach to the Web Console actor.
    * @private
    */
-  _attachConsole: function () {
+  _attachConsole: function() {
     let listeners = ["PageError", "ConsoleAPI", "NetworkActivity",
                      "FileActivity"];
     // Enable the forwarding of console messages to the parent process
     // when we open the Browser Console or Toolbox.
     if (this.target.chrome && !this.target.isAddon) {
       listeners.push("ContentProcessMessages");
     }
     this.client.attachConsole(this._consoleActor, listeners,
@@ -192,17 +189,17 @@ WebConsoleConnectionProxy.prototype = {
    *
    * @private
    * @param object response
    *        The JSON response object received from the server.
    * @param object webConsoleClient
    *        The WebConsoleClient instance for the attached console, for the
    *        specific tab we work with.
    */
-  _onAttachConsole: function (response, webConsoleClient) {
+  _onAttachConsole: function(response, webConsoleClient) {
     if (response.error) {
       console.error("attachConsole failed: " + response.error + " " +
                     response.message);
       this._connectDefer.reject(response);
       return;
     }
 
     this.webConsoleClient = webConsoleClient;
@@ -220,46 +217,46 @@ WebConsoleConnectionProxy.prototype = {
     this.webConsoleClient.getCachedMessages(msgs, this._onCachedMessages);
 
     this.webConsoleFrame._onUpdateListeners();
   },
 
   /**
    * Dispatch a message add on the new frontend and emit an event for tests.
    */
-  dispatchMessageAdd: function (packet) {
+  dispatchMessageAdd: function(packet) {
     this.webConsoleFrame.newConsoleOutput.dispatchMessageAdd(packet);
   },
 
   /**
    * Batched dispatch of messages.
    */
-  dispatchMessagesAdd: function (packets) {
+  dispatchMessagesAdd: function(packets) {
     this.webConsoleFrame.newConsoleOutput.dispatchMessagesAdd(packets);
   },
 
   /**
    * Dispatch a message event on the new frontend and emit an event for tests.
    */
-  dispatchMessageUpdate: function (networkInfo, response) {
+  dispatchMessageUpdate: function(networkInfo, response) {
     this.webConsoleFrame.newConsoleOutput.dispatchMessageUpdate(networkInfo, response);
   },
 
-  dispatchRequestUpdate: function (id, data) {
+  dispatchRequestUpdate: function(id, data) {
     this.webConsoleFrame.newConsoleOutput.dispatchRequestUpdate(id, data);
   },
 
   /**
    * The "cachedMessages" response handler.
    *
    * @private
    * @param object response
    *        The JSON response object received from the server.
    */
-  _onCachedMessages: function (response) {
+  _onCachedMessages: function(response) {
     if (response.error) {
       console.error("Web Console getCachedMessages error: " + response.error +
                     " " + response.message);
       this._connectDefer.reject(response);
       return;
     }
 
     if (!this._connectTimer) {
@@ -290,17 +287,17 @@ WebConsoleConnectionProxy.prototype = {
    * for displaying.
    *
    * @private
    * @param string type
    *        Message type.
    * @param object packet
    *        The message received from the server.
    */
-  _onPageError: function (type, packet) {
+  _onPageError: function(type, packet) {
     if (!this.webConsoleFrame || packet.from != this._consoleActor) {
       return;
     }
     if (this.webConsoleFrame.NEW_CONSOLE_OUTPUT_ENABLED) {
       this.dispatchMessageAdd(packet);
     } else {
       this.webConsoleFrame.handlePageError(packet.pageError);
     }
@@ -310,17 +307,17 @@ WebConsoleConnectionProxy.prototype = {
    * for displaying.
    *
    * @private
    * @param string type
    *        Message type.
    * @param object packet
    *        The message received from the server.
    */
-  _onLogMessage: function (type, packet) {
+  _onLogMessage: function(type, packet) {
     if (!this.webConsoleFrame || packet.from != this._consoleActor) {
       return;
     }
     if (this.webConsoleFrame.NEW_CONSOLE_OUTPUT_ENABLED) {
       this.dispatchMessageAdd(packet);
     } else {
       this.webConsoleFrame.handleLogMessage(packet);
     }
@@ -330,17 +327,17 @@ WebConsoleConnectionProxy.prototype = {
    * the UI for displaying.
    *
    * @private
    * @param string type
    *        Message type.
    * @param object packet
    *        The message received from the server.
    */
-  _onConsoleAPICall: function (type, packet) {
+  _onConsoleAPICall: function(type, packet) {
     if (!this.webConsoleFrame || packet.from != this._consoleActor) {
       return;
     }
     if (this.webConsoleFrame.NEW_CONSOLE_OUTPUT_ENABLED) {
       this.dispatchMessageAdd(packet);
     } else {
       this.webConsoleFrame.handleConsoleAPICall(packet.message);
     }
@@ -350,17 +347,17 @@ WebConsoleConnectionProxy.prototype = {
    * the UI for displaying.
    *
    * @private
    * @param string type
    *        Message type.
    * @param object networkInfo
    *        The network request information.
    */
-  _onNetworkEvent: function (type, networkInfo) {
+  _onNetworkEvent: function(type, networkInfo) {
     if (!this.webConsoleFrame) {
       return;
     }
     if (this.webConsoleFrame.NEW_CONSOLE_OUTPUT_ENABLED) {
       this.dispatchMessageAdd(networkInfo);
     } else {
       this.webConsoleFrame.handleNetworkEvent(networkInfo);
     }
@@ -370,17 +367,17 @@ WebConsoleConnectionProxy.prototype = {
    * the UI for displaying.
    *
    * @private
    * @param string type
    *        Message type.
    * @param object response
    *        The update response received from the server.
    */
-  _onNetworkEventUpdate: function (type, response) {
+  _onNetworkEventUpdate: function(type, response) {
     if (!this.webConsoleFrame) {
       return;
     }
     let { packet, networkInfo } = response;
     if (this.webConsoleFrame.NEW_CONSOLE_OUTPUT_ENABLED) {
       this.dispatchMessageUpdate(networkInfo, response);
     } else {
       this.webConsoleFrame.handleNetworkEventUpdate(networkInfo, packet);
@@ -391,27 +388,27 @@ WebConsoleConnectionProxy.prototype = {
    * the UI for displaying.
    *
    * @private
    * @param string type
    *        Message type.
    * @param object packet
    *        The message received from the server.
    */
-  _onFileActivity: function (type, packet) {
+  _onFileActivity: function(type, packet) {
     if (!this.webConsoleFrame || packet.from != this._consoleActor) {
       return;
     }
     if (this.webConsoleFrame.NEW_CONSOLE_OUTPUT_ENABLED) {
       // TODO: Implement for new console
     } else {
       this.webConsoleFrame.handleFileActivity(packet.uri);
     }
   },
-  _onReflowActivity: function (type, packet) {
+  _onReflowActivity: function(type, packet) {
     if (!this.webConsoleFrame || packet.from != this._consoleActor) {
       return;
     }
     if (this.webConsoleFrame.NEW_CONSOLE_OUTPUT_ENABLED) {
       // TODO: Implement for new console
     } else {
       this.webConsoleFrame.handleReflowActivity(packet);
     }
@@ -421,17 +418,17 @@ WebConsoleConnectionProxy.prototype = {
    * the UI for displaying.
    *
    * @private
    * @param string type
    *        Message type.
    * @param object packet
    *        The message received from the server.
    */
-  _onServerLogCall: function (type, packet) {
+  _onServerLogCall: function(type, packet) {
     if (!this.webConsoleFrame || packet.from != this._consoleActor) {
       return;
     }
     if (this.webConsoleFrame.NEW_CONSOLE_OUTPUT_ENABLED) {
       // TODO: Implement for new console
     } else {
       this.webConsoleFrame.handleConsoleAPICall(packet.message);
     }
@@ -441,59 +438,59 @@ WebConsoleConnectionProxy.prototype = {
    * received the Web Console UI is cleared.
    *
    * @private
    * @param string type
    *        Message type.
    * @param object packet
    *        The message received from the server.
    */
-  _onLastPrivateContextExited: function (type, packet) {
+  _onLastPrivateContextExited: function(type, packet) {
     if (this.webConsoleFrame && packet.from == this._consoleActor) {
       this.webConsoleFrame.jsterm.clearPrivateMessages();
     }
   },
 
   /**
    * The "will-navigate" and "navigate" event handlers. We redirect any message
    * to the UI for displaying.
    *
    * @private
    * @param string event
    *        Event type.
    * @param object packet
    *        The message received from the server.
    */
-  _onTabNavigated: function (event, packet) {
+  _onTabNavigated: function(event, packet) {
     if (!this.webConsoleFrame) {
       return;
     }
 
     this.webConsoleFrame.handleTabNavigated(event, packet);
   },
 
   /**
    * Release an object actor.
    *
    * @param string actor
    *        The actor ID to send the request to.
    */
-  releaseActor: function (actor) {
+  releaseActor: function(actor) {
     if (this.client) {
       this.client.release(actor);
     }
   },
 
   /**
    * Disconnect the Web Console from the remote server.
    *
    * @return object
    *         A promise object that is resolved when disconnect completes.
    */
-  disconnect: function () {
+  disconnect: function() {
     if (this._disconnecter) {
       return this._disconnecter.promise;
     }
 
     this._disconnecter = defer();
 
     if (!this.client) {
       this._disconnecter.resolve(null);