1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/manager/pki/resources/content/choosetoken.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,42 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- 1.5 + * 1.6 + * This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 + 1.11 +const nsIDialogParamBlock = Components.interfaces.nsIDialogParamBlock; 1.12 + 1.13 +var dialogParams; 1.14 + 1.15 +function onLoad() 1.16 +{ 1.17 + dialogParams = window.arguments[0].QueryInterface(nsIDialogParamBlock); 1.18 + var selectElement = document.getElementById("tokens"); 1.19 + var aCount = dialogParams.GetInt(0); 1.20 + for (var i=0; i < aCount; i++) { 1.21 + var menuItemNode = document.createElement("menuitem"); 1.22 + var token = dialogParams.GetString(i); 1.23 + menuItemNode.setAttribute("value", token); 1.24 + menuItemNode.setAttribute("label", token); 1.25 + selectElement.firstChild.appendChild(menuItemNode); 1.26 + if (i == 0) { 1.27 + selectElement.selectedItem = menuItemNode; 1.28 + } 1.29 + } 1.30 +} 1.31 + 1.32 +function doOK() 1.33 +{ 1.34 + var tokenList = document.getElementById("tokens"); 1.35 + var token = tokenList.value; 1.36 + dialogParams.SetInt(0,1); 1.37 + dialogParams.SetString(0, token); 1.38 + return true; 1.39 +} 1.40 + 1.41 +function doCancel() 1.42 +{ 1.43 + dialogParams.SetInt(0,0); 1.44 + return true; 1.45 +}