B2G/gecko/b2g/components/ErrorPage.jsm
/**
   * Attempt to download the certificate for the location specified to get
   * the SSLState for the certificate and the errors.
   */
Attempt to download the certificate for the location specified to get
the SSLState for the certificate and the errors.
Attempt to download the certificate for the location specified to get the SSLState for the certificate and the errors .
function SSLE_checkCert() {
    this._sslStatus = null;
    if (!this._uri) {
      return;
    }
    let req = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
                .createInstance(Ci.nsIXMLHttpRequest);
    try {
      req.open("GET", this._uri.prePath, true);
      req.channel.notificationCallbacks = this;
      let xhrHandler = (function() {
        req.removeEventListener("load", xhrHandler);
        req.removeEventListener("error", xhrHandler);
        if (!this._sslStatus) {
          if (this._finishCallback) {
            this._finishCallback();
          }
        }
      }).bind(this);
      req.addEventListener("load", xhrHandler);
      req.addEventListener("error", xhrHandler);
      req.send(null);
    } catch (e) {
      Components.utils.reportError("Attempted to connect to a site with a bad certificate in the add exception dialog. " +
                                   "This results in a (mostly harmless) exception being thrown. " +
                                   "Logged for information purposes only: " + e);
    }
  }
function SSLE_checkCert ( ) { this . _sslStatus = null ; if ( ! this . _uri ) { return ; } let req = Cc [ "@mozilla.org/xmlextras/xmlhttprequest;1" ] . createInstance ( Ci . nsIXMLHttpRequest ) ; try { req . open ( "GET" , this . _uri . prePath , true ) ; req . channel . notificationCallbacks = this ; let xhrHandler = ( function ( ) { req . removeEventListener ( "load" , xhrHandler ) ; req . removeEventListener ( "error" , xhrHandler ) ; if ( ! this . _sslStatus ) { if ( this . _finishCallback ) { this . _finishCallback ( ) ; } } } ) . bind ( this ) ; req . addEventListener ( "load" , xhrHandler ) ; req . addEventListener ( "error" , xhrHandler ) ; req . send ( null ) ; } catch ( e ) { Components . utils . reportError ( "Attempted to connect to a site with a bad certificate in the add exception dialog. " + "This results in a (mostly harmless) exception being thrown. " + "Logged for information purposes only: " + e ) ; } }
Attempt to download the certificate for the location specified to get
 the SSLState for the certificate and the errors.
Attempt to download the certificate for the location specified to get the SSLState for the certificate and the errors .
// Got response from server without an SSL error. // We *expect* exceptions if there are problems with the certificate // presented by the site.  Log it, just in case, but we can proceed here, // with appropriate sanity checks