Bug 946669 - Refresh "trust junk mail headers set by" menulist items in junk settings properly (not accumulating them). r=IanN, r=Neil, r=mkmelin
authoraceman <acelists@atlas.sk>
Tue, 21 Jan 2014 15:29:06 -0500
changeset 19326 f28b79f5b46f3a31e704f3d308fd9a2cbb37c2bf
parent 19325 b4cb7f82793b245aa300d62abf97d7071bc4c2a1
child 19327 bbdeef3a2990cef77f1ddc1257953b50fcd1236a
push id1103
push usermbanner@mozilla.com
push dateTue, 18 Mar 2014 07:44:06 +0000
treeherdercomm-beta@50c6279a0af0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersIanN, Neil, mkmelin
bugs946669
Bug 946669 - Refresh "trust junk mail headers set by" menulist items in junk settings properly (not accumulating them). r=IanN, r=Neil, r=mkmelin
mailnews/base/prefs/content/am-junk.js
--- a/mailnews/base/prefs/content/am-junk.js
+++ b/mailnews/base/prefs/content/am-junk.js
@@ -64,18 +64,19 @@ function onInit(aPageId, aServerId)
   var currentArray = [];
   if (document.getElementById("server.useWhiteList").checked)
     currentArray = document.getElementById("server.whiteListAbURI").value.split(" ");
 
   // set up the whitelist UI
   var wList = document.getElementById("whiteListAbURI");
 
   // Ensure the whitelist is empty
-  while (wList.lastChild)
+  while (wList.hasChildNodes()) {
     wList.removeChild(wList.lastChild);
+  }
 
   // Populate the listbox with address books
   let abItems = [];
   for (let ab in fixIterator(MailServices.ab.directories,
                              Components.interfaces.nsIAbDirectory)) {
     // We skip mailing lists and remote address books.
     if (ab.isMailList || ab.isRemote)
       continue;
@@ -240,18 +241,23 @@ function onActionTargetChange(aEvent, aW
 
 /**
  * Enumerates over the "ISPDL" directories, calling buildServerFilterListFromDir
  * for each one.
  */
 function buildServerFilterMenuList()
 {
   const KEY_ISP_DIRECTORY_LIST = "ISPDL";
-  let ispHeaderList = document.getElementById('useServerFilterList');
-  // Now walk through the isp directories looking for sfd files
+  let ispHeaderList = document.getElementById("useServerFilterList");
+  // Ensure the menulist is empty.
+  while (ispHeaderList.hasChildNodes()) {
+    ispHeaderList.removeChild(ispHeaderList.lastChild);
+  }
+
+  // Now walk through the isp directories looking for sfd files.
   let ispDirectories = Services.dirsvc.get(KEY_ISP_DIRECTORY_LIST,
                                            Components.interfaces.nsISimpleEnumerator);
 
   let menuEntries = [];
   while (ispDirectories.hasMoreElements())
   {
     let ispDirectory = ispDirectories.getNext()
                                      .QueryInterface(Components.interfaces.nsIFile);