Bug 946669 - Refresh "trust junk mail headers set by" menulist items in junk settings properly (not accumulating them). r=IanN, r=Neil, r=mkmelin, a=Standard8
authoraceman <acelists@atlas.sk>
Tue, 21 Jan 2014 15:29:06 -0500
changeset 16086 93ad0f9b2190eac66ea92e51e5e9dab68227cb49
parent 16085 3d10c55e0ec2999b98921db4ae6e3fa34b9d073c
child 16087 29eb1bad3a822ec71d0bf8556677d4cf3be400ef
push id48
push usermbanner@mozilla.com
push dateThu, 13 Mar 2014 13:32:05 +0000
reviewersIanN, Neil, mkmelin, Standard8
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, a=Standard8
mailnews/base/prefs/content/am-junk.js
--- a/mailnews/base/prefs/content/am-junk.js
+++ b/mailnews/base/prefs/content/am-junk.js
@@ -63,18 +63,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;
@@ -239,18 +240,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);