B2G/gecko/testing/marionette/marionette-server.js
/**
   * Switch to a window based on name or server-assigned id.
   * Searches based on name, then id.
   *
   * @param object aRequest
   *        'value' member holds the name or id of the window to switch to
   */
Switch to a window based on name or server-assigned id.
Searches based on name, then id.

@param object aRequest
'value' member holds the name or id of the window to switch to
Switch to a window based on name or server - assigned id . Searches based on name then id . @param object aRequest ' value ' member holds the name or id of the window to switch to
function MDA_switchToWindow(aRequest) {
    let command_id = this.command_id = this.getCommandId();
    let winEn = this.getWinEnumerator(); 
    while(winEn.hasMoreElements()) {
      let foundWin = winEn.getNext();
      let winId = foundWin.QueryInterface(Ci.nsIInterfaceRequestor)
                          .getInterface(Ci.nsIDOMWindowUtils)
                          .outerWindowID;
      winId = winId + ((appName == "B2G") ? '-b2g' : '');
      if (aRequest.value == foundWin.name || aRequest.value == winId) {
        if (this.browsers[winId] == undefined) {
          this.startBrowser(foundWin, false);
        }
        else {
          utils.window = foundWin;
          this.curBrowser = this.browsers[winId];
        }
        this.sendOk(command_id);
        return;
      }
    }
    this.sendError("Unable to locate window " + aRequest.value, 23, null,
                   command_id);
  }
function MDA_switchToWindow ( aRequest ) { let command_id = this . command_id = this . getCommandId ( ) ; let winEn = this . getWinEnumerator ( ) ; while ( winEn . hasMoreElements ( ) ) { let foundWin = winEn . getNext ( ) ; let winId = foundWin . QueryInterface ( Ci . nsIInterfaceRequestor ) . getInterface ( Ci . nsIDOMWindowUtils ) . outerWindowID ; winId = winId + ( ( appName == "B2G" ) ? '-b2g' : '' ) ; if ( aRequest . value == foundWin . name || aRequest . value == winId ) { if ( this . browsers [ winId ] == undefined ) { this . startBrowser ( foundWin , false ) ; } else { utils . window = foundWin ; this . curBrowser = this . browsers [ winId ] ; } this . sendOk ( command_id ) ; return ; } } this . sendError ( "Unable to locate window " + aRequest . value , 23 , null , command_id ) ; }
Switch to a window based on name or server-assigned id.
Switch to a window based on name or server - assigned id .
//enable Marionette in that browser window