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

Wed, 31 Dec 2014 07:16:47 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:16:47 +0100
branch
TOR_BUG_9701
changeset 3
141e0f1194b1
permissions
-rw-r--r--

Revert simplistic fix pending revisit of Mozilla integration attempt.

     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/. */
     8 const nsIDialogParamBlock = Components.interfaces.nsIDialogParamBlock;
    10 var dialogParams;
    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 }
    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 }
    38 function doCancel()
    39 {
    40   dialogParams.SetInt(0,0);
    41   return true;
    42 }

mercurial