Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 const nsIDialogParamBlock = Components.interfaces.nsIDialogParamBlock;
8 var dialogParams;
9 var itemCount = 0;
11 function onLoad()
12 {
13 dialogParams = window.arguments[0].QueryInterface(nsIDialogParamBlock);
15 var hostname = dialogParams.GetString(0);
16 var bundle = document.getElementById("pippki_bundle");
17 var intro = bundle.getFormattedString("formSigningIntro", [hostname]);
18 setText("sign.intro", intro);
20 document.getElementById("sign.text").value = dialogParams.GetString(1);
22 var selectElement = document.getElementById("nicknames");
23 itemCount = dialogParams.GetInt(0);
24 for (var index = 0; index < itemCount; ++index) {
25 var menuItemNode = document.createElement("menuitem");
26 var nick = dialogParams.GetString(2 + 2 * index);
27 menuItemNode.setAttribute("value", index);
28 menuItemNode.setAttribute("label", nick); // this is displayed
29 selectElement.firstChild.appendChild(menuItemNode);
30 if (index == 0) {
31 selectElement.selectedItem = menuItemNode;
32 }
33 }
34 setDetails();
35 document.getElementById("pw").focus();
36 }
38 function setDetails()
39 {
40 var index = parseInt(document.getElementById("nicknames").value);
41 if (index == "NaN")
42 return;
44 var details = dialogParams.GetString(2 + (2 * index + 1));
45 document.getElementById("certdetails").value = details;
46 }
48 function onCertSelected()
49 {
50 setDetails();
51 }
53 function doOK()
54 {
55 dialogParams.SetInt(0, 1);
56 var index = parseInt(document.getElementById("nicknames").value);
57 dialogParams.SetInt(1, index);
58 var password = document.getElementById("pw").value;
59 dialogParams.SetString(0, password);
60 return true;
61 }
63 function doCancel()
64 {
65 dialogParams.SetInt(0, 0);
66 return true;
67 }