B2G/gecko/security/manager/pki/resources/content/exceptionDialog.js
/**
 * Handle user request to add an exception for the specified cert
 */
Handle user request to add an exception for the specified cert
Handle user request to add an exception for the specified cert
function addException() {
  if(!gCert || !gSSLStatus)
    return;
  var overrideService = Components.classes["@mozilla.org/security/certoverride;1"]
                                  .getService(Components.interfaces.nsICertOverrideService);
  var flags = 0;
  let confirmBucketId = gNsISecTel.WARNING_BAD_CERT_CONFIRM_ADD_EXCEPTION_BASE;
  if (gSSLStatus.isUntrusted) {
    flags |= overrideService.ERROR_UNTRUSTED;
    confirmBucketId += gNsISecTel.WARNING_BAD_CERT_CONFIRM_ADD_EXCEPTION_FLAG_UNTRUSTED;
  }
  if (gSSLStatus.isDomainMismatch) {
    flags |= overrideService.ERROR_MISMATCH;
    confirmBucketId += gNsISecTel.WARNING_BAD_CERT_CONFIRM_ADD_EXCEPTION_FLAG_DOMAIN;
  }
  if (gSSLStatus.isNotValidAtThisTime) {
    flags |= overrideService.ERROR_TIME;
    confirmBucketId += gNsISecTel.WARNING_BAD_CERT_CONFIRM_ADD_EXCEPTION_FLAG_TIME;
  }
  var permanentCheckbox = document.getElementById("permanent");
  var shouldStorePermanently = permanentCheckbox.checked && !inPrivateBrowsingMode();
  if(!permanentCheckbox.checked)
   gSecHistogram.add(gNsISecTel.WARNING_BAD_CERT_DONT_REMEMBER_EXCEPTION);
  gSecHistogram.add(confirmBucketId);
  var uri = getURI();
  overrideService.rememberValidityOverride(
    uri.asciiHost, uri.port,
    gCert,
    flags,
    !shouldStorePermanently);
  var args = window.arguments;
  if (args && args[0])
    args[0].exceptionAdded = true;
  gDialog.acceptDialog();
}
function addException ( ) { if ( ! gCert || ! gSSLStatus ) return ; var overrideService = Components . classes [ "@mozilla.org/security/certoverride;1" ] . getService ( Components . interfaces . nsICertOverrideService ) ; var flags = 0 ; let confirmBucketId = gNsISecTel . WARNING_BAD_CERT_CONFIRM_ADD_EXCEPTION_BASE ; if ( gSSLStatus . isUntrusted ) { flags |= overrideService . ERROR_UNTRUSTED ; confirmBucketId += gNsISecTel . WARNING_BAD_CERT_CONFIRM_ADD_EXCEPTION_FLAG_UNTRUSTED ; } if ( gSSLStatus . isDomainMismatch ) { flags |= overrideService . ERROR_MISMATCH ; confirmBucketId += gNsISecTel . WARNING_BAD_CERT_CONFIRM_ADD_EXCEPTION_FLAG_DOMAIN ; } if ( gSSLStatus . isNotValidAtThisTime ) { flags |= overrideService . ERROR_TIME ; confirmBucketId += gNsISecTel . WARNING_BAD_CERT_CONFIRM_ADD_EXCEPTION_FLAG_TIME ; } var permanentCheckbox = document . getElementById ( "permanent" ) ; var shouldStorePermanently = permanentCheckbox . checked && ! inPrivateBrowsingMode ( ) ; if ( ! permanentCheckbox . checked ) gSecHistogram . add ( gNsISecTel . WARNING_BAD_CERT_DONT_REMEMBER_EXCEPTION ) ; gSecHistogram . add ( confirmBucketId ) ; var uri = getURI ( ) ; overrideService . rememberValidityOverride ( uri . asciiHost , uri . port , gCert , flags , ! shouldStorePermanently ) ; var args = window . arguments ; if ( args && args [ 0 ] ) args [ 0 ] . exceptionAdded = true ; gDialog . acceptDialog ( ) ; }
Handle user request to add an exception for the specified cert
Handle user request to add an exception for the specified cert