Bug 1493832 - marionette: cleanup dead code from server.js r=ato
authorAndrey Lushnikov <aslushnikov@gmail.com>
Wed, 03 Oct 2018 15:11:43 +0000
changeset 495144 347e93fd4d032db27bd760140cee7dfd3ab5e6d4
parent 495143 328a8076c760f5d152b2fdf4607530e32fc09349
child 495145 ed9b268816b4eaa409b7587e36ea267ce604ce3c
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato
bugs1493832
milestone64.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 1493832 - marionette: cleanup dead code from server.js r=ato Differential Revision: https://phabricator.services.mozilla.com/D6732
testing/marionette/server.js
--- a/testing/marionette/server.js
+++ b/testing/marionette/server.js
@@ -179,19 +179,16 @@ class TCPConnection {
     // callback for when connection is closed
     this.onclose = null;
 
     // last received/sent message ID
     this.lastID = 0;
 
     this.driver = driverFactory();
     this.driver.init();
-
-    // lookup of commands sent by server to client by message ID
-    this.commands_ = new Map();
   }
 
   /**
    * Debugger transport callback that cleans up
    * after a connection is closed.
    */
   onClosed() {
     this.driver.deleteSession();
@@ -229,27 +226,23 @@ class TCPConnection {
       msg.origin = Message.Origin.Client;
       this.log_(msg);
     } catch (e) {
       let resp = this.createResponse(data[1]);
       resp.sendError(e);
       return;
     }
 
-    // look up previous command we received a response for
-    if (msg instanceof Response) {
-      let cmd = this.commands_.get(msg.id);
-      this.commands_.delete(msg.id);
-      cmd.onresponse(msg);
-
     // execute new command
-    } else if (msg instanceof Command) {
+    if (msg instanceof Command) {
       (async () => {
         await this.execute(msg);
       })();
+    } else {
+      logger.fatal("Cannot process messages other than Command");
     }
   }
 
   /**
    * Executes a Marionette command and sends back a response when it
    * has finished executing.
    *
    * If the command implementation sends the response itself by calling
@@ -352,21 +345,20 @@ class TCPConnection {
    * Whilst responses to commands are synchronous and must be sent in the
    * correct order.
    *
    * @param {Message} msg
    *     The command or response to send.
    */
   send(msg) {
     msg.origin = Message.Origin.Server;
-    if (msg instanceof Command) {
-      this.commands_.set(msg.id, msg);
-      this.sendToEmulator(msg);
-    } else if (msg instanceof Response) {
+    if (msg instanceof Response) {
       this.sendToClient(msg);
+    } else {
+      logger.fatal("Cannot send messages other than Response");
     }
   }
 
   // Low-level methods:
 
   /**
    * Send given response to the client over the debugger transport socket.
    *