B2G/gecko/testing/marionette/marionette-server.js
/**
   * Generic method to pass a response to the client
   *
   * @param object msg
   *        Response to send back to client
   * @param string command_id
   *        Unique identifier assigned to the client's request.
   *        Used to distinguish the asynchronous responses.
   */
Generic method to pass a response to the client
@param object msg
Response to send back to client
@param string command_id
Unique identifier assigned to the client's request.
Used to distinguish the asynchronous responses.
Generic method to pass a response to the client @param object msg Response to send back to client @param string command_id Unique identifier assigned to the client ' s request . Used to distinguish the asynchronous responses .
function MDA_sendToClient(msg, command_id) {
    logger.info("sendToClient: " + JSON.stringify(msg) + ", " + command_id +
                ", " + this.command_id);
    if (!command_id) {
      logger.warn("got a response with no command_id");
      return;
    }
    else if (command_id != -1) {
      if (!this.command_id) {
        logger.warn("ignoring duplicate response for command_id " + command_id);
        return;
      }
      else if (this.command_id != command_id) {
        logger.warn("ignoring out-of-sync response");
        return;
      }
    }
    this.conn.send(msg);
    if (command_id != -1) {
      this.command_id = null;
    }
  }
function MDA_sendToClient ( msg , command_id ) { logger . info ( "sendToClient: " + JSON . stringify ( msg ) + ", " + command_id + ", " + this . command_id ) ; if ( ! command_id ) { logger . warn ( "got a response with no command_id" ) ; return ; } else if ( command_id != - 1 ) { if ( ! this . command_id ) { logger . warn ( "ignoring duplicate response for command_id " + command_id ) ; return ; } else if ( this . command_id != command_id ) { logger . warn ( "ignoring out-of-sync response" ) ; return ; } } this . conn . send ( msg ) ; if ( command_id != - 1 ) { this . command_id = null ; } }
Generic method to pass a response to the client
 @param object msg
        Response to send back to client
 @param string command_id
        Unique identifier assigned to the client's request.
Generic method to pass a response to the client @param object msg Response to send back to client @param string command_id Unique identifier assigned to the client ' s request .
// A command_id of -1 is used for emulator callbacks, and those // don't use this.command_id. // A null value for this.command_id means we've already processed // a message for the previous value, and so the current message is a // duplicate. // Don't unset this.command_id if this message is to process an // emulator callback, since another response for this command_id is // expected, after the containing call to execute_async_script finishes.