rem: var numItemsInNode = menupopupNode.childNodes.length; numItemsInNode -= 2; var removeNodes = true; 
add: for (var i = menupopupNode.childNodes.length - 1; i >= 0; --i) { if (menupopupNode.childNodes[i].id.substr(0, 15) == "userdefinedview") menupopupNode.removeChild(menupopupNode.childNodes[i]); } 
context: function refreshCustomMailViews(aDefaultSelectedIndex){  // for each mail view in the msg view list, add an entry in our combo box  if (!gMailViewList)    gMailViewList = Components.classes["@mozilla.org/messenger/mailviewlist;1"].getService(Components.interfaces.nsIMsgMailViewList);  // remove any existing entries...  var menupopupNode = document.getElementById('viewPickerPopup');  var numItemsInNode = menupopupNode.childNodes.length;  numItemsInNode -= 2; // subtract off the last 2 items since we want to leave those  var removeNodes = true;  while (removeNodes && numItemsInNode)  {    if (menupopupNode.childNodes[numItemsInNode-1].getAttribute('id') == 'lastDefaultView')      removeNodes = false;    else      menupopupNode.removeChild(menupopupNode.childNodes[numItemsInNode-1]);    numItemsInNode -= 1;  }   // now rebuild the list  var numItems = gMailViewList.mailViewCount;   var customNode = document.getElementById('createCustomViewSeparator');  var newMenuItem;   var item;   for (var index = 0; index < numItems; index++)  {    newMenuItem = document.createElement('menuitem');    newMenuItem.setAttribute('label', gMailViewList.getMailViewAt(index).prettyName);    newMenuItem.setAttribute('id', "userdefinedview" + (kLastDefaultViewIndex + index));    item = menupopupNode.insertBefore(newMenuItem, customNode);    item.setAttribute('value',  kLastDefaultViewIndex + index);  }  if (!numItems)    customNode.setAttribute('collapsed', true);  else    customNode.removeAttribute('collapsed');  if (aDefaultSelectedIndex >= 0)  {    ViewChangeByValue(kLastDefaultViewIndex + aDefaultSelectedIndex);  }}
meta: 5459	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/5459/291e0581f7df27f680fc1d86b4255102aa1b9668/msgViewPickerOverlay.js/clean/mailnews/extensions/mailviews/resources/content/msgViewPickerOverlay.js