rem: while (popup.childNodes.length) popup.removeChild(popup.childNodes[0]); 
add: while (popup.hasChildNodes()) popup.removeChild(popup.lastChild); 
context: function onEditDirectories(){  var args = {fromGlobalPref: gFromGlobalPref};  window.openDialog("chrome://messenger/content/addressbook/pref-editdirectories.xul",                    "editDirectories", "chrome,modal=yes,resizable=no", args);  if (gRefresh)  {    var popup = document.getElementById("directoriesListPopup");     if (popup)     {        while (popup.childNodes.length)         popup.removeChild(popup.childNodes[0]);    }     gAvailDirectories = null;    LoadDirectories(popup);    gRefresh = false;  }}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/4cba32786bcfe8ed3d92ee412e77e5d20b45181e/pref-directory.js/buggy/mailnews/addrbook/prefs/resources/content/pref-directory.js