Bug 1378865 - Stop using sdk/core/heritage in DevTools shared webconsole server logger; r=zer0
authorJan Odvarko <odvarko@gmail.com>
Fri, 07 Jul 2017 15:16:56 +0200
changeset 611667 cfb0810a9bf3a9f3bd00a74d84207259d474f74b
parent 611666 af4655e3719ae83b55bb4654e3cbcdd496bd4062
child 611668 6a297d875e0e59a4434f22d3834c04f78d953d9f
push id69287
push userCallek@gmail.com
push dateThu, 20 Jul 2017 01:11:37 +0000
reviewerszer0
bugs1378865
milestone56.0a1
Bug 1378865 - Stop using sdk/core/heritage in DevTools shared webconsole server logger; r=zer0 MozReview-Commit-ID: ADFdvBWWMZL
devtools/shared/webconsole/server-logger.js
--- a/devtools/shared/webconsole/server-logger.js
+++ b/devtools/shared/webconsole/server-logger.js
@@ -2,19 +2,17 @@
 /* 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} = require("chrome");
-const {Class} = require("sdk/core/heritage");
 const Services = require("Services");
-
 const {DebuggerServer} = require("devtools/server/main");
 const DevToolsUtils = require("devtools/shared/DevToolsUtils");
 
 loader.lazyGetter(this, "NetworkHelper", () => require("devtools/shared/webconsole/network-helper"));
 
 // Helper tracer. Should be generic sharable by other modules (bug 1171927)
 const trace = {
   log: function () {
@@ -30,42 +28,38 @@ const acceptableHeaders = ["x-chromelogg
  * within HTTP headers and sending them to the client.
  *
  * The logic is based on "http-on-examine-response" event that is
  * sent when a response from the server is received. Consequently HTTP
  * headers are parsed to find server side logs.
  *
  * A listeners for "http-on-examine-response" is registered when
  * the listener starts and removed when destroy is executed.
+ *
+ * @param {Object} win (nsIDOMWindow):
+ *        filter network requests by the associated window object.
+ *        If null (i.e. in the browser context) log everything
+ * @param {Object} owner
+ *        The {@WebConsoleActor} instance
  */
-var ServerLoggingListener = Class({
-  /**
-   * Initialization of the listener. The main step during the initialization
-   * process is registering a listener for "http-on-examine-response" event.
-   *
-   * @param {Object} win (nsIDOMWindow):
-   *        filter network requests by the associated window object.
-   *        If null (i.e. in the browser context) log everything
-   * @param {Object} owner
-   *        The {@WebConsoleActor} instance
-   */
-  initialize: function (win, owner) {
-    trace.log("ServerLoggingListener.initialize; ", owner.actorID,
-      ", child process: ", DebuggerServer.isInChildProcess);
+function ServerLoggingListener(win, owner) {
+  trace.log("ServerLoggingListener.initialize; ", owner.actorID,
+    ", child process: ", DebuggerServer.isInChildProcess);
+
+  this.owner = owner;
+  this.window = win;
 
-    this.owner = owner;
-    this.window = win;
+  this.onExamineResponse = this.onExamineResponse.bind(this);
+  this.onExamineHeaders = this.onExamineHeaders.bind(this);
+  this.onParentMessage = this.onParentMessage.bind(this);
 
-    this.onExamineResponse = this.onExamineResponse.bind(this);
-    this.onExamineHeaders = this.onExamineHeaders.bind(this);
-    this.onParentMessage = this.onParentMessage.bind(this);
+  this.attach();
+}
 
-    this.attach();
-  },
-
+ServerLoggingListener.prototype = {
   /**
    * The destroy is called by the parent WebConsoleActor actor.
    */
   destroy: function () {
     trace.log("ServerLoggingListener.destroy; ", this.owner.actorID,
       ", child process: ", DebuggerServer.isInChildProcess);
 
     this.detach();
@@ -372,17 +366,17 @@ var ServerLoggingListener = Class({
       }
     }
 
     trace.log("ServerLoggingListener.sendMessage; raw: ",
       msg.logs.join(", "), message);
 
     this.owner.onServerLogCall(message);
   },
-});
+};
 
 // Helpers
 
 /**
  * Parse printf-like specifiers ("%f", "%d", ...) and
  * format the logs according to them.
  */
 function format(msg) {