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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial