Bug 1519133 - replace _actor field with protocol.js actorID field; r=ochameau
authoryulia <ystartsev@mozilla.com>
Thu, 17 Jan 2019 10:11:36 +0000
changeset 514241 655570f6b2eb5bcc1683e8846e2b90d6e81a7d54
parent 514240 9fedba33cfa3ceb88437433072951f26bf9f9a90
child 514242 494b88d492b13cdb790e6f503635db5bc022e8c2
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersochameau
bugs1519133
milestone66.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 1519133 - replace _actor field with protocol.js actorID field; r=ochameau Differential Revision: https://phabricator.services.mozilla.com/D16702
devtools/shared/webconsole/client.js
--- a/devtools/shared/webconsole/client.js
+++ b/devtools/shared/webconsole/client.js
@@ -16,17 +16,17 @@ const LongStringClient = require("devtoo
  *
  * @param object debuggerClient
  *        The DebuggerClient instance we live for.
  * @param object response
  *        The response packet received from the "startListeners" request sent to
  *        the WebConsoleActor.
  */
 function WebConsoleClient(debuggerClient, response) {
-  this._actor = response.from;
+  this.actorID = response.from;
   this._client = debuggerClient;
   this._longStrings = {};
   this.traits = response.traits || {};
 
   /**
    * Tells if the window.console object of the remote web page is the native
    * object or not.
    * @private
@@ -78,31 +78,31 @@ WebConsoleClient.prototype = {
     this._networkRequests.delete(actorId);
   },
 
   getNetworkEvents() {
     return this._networkRequests.values();
   },
 
   get actor() {
-    return this._actor;
+    return this.actorID;
   },
 
   /**
    * The "networkEvent" message type handler. We redirect any message to
    * the UI for displaying.
    *
    * @private
    * @param string type
    *        Message type.
    * @param object packet
    *        The message received from the server.
    */
   _onNetworkEvent: function(type, packet) {
-    if (packet.from == this._actor) {
+    if (packet.from == this.actorID) {
       const actor = packet.eventActor;
       const networkInfo = {
         _type: "NetworkEvent",
         timeStamp: actor.timeStamp,
         node: null,
         actor: actor.actor,
         discardRequestBody: true,
         discardResponseBody: true,
@@ -226,17 +226,17 @@ WebConsoleClient.prototype = {
    *        this.CACHED_MESSAGES for known types.
    * @param function onResponse
    *        The function invoked when the response is received.
    * @return request
    *         Request object that implements both Promise and EventEmitter interfaces
    */
   getCachedMessages: function(types, onResponse) {
     const packet = {
-      to: this._actor,
+      to: this.actorID,
       type: "getCachedMessages",
       messageTypes: types,
     };
     return this._client.request(packet, onResponse);
   },
 
   /**
    * Inspect the properties of an object.
@@ -292,17 +292,17 @@ WebConsoleClient.prototype = {
    *        exists. This is used by helper functions that can
    *        reference the currently selected node in the Inspector,
    *        like $0.
    * @return request
    *         Request object that implements both Promise and EventEmitter interfaces
    */
   evaluateJS: function(string, onResponse, options = {}) {
     const packet = {
-      to: this._actor,
+      to: this.actorID,
       type: "evaluateJS",
       text: string,
       bindObjectActor: options.bindObjectActor,
       frameActor: options.frameActor,
       url: options.url,
       selectedNodeActor: options.selectedNodeActor,
       selectedObjectActor: options.selectedObjectActor,
     };
@@ -310,17 +310,17 @@ WebConsoleClient.prototype = {
   },
 
   /**
    * Evaluate a JavaScript expression asynchronously.
    * See evaluateJS for parameter and response information.
    */
   evaluateJSAsync: function(string, onResponse, options = {}) {
     const packet = {
-      to: this._actor,
+      to: this.actorID,
       type: "evaluateJSAsync",
       text: string,
       bindObjectActor: options.bindObjectActor,
       frameActor: options.frameActor,
       url: options.url,
       selectedNodeActor: options.selectedNodeActor,
       selectedObjectActor: options.selectedObjectActor,
       mapped: options.mapped,
@@ -348,17 +348,17 @@ WebConsoleClient.prototype = {
 
   /**
    * Handler for the actors's unsolicited evaluationResult packet.
    */
   onEvaluationResult: function(notification, packet) {
     // The client on the main thread can receive notification packets from
     // multiple webconsole actors: the one on the main thread and the ones
     // on worker threads.  So make sure we should be handling this request.
-    if (packet.from !== this._actor) {
+    if (packet.from !== this.actorID) {
       return;
     }
 
     // Find the associated callback based on this ID, and fire it.
     // In a sync evaluation, this would have already been called in
     // direct response to the client.request function.
     const onResponse = this.pendingEvaluationResults.get(packet.resultID);
     if (onResponse) {
@@ -391,17 +391,17 @@ WebConsoleClient.prototype = {
   autocomplete: function(
     string,
     cursor,
     frameActor,
     selectedNodeActor,
     authorizedEvaluations
   ) {
     const packet = {
-      to: this._actor,
+      to: this.actorID,
       type: "autocomplete",
       text: string,
       cursor,
       frameActor,
       selectedNodeActor,
       authorizedEvaluations,
     };
     return this._client.request(packet);
@@ -410,17 +410,17 @@ WebConsoleClient.prototype = {
   /**
    * Clear the cache of messages (page errors and console API calls).
    *
    * @return request
    *         Request object that implements both Promise and EventEmitter interfaces
    */
   clearMessagesCache: function() {
     const packet = {
-      to: this._actor,
+      to: this.actorID,
       type: "clearMessagesCache",
     };
     return this._client.request(packet);
   },
 
   /**
    * Get Web Console-related preferences on the server.
    *
@@ -428,17 +428,17 @@ WebConsoleClient.prototype = {
    *        An array with the preferences you want to retrieve.
    * @param function [onResponse]
    *        Optional function to invoke when the response is received.
    * @return request
    *         Request object that implements both Promise and EventEmitter interfaces
    */
   getPreferences: function(preferences, onResponse) {
     const packet = {
-      to: this._actor,
+      to: this.actorID,
       type: "getPreferences",
       preferences: preferences,
     };
     return this._client.request(packet, onResponse);
   },
 
   /**
    * Set Web Console-related preferences on the server.
@@ -447,17 +447,17 @@ WebConsoleClient.prototype = {
    *        An object with the preferences you want to change.
    * @param function [onResponse]
    *        Optional function to invoke when the response is received.
    * @return request
    *         Request object that implements both Promise and EventEmitter interfaces
    */
   setPreferences: function(preferences, onResponse) {
     const packet = {
-      to: this._actor,
+      to: this.actorID,
       type: "setPreferences",
       preferences: preferences,
     };
     return this._client.request(packet, onResponse);
   },
 
   /**
    * Retrieve the request headers from the given NetworkEventActor.
@@ -646,17 +646,17 @@ WebConsoleClient.prototype = {
    *        The details of the HTTP request.
    * @param function onResponse
    *        The function invoked when the response is received.
    * @return request
    *         Request object that implements both Promise and EventEmitter interfaces
    */
   sendHTTPRequest: function(data, onResponse) {
     const packet = {
-      to: this._actor,
+      to: this.actorID,
       type: "sendHTTPRequest",
       request: data,
     };
     return this._client.request(packet, onResponse);
   },
 
   /**
    * Start the given Web Console listeners.
@@ -667,17 +667,17 @@ WebConsoleClient.prototype = {
    *        known listeners.
    * @param function onResponse
    *        Function to invoke when the server response is received.
    * @return request
    *         Request object that implements both Promise and EventEmitter interfaces
    */
   startListeners: function(listeners, onResponse) {
     const packet = {
-      to: this._actor,
+      to: this.actorID,
       type: "startListeners",
       listeners: listeners,
     };
     return this._client.request(packet, onResponse);
   },
 
   /**
    * Stop the given Web Console listeners.
@@ -688,17 +688,17 @@ WebConsoleClient.prototype = {
    *        known listeners.
    * @param function onResponse
    *        Function to invoke when the server response is received.
    * @return request
    *         Request object that implements both Promise and EventEmitter interfaces
    */
   stopListeners: function(listeners, onResponse) {
     const packet = {
-      to: this._actor,
+      to: this.actorID,
       type: "stopListeners",
       listeners: listeners,
     };
     return this._client.request(packet, onResponse);
   },
 
   /**
    * Return an instance of LongStringClient for the given long string grip.