rem: if ("arguments" in window) { params = window.arguments[0].QueryInterface(nsIDialogParamBlock); tokenName = params.GetString(1); 
add: if(tokenName=="" || tokenName=="_blank") { var sectokdb = Components.classes[nsPK11TokenDB].getService(nsIPK11TokenDB); var tokenList = sectokdb.listTokens(); var enumElement; i=0; var menu = document.getElementById("tokenMenu"); try { for ( ; !tokenList.isDone(); tokenList.next()) { enumElement = tokenList.currentItem(); var token = enumElement.QueryInterface(nsIPK11Token); if(token.needsLogin() || !(token.needsUserInit)) { var menuItemNode = document.createElement("menuitem"); menuItemNode.setAttribute("value", token.tokenName); menuItemNode.setAttribute("label", token.tokenName); menu.firstChild.appendChild(menuItemNode); if (i == 0) { menu.selectedItem = menuItemNode; tokenName = token.tokenName; } i++; } } }catch(exception){} 
context: function onLoad(){  pw1 = document.getElementById("pw1");  if ("arguments" in window) {    params = window.arguments[0].QueryInterface(nsIDialogParamBlock);    tokenName = params.GetString(1);  } else {    tokenName = self.name;  }  // Set token name in display  var t = document.getElementById("tokenName");  t.setAttribute("value", tokenName);  var bundle = srGetStrBundle("chrome://pippki/locale/pippki.properties");  // If the token is unitialized, don't use the old password box.  // Otherwise, do.  var secmoddb = Components.                  classes[nsPKCS11ModuleDB].                  getService(nsIPKCS11ModuleDB);  var slot = secmoddb.findSlotByName(tokenName);  if (slot) {    var oldpwbox = document.getElementById("oldpw");    var status = slot.status;    if (status == nsIPKCS11Slot.SLOT_UNINITIALIZED        || status == nsIPKCS11Slot.SLOT_READY) {      oldpwbox.setAttribute("disabled", "true");      oldpwbox.setAttribute("type", "text");      oldpwbox.setAttribute("value",                             bundle.GetStringFromName("password_not_set"));       if (status == nsIPKCS11Slot.SLOT_READY) {        oldpwbox.setAttribute("inited", "empty");      } else {        oldpwbox.setAttribute("inited", "true");      }      // Select first password field      document.getElementById('pw1').focus();    } else {      // Select old password field      oldpwbox.setAttribute("inited", "false");      oldpwbox.focus();    }  }  if (params) {    // Return value 0 means "canceled"    params.SetInt(1, 0);  }    checkPasswords();}
meta: 5872	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/5872/0f707586ec2cad1ad21f262a69f499e43a3a0888/password.js/buggy/security/manager/pki/resources/content/password.js