B2G/gecko/browser/devtools/debugger/debugger-controller.js
/**
   * Prepares the hostname and port number for a remote debugger connection
   * and handles connection retries and timeouts.
   *
   * @return boolean true if connection should proceed normally
   */
Prepares the hostname and port number for a remote debugger connection
and handles connection retries and timeouts.

@return boolean true if connection should proceed normally
Prepares the hostname and port number for a remote debugger connection and handles connection retries and timeouts . @return boolean true if connection should proceed normally
function DC__prepareConnection() {
    if (this._remoteConnectionTry === Prefs.remoteConnectionRetries) {
      Services.prompt.alert(null,
        L10N.getStr("remoteDebuggerPromptTitle"),
        L10N.getStr("remoteDebuggerConnectionFailedMessage"));
      this.dispatchEvent("Debugger:Close");
      return false;
    }
    if (!Prefs.remoteAutoConnect) {
      let prompt = new RemoteDebuggerPrompt();
      let result = prompt.show(!!this._remoteConnectionTimeout);
      if (!result && !DebuggerController.activeThread) {
        this.dispatchEvent("Debugger:Close");
        return false;
      }
      Prefs.remoteHost = prompt.remote.host;
      Prefs.remotePort = prompt.remote.port;
    }
    this._remoteConnectionTry = ++this._remoteConnectionTry || 1;
    this._remoteConnectionTimeout = window.setTimeout(function() {
      if (!DebuggerController.activeThread) {
        DebuggerController._onRemoteConnectionTimeout();
        DebuggerController._connect();
      }
    }, Prefs.remoteTimeout);
    return true;
  }
function DC__prepareConnection ( ) { if ( this . _remoteConnectionTry === Prefs . remoteConnectionRetries ) { Services . prompt . alert ( null , L10N . getStr ( "remoteDebuggerPromptTitle" ) , L10N . getStr ( "remoteDebuggerConnectionFailedMessage" ) ) ; this . dispatchEvent ( "Debugger:Close" ) ; return false ; } if ( ! Prefs . remoteAutoConnect ) { let prompt = new RemoteDebuggerPrompt ( ) ; let result = prompt . show ( ! ! this . _remoteConnectionTimeout ) ; if ( ! result && ! DebuggerController . activeThread ) { this . dispatchEvent ( "Debugger:Close" ) ; return false ; } Prefs . remoteHost = prompt . remote . host ; Prefs . remotePort = prompt . remote . port ; } this . _remoteConnectionTry = ++ this . _remoteConnectionTry || 1 ; this . _remoteConnectionTimeout = window . setTimeout ( function ( ) { if ( ! DebuggerController . activeThread ) { DebuggerController . _onRemoteConnectionTimeout ( ) ; DebuggerController . _connect ( ) ; } } , Prefs . remoteTimeout ) ; return true ; }
Prepares the hostname and port number for a remote debugger connection
 and handles connection retries and timeouts.
Prepares the hostname and port number for a remote debugger connection and handles connection retries and timeouts .
// If we exceeded the total number of connection retries, bail. // TODO: This is ugly, need to rethink the design for the UI in #751677. // If the connection was not established before the user canceled the // prompt, close the remote debugger. // If this debugger is connecting remotely to a server, we need to check // after a while if the connection actually succeeded. // If we couldn't connect to any server yet, try again...