B2G/gecko/testing/marionette/marionette-server.js
/**
   * Deletes the session.
   * 
   * If it is a desktop environment, it will close the session's tab and close all listeners
   *
   * If it is a B2G environment, it will make the main content listener sleep, and close
   * all other listeners. The main content listener persists after disconnect (it's the homescreen),
   * and can safely be reused.
   */
Deletes the session.

If it is a desktop environment, it will close the session's tab and close all listeners

If it is a B2G environment, it will make the main content listener sleep, and close
all other listeners. The main content listener persists after disconnect (it's the homescreen),
and can safely be reused.
Deletes the session . If it is a desktop environment it will close the session ' s tab and close all listeners If it is a B2G environment it will make the main content listener sleep and close all other listeners . The main content listener persists after disconnect ( it ' s the homescreen ) and can safely be reused .
function MDA_deleteSession() {
    let command_id = this.command_id = this.getCommandId();
    if (this.curBrowser != null) {
      if (appName == "B2G") {
        this.globalMessageManager.broadcastAsyncMessage(
            "Marionette:sleepSession" + this.curBrowser.mainContentId, {});
        this.curBrowser.knownFrames.splice(
            this.curBrowser.knownFrames.indexOf(this.curBrowser.mainContentId), 1);
      }
      else {
        Services.prefs.setBoolPref("marionette.contentListener", false);
      }
      this.curBrowser.closeTab();
      for (let win in this.browsers) {
        for (let i in this.browsers[win].knownFrames) {
          this.globalMessageManager.broadcastAsyncMessage("Marionette:deleteSession" + this.browsers[win].knownFrames[i], {});
        }
      }
      let winEnum = this.getWinEnumerator();
      while (winEnum.hasMoreElements()) {
        winEnum.getNext().messageManager.removeDelayedFrameScript(FRAME_SCRIPT); 
      }
    }
    this.sendOk(command_id);
    this.removeMessageManagerListeners(this.globalMessageManager);
    this.switchToGlobalMessageManager();
    this.curFrame = null;
    if (this.mainFrame) {
      this.mainFrame.focus();
    }
    this.curBrowser = null;
    try {
      this.importedScripts.remove(false);
    }
    catch (e) {
    }
  }
function MDA_deleteSession ( ) { let command_id = this . command_id = this . getCommandId ( ) ; if ( this . curBrowser != null ) { if ( appName == "B2G" ) { this . globalMessageManager . broadcastAsyncMessage ( "Marionette:sleepSession" + this . curBrowser . mainContentId , { } ) ; this . curBrowser . knownFrames . splice ( this . curBrowser . knownFrames . indexOf ( this . curBrowser . mainContentId ) , 1 ) ; } else { Services . prefs . setBoolPref ( "marionette.contentListener" , false ) ; } this . curBrowser . closeTab ( ) ; for ( let win in this . browsers ) { for ( let i in this . browsers [ win ] . knownFrames ) { this . globalMessageManager . broadcastAsyncMessage ( "Marionette:deleteSession" + this . browsers [ win ] . knownFrames [ i ] , { } ) ; } } let winEnum = this . getWinEnumerator ( ) ; while ( winEnum . hasMoreElements ( ) ) { winEnum . getNext ( ) . messageManager . removeDelayedFrameScript ( FRAME_SCRIPT ) ; } } this . sendOk ( command_id ) ; this . removeMessageManagerListeners ( this . globalMessageManager ) ; this . switchToGlobalMessageManager ( ) ; this . curFrame = null ; if ( this . mainFrame ) { this . mainFrame . focus ( ) ; } this . curBrowser = null ; try { this . importedScripts . remove ( false ) ; } catch ( e ) { } }
Deletes the session.
Deletes the session .
//don't set this pref for B2G since the framescript can be safely reused //delete session in each frame in each browser // reset frame to the top-most frame