B2G/gecko/testing/marionette/marionette-server.js
/**
   * Closes the Browser Window.
   *
   * If it is B2G it returns straight away and does not do anything
   *
   * If is desktop it calculates how many windows are open and if there is only 
   * 1 then it deletes the session otherwise it closes the window
   */
Closes the Browser Window.
If it is B2G it returns straight away and does not do anything

If is desktop it calculates how many windows are open and if there is only
1 then it deletes the session otherwise it closes the window
Closes the Browser Window . If it is B2G it returns straight away and does not do anything If is desktop it calculates how many windows are open and if there is only 1 then it deletes the session otherwise it closes the window
function MDA_closeWindow() {
    let command_id = this.command_id = this.getCommandId();
    if (appName == "B2G") {
      this.sendOk(command_id);
    }
    else {
      let numOpenWindows = 0;
      let winEnum = this.getWinEnumerator();
      while (winEnum.hasMoreElements()) {
        numOpenWindows += 1;
        winEnum.getNext(); 
      }
      if (numOpenWindows === 1){
        this.deleteSession();
        return;
      }
      try{
        this.messageManager.removeDelayedFrameScript(FRAME_SCRIPT); 
        this.getCurrentWindow().close();
        this.sendOk(command_id);
      }
      catch (e) {
        this.sendError("Could not close window: " + e.message, 13, e.stack,
                       command_id);
      }
    }
  }
function MDA_closeWindow ( ) { let command_id = this . command_id = this . getCommandId ( ) ; if ( appName == "B2G" ) { this . sendOk ( command_id ) ; } else { let numOpenWindows = 0 ; let winEnum = this . getWinEnumerator ( ) ; while ( winEnum . hasMoreElements ( ) ) { numOpenWindows += 1 ; winEnum . getNext ( ) ; } if ( numOpenWindows === 1 ) { this . deleteSession ( ) ; return ; } try { this . messageManager . removeDelayedFrameScript ( FRAME_SCRIPT ) ; this . getCurrentWindow ( ) . close ( ) ; this . sendOk ( command_id ) ; } catch ( e ) { this . sendError ( "Could not close window: " + e . message , 13 , e . stack , command_id ) ; } } }
Closes the Browser Window.
Closes the Browser Window .
// We can't close windows so just return // Get the total number of windows // if there is only 1 window left, delete the session