rem: menuPopup.appendChild(menuItem); 
add:  /* avoid making duplicate entries in the same menulist */ var child = menuPopup.firstChild; var alreadyThere = false; while (child) { if (child.getAttribute("label") == prefillList[i+2]) { alreadyThere = true; break; } child = child.nextSibling; } if (!alreadyThere) { menuPopup.appendChild(menuItem); } 
context: function Startup() {  /* fetch the input */  var list = walletpreview.GetPrefillValue();  var BREAK = list[0];  prefillList = list.split(BREAK);  var menuPopup;  var count;  /* create the fill-in entries */  for (var i=1; i<prefillList.length-2; i+=3) {    if(prefillList[i] != 0) {      count = prefillList[i];      menuPopup = document.createElement("menupopup");//      menuList.setAttribute("size", Number(count)+1);    }    count--;    var menuItem = document.createElement("menuitem");    if (count == (prefillList[i]-1)) {      menuItem.setAttribute("selected", "true");    }    menuItem.setAttribute("label", prefillList[i+2]);    menuPopup.appendChild(menuItem);    if(count == 0) {      var menuList = document.createElement("menulist");      menuList.setAttribute("data", prefillList[i+1]);      menuList.setAttribute("id", "xx"+(++fieldCount));      menuList.setAttribute("allowevents", "true");//    menuList.setAttribute("editable", "true");  // done later to avoid crash      menuList.appendChild(menuPopup);      var text = document.createElement("text");      text.setAttribute("value", prefillList[i+1]);      var localCheckBox = document.createElement("checkbox");      localCheckBox.setAttribute("id", "x"+fieldCount);      // Note: menulist name is deliberately chosen to be x + checkbox name in      //       order to make it easy to get to menulist from associated checkbox      localCheckBox.setAttribute("oncommand", "UpdateMenuListEnable(this)");      localCheckBox.setAttribute("checked", "true");      var row = document.createElement("row");      row.appendChild(localCheckBox);      row.appendChild(text);      row.appendChild(menuList);      var rows = document.getElementById("rows");      rows.appendChild(row);      // xul bug: if this is done earlier, it will result in a crash (???)      menuList.setAttribute("editable", "true");    }  }  /* initialization OK and Cancel buttons */  doSetOKCancel(Save, Cancel);}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/8ce7697faecde5ca43515ba31d29718363904c5b/WalletPreview.js/clean/extensions/wallet/walletpreview/WalletPreview.js