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

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 const nsIDialogParamBlock = Components.interfaces.nsIDialogParamBlock;
     6 const nsIPKIParamBlock = Components.interfaces.nsIPKIParamBlock;
     7 const nsIX509Cert = Components.interfaces.nsIX509Cert;
     9 var pkiParams;
    10 var params;
    11 var caName;
    12 var cert;
    14 function onLoad()
    15 {
    16   pkiParams = window.arguments[0].QueryInterface(nsIPKIParamBlock);
    17   params = pkiParams.QueryInterface(nsIDialogParamBlock);
    18   var isupport = pkiParams.getISupportAtIndex(1);
    19   cert = isupport.QueryInterface(nsIX509Cert);
    21   caName = cert.commonName; 
    23   var bundle = document.getElementById("pippki_bundle");
    25   if (!caName.length)
    26     caName = bundle.getString("unnamedCA");
    28   var message2 = bundle.getFormattedString("newCAMessage1", [caName]);
    29   setText("message2", message2);
    30 }
    32 function viewCert()
    33 {
    34   viewCertHelper(window, cert);
    35 }
    37 function doOK()
    38 {
    39   var checkSSL = document.getElementById("trustSSL");
    40   var checkEmail = document.getElementById("trustEmail");
    41   var checkObjSign = document.getElementById("trustObjSign");
    42   if (checkSSL.checked)
    43     params.SetInt(2,1);
    44   else
    45     params.SetInt(2,0);
    46   if (checkEmail.checked)
    47     params.SetInt(3,1);
    48   else
    49     params.SetInt(3,0);
    50   if (checkObjSign.checked)
    51     params.SetInt(4,1);
    52   else
    53     params.SetInt(4,0);
    54   params.SetInt(1,1);
    55   return true;
    56 }
    58 function doCancel()
    59 {
    60   params.SetInt(1,0);
    61   return true;
    62 }

mercurial