security/manager/pki/resources/content/downloadcert.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/security/manager/pki/resources/content/downloadcert.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,62 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +const nsIDialogParamBlock = Components.interfaces.nsIDialogParamBlock;
     1.9 +const nsIPKIParamBlock = Components.interfaces.nsIPKIParamBlock;
    1.10 +const nsIX509Cert = Components.interfaces.nsIX509Cert;
    1.11 +
    1.12 +var pkiParams;
    1.13 +var params;
    1.14 +var caName;
    1.15 +var cert;
    1.16 +
    1.17 +function onLoad()
    1.18 +{
    1.19 +  pkiParams = window.arguments[0].QueryInterface(nsIPKIParamBlock);
    1.20 +  params = pkiParams.QueryInterface(nsIDialogParamBlock);
    1.21 +  var isupport = pkiParams.getISupportAtIndex(1);
    1.22 +  cert = isupport.QueryInterface(nsIX509Cert);
    1.23 +
    1.24 +  caName = cert.commonName; 
    1.25 +
    1.26 +  var bundle = document.getElementById("pippki_bundle");
    1.27 +
    1.28 +  if (!caName.length)
    1.29 +    caName = bundle.getString("unnamedCA");
    1.30 +
    1.31 +  var message2 = bundle.getFormattedString("newCAMessage1", [caName]);
    1.32 +  setText("message2", message2);
    1.33 +}
    1.34 +
    1.35 +function viewCert()
    1.36 +{
    1.37 +  viewCertHelper(window, cert);
    1.38 +}
    1.39 +
    1.40 +function doOK()
    1.41 +{
    1.42 +  var checkSSL = document.getElementById("trustSSL");
    1.43 +  var checkEmail = document.getElementById("trustEmail");
    1.44 +  var checkObjSign = document.getElementById("trustObjSign");
    1.45 +  if (checkSSL.checked)
    1.46 +    params.SetInt(2,1);
    1.47 +  else
    1.48 +    params.SetInt(2,0);
    1.49 +  if (checkEmail.checked)
    1.50 +    params.SetInt(3,1);
    1.51 +  else
    1.52 +    params.SetInt(3,0);
    1.53 +  if (checkObjSign.checked)
    1.54 +    params.SetInt(4,1);
    1.55 +  else
    1.56 +    params.SetInt(4,0);
    1.57 +  params.SetInt(1,1);
    1.58 +  return true;
    1.59 +}
    1.60 +
    1.61 +function doCancel()
    1.62 +{
    1.63 +  params.SetInt(1,0);
    1.64 +  return true;
    1.65 +}

mercurial