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

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:abd9204d46ba
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
8 const nsIDialogParamBlock = Components.interfaces.nsIDialogParamBlock;
9
10 var dialogParams;
11
12 function onLoad()
13 {
14 dialogParams = window.arguments[0].QueryInterface(nsIDialogParamBlock);
15 var selectElement = document.getElementById("tokens");
16 var aCount = dialogParams.GetInt(0);
17 for (var i=0; i < aCount; i++) {
18 var menuItemNode = document.createElement("menuitem");
19 var token = dialogParams.GetString(i);
20 menuItemNode.setAttribute("value", token);
21 menuItemNode.setAttribute("label", token);
22 selectElement.firstChild.appendChild(menuItemNode);
23 if (i == 0) {
24 selectElement.selectedItem = menuItemNode;
25 }
26 }
27 }
28
29 function doOK()
30 {
31 var tokenList = document.getElementById("tokens");
32 var token = tokenList.value;
33 dialogParams.SetInt(0,1);
34 dialogParams.SetString(0, token);
35 return true;
36 }
37
38 function doCancel()
39 {
40 dialogParams.SetInt(0,0);
41 return true;
42 }

mercurial