B2G/gecko/testing/marionette/marionette-server.js
/**
   * execute pure JS script. Used to execute 'mochitest'-style Marionette tests.
   *
   * @param object aRequest
   *        'value' member holds the script to execute
   *        'args' member holds the arguments to the script
   *        'timeout' member will be used as the script timeout if it is given
   */
execute pure JS script. Used to execute 'mochitest'-style Marionette tests.
execute pure JS script . Used to execute ' mochitest ' - style Marionette tests .
function MDA_executeJSScript(aRequest) {
    let timeout = aRequest.scriptTimeout ? aRequest.scriptTimeout : this.scriptTimeout;
    let command_id = this.command_id = this.getCommandId();
    if (aRequest.newSandbox == undefined) {
      aRequest.newSandbox = true;
    }
    if (this.context == "chrome") {
      if (aRequest.async) {
        this.executeWithCallback(aRequest, aRequest.async);
      }
      else {
        this.execute(aRequest, true);
      }
    }
    else {
      this.sendAsync("executeJSScript",
                     {
                       value: aRequest.value,
                       args: aRequest.args,
                       newSandbox: aRequest.newSandbox,
                       async: aRequest.async,
                       timeout: timeout,
                       specialPowers: aRequest.specialPowers,
                       filename: aRequest.filename,
                       line: aRequest.line,
                     },
                     command_id);
   }
  }
function MDA_executeJSScript ( aRequest ) { let timeout = aRequest . scriptTimeout ? aRequest . scriptTimeout : this . scriptTimeout ; let command_id = this . command_id = this . getCommandId ( ) ; if ( aRequest . newSandbox == undefined ) { aRequest . newSandbox = true ; } if ( this . context == "chrome" ) { if ( aRequest . async ) { this . executeWithCallback ( aRequest , aRequest . async ) ; } else { this . execute ( aRequest , true ) ; } } else { this . sendAsync ( "executeJSScript" , { value : aRequest . value , args : aRequest . args , newSandbox : aRequest . newSandbox , async : aRequest . async , timeout : timeout , specialPowers : aRequest . specialPowers , filename : aRequest . filename , line : aRequest . line , } , command_id ) ; } }
execute pure JS script.
execute pure JS script .
//all pure JS scripts will need to call Marionette.finish() to complete the test. //if client does not send a value in newSandbox,  //then they expect the same behaviour as webdriver