|
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/. */ |
|
4 |
|
5 const nsIDialogParamBlock = Components.interfaces.nsIDialogParamBlock; |
|
6 const nsIPKIParamBlock = Components.interfaces.nsIPKIParamBlock; |
|
7 const nsIX509Cert = Components.interfaces.nsIX509Cert; |
|
8 |
|
9 var pkiParams; |
|
10 var params; |
|
11 var caName; |
|
12 var cert; |
|
13 |
|
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); |
|
20 |
|
21 caName = cert.commonName; |
|
22 |
|
23 var bundle = document.getElementById("pippki_bundle"); |
|
24 |
|
25 if (!caName.length) |
|
26 caName = bundle.getString("unnamedCA"); |
|
27 |
|
28 var message2 = bundle.getFormattedString("newCAMessage1", [caName]); |
|
29 setText("message2", message2); |
|
30 } |
|
31 |
|
32 function viewCert() |
|
33 { |
|
34 viewCertHelper(window, cert); |
|
35 } |
|
36 |
|
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 } |
|
57 |
|
58 function doCancel() |
|
59 { |
|
60 params.SetInt(1,0); |
|
61 return true; |
|
62 } |