B2G/gecko/testing/marionette/marionette-server.js
/**
   * Create a new session. This creates a BrowserObj.
   *
   * In a desktop environment, this opens a new 'about:blank' tab for 
   * the client to test in.
   *
   */
Create a new session. This creates a BrowserObj.
In a desktop environment, this opens a new 'about:blank' tab for
the client to test in.
Create a new session . This creates a BrowserObj . In a desktop environment this opens a new ' about : blank ' tab for the client to test in .
function MDA_newSession() {
    this.command_id = this.getCommandId();
    this.newSessionCommandId = this.command_id;
    this.scriptTimeout = 10000;
    function waitForWindow() {
      let checkTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
      let win = this.getCurrentWindow();
      if (!win ||
          (appName == "Firefox" && !win.gBrowser) ||
          (appName == "Fennec" && !win.BrowserApp)) { 
        checkTimer.initWithCallback(waitForWindow.bind(this), 100, Ci.nsITimer.TYPE_ONE_SHOT);
      }
      else {
        this.startBrowser(win, true);
      }
    }
    this.switchToGlobalMessageManager();
    if (!Services.prefs.getBoolPref("marionette.contentListener")) {
      waitForWindow.call(this);
    }
    else if ((appName != "Firefox") && (this.curBrowser == null)) {
      this.addBrowser(this.getCurrentWindow());
      this.curBrowser.startSession(false, this.getCurrentWindow(), this.whenBrowserStarted);
      this.messageManager.broadcastAsyncMessage("Marionette:restart", {});
    }
    else {
      this.sendError("Session already running", 500, null, this.command_id);
    }
  }
function MDA_newSession ( ) { this . command_id = this . getCommandId ( ) ; this . newSessionCommandId = this . command_id ; this . scriptTimeout = 10000 ; function waitForWindow ( ) { let checkTimer = Cc [ "@mozilla.org/timer;1" ] . createInstance ( Ci . nsITimer ) ; let win = this . getCurrentWindow ( ) ; if ( ! win || ( appName == "Firefox" && ! win . gBrowser ) || ( appName == "Fennec" && ! win . BrowserApp ) ) { checkTimer . initWithCallback ( waitForWindow . bind ( this ) , 100 , Ci . nsITimer . TYPE_ONE_SHOT ) ; } else { this . startBrowser ( win , true ) ; } } this . switchToGlobalMessageManager ( ) ; if ( ! Services . prefs . getBoolPref ( "marionette.contentListener" ) ) { waitForWindow . call ( this ) ; } else if ( ( appName != "Firefox" ) && ( this . curBrowser == null ) ) { this . addBrowser ( this . getCurrentWindow ( ) ) ; this . curBrowser . startSession ( false , this . getCurrentWindow ( ) , this . whenBrowserStarted ) ; this . messageManager . broadcastAsyncMessage ( "Marionette:restart" , { } ) ; } else { this . sendError ( "Session already running" , 500 , null , this . command_id ) ; } }
Create a new session.
Create a new session .
//if there is a content listener, then we just wake it up