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
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
--- 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);