Bug 1526832 Part 2 - Use onConsoleAPICall when sending log point messages to the client, r=lsmyth.
authorBrian Hackett <bhackett1024@gmail.com>
Sun, 10 Feb 2019 14:52:20 -1000
changeset 459558 b23892c07b8591cb99262bac3d97719c537036b0
parent 459557 b845c53036f494719110f400338dcae05031039f
child 459559 d576a84575c4763024514aa479a40fa5e7ce6114
push id111967
push userbhackett@mozilla.com
push dateFri, 15 Feb 2019 20:03:08 +0000
treeherdermozilla-inbound@b23892c07b85 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslsmyth
bugs1526832
milestone67.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 1526832 Part 2 - Use onConsoleAPICall when sending log point messages to the client, r=lsmyth.
devtools/client/webconsole/webconsole-connection-proxy.js
devtools/server/actors/breakpoint.js
devtools/shared/client/constants.js
--- a/devtools/client/webconsole/webconsole-connection-proxy.js
+++ b/devtools/client/webconsole/webconsole-connection-proxy.js
@@ -25,17 +25,16 @@ const PREF_CONNECTION_TIMEOUT = "devtool
 function WebConsoleConnectionProxy(webConsoleUI, target) {
   this.webConsoleUI = webConsoleUI;
   this.target = target;
   this.webConsoleClient = target.activeConsole;
 
   this._onPageError = this._onPageError.bind(this);
   this._onLogMessage = this._onLogMessage.bind(this);
   this._onConsoleAPICall = this._onConsoleAPICall.bind(this);
-  this._onVirtualConsoleLog = this._onVirtualConsoleLog.bind(this);
   this._onNetworkEvent = this._onNetworkEvent.bind(this);
   this._onNetworkEventUpdate = this._onNetworkEventUpdate.bind(this);
   this._onTabNavigated = this._onTabNavigated.bind(this);
   this._onTabWillNavigate = this._onTabWillNavigate.bind(this);
   this._onAttachConsole = this._onAttachConsole.bind(this);
   this._onCachedMessages = this._onCachedMessages.bind(this);
   this._connectionTimeout = this._connectionTimeout.bind(this);
   this._onLastPrivateContextExited =
@@ -123,18 +122,16 @@ WebConsoleConnectionProxy.prototype = {
 
     const client = this.client = this.target.client;
 
     client.addListener("logMessage", this._onLogMessage);
     client.addListener("pageError", this._onPageError);
     client.addListener("consoleAPICall", this._onConsoleAPICall);
     client.addListener("lastPrivateContextExited",
                        this._onLastPrivateContextExited);
-    client.addListener("virtualConsoleLog",
-                       this._onVirtualConsoleLog);
 
     this.target.on("will-navigate", this._onTabWillNavigate);
     this.target.on("navigate", this._onTabNavigated);
 
     if (this.target.isBrowsingContext) {
       this.webConsoleUI.onLocationChange(this.target.url, this.target.title);
     }
     this.isAttached = this._attachConsole();
@@ -308,36 +305,16 @@ WebConsoleConnectionProxy.prototype = {
   _onConsoleAPICall: function(type, packet) {
     if (!this.webConsoleUI || packet.from != this.webConsoleClient.actor) {
       return;
     }
     this.dispatchMessageAdd(packet);
   },
 
   /**
-   * Virtual console log packets come from log point hits and are converted into
-   * normal console API packets.
-   */
-  _onVirtualConsoleLog: function(type, packet) {
-    if (!this.webConsoleUI) {
-      return;
-    }
-    this.dispatchMessageAdd({
-      type: "consoleAPICall",
-      message: {
-        executionPoint: packet.executionPoint,
-        "arguments": [packet.message],
-        filename: packet.url,
-        lineNumber: packet.line,
-        columnNumber: packet.column,
-      },
-    });
-  },
-
-  /**
    * The "networkEvent" message type handler. We redirect any message to
    * the UI for displaying.
    *
    * @private
    * @param object networkInfo
    *        The network request information.
    */
   _onNetworkEvent: function(networkInfo) {
@@ -440,18 +417,16 @@ WebConsoleConnectionProxy.prototype = {
       return this._disconnecter.promise;
     }
 
     this.client.removeListener("logMessage", this._onLogMessage);
     this.client.removeListener("pageError", this._onPageError);
     this.client.removeListener("consoleAPICall", this._onConsoleAPICall);
     this.client.removeListener("lastPrivateContextExited",
                                this._onLastPrivateContextExited);
-    this.client.removeListener("virtualConsoleLog",
-                               this._onVirtualConsoleLog);
     this.webConsoleClient.off("networkEvent", this._onNetworkEvent);
     this.webConsoleClient.off("networkEventUpdate", this._onNetworkEventUpdate);
     this.target.off("will-navigate", this._onTabWillNavigate);
     this.target.off("navigate", this._onTabNavigated);
 
     this.client = null;
     this.webConsoleClient = null;
     this.target = null;
--- a/devtools/server/actors/breakpoint.js
+++ b/devtools/server/actors/breakpoint.js
@@ -94,26 +94,24 @@ BreakpointActor.prototype = {
       // When replaying, logging breakpoints are handled using an API to get logged
       // messages from throughout the recording.
       const oldLogValue = oldOptions && oldOptions.logValue;
       const newLogValue = newOptions && newOptions.logValue;
       if (oldLogValue != newLogValue) {
         for (const offset of offsets) {
           const { lineNumber, columnNumber } = script.getOffsetLocation(offset);
           script.replayVirtualConsoleLog(offset, newLogValue, (point, rv) => {
-            const packet = {
-              from: this.actorID,
-              type: "virtualConsoleLog",
-              url: script.url,
-              line: lineNumber,
-              column: columnNumber,
+            const message = {
+              filename: script.url,
+              lineNumber,
+              columnNumber,
               executionPoint: point,
-              message: "return" in rv ? "" + rv.return : "" + rv.throw,
+              "arguments": ["return" in rv ? rv.return : rv.throw],
             };
-            this.conn.send(packet);
+            this.threadActor._parent._consoleActor.onConsoleAPICall(message);
           });
         }
       }
     }
   },
 
   /**
    * Check if this breakpoint has a condition that doesn't error and
--- a/devtools/shared/client/constants.js
+++ b/devtools/shared/client/constants.js
@@ -32,17 +32,16 @@ const UnsolicitedNotifications = {
   "reflowActivity": "reflowActivity",
   "addonListChanged": "addonListChanged",
   "workerListChanged": "workerListChanged",
   "serviceWorkerRegistrationListChanged": "serviceWorkerRegistrationList",
   "pageError": "pageError",
   "evaluationResult": "evaluationResult",
   "updatedSource": "updatedSource",
   "inspectObject": "inspectObject",
-  "virtualConsoleLog": "virtualConsoleLog",
 
   // newSource is still emitted on the ThreadActor, in addition to the
   // BrowsingContextActor we have to keep it here until ThreadClient is converted to
   // ThreadFront and/or we stop emitting this duplicated events.
   // See ThreadActor.onNewSourceEvent.
   "newSource": "newSource",
 };