Bug 436089 - Convert nsIMsgFolder::ListDescendents() from nsISupportsArray to nsIArray descendants attribute - mailnews JS conversions. r=asuth
authoraceman <acelists@atlas.sk>
Thu, 07 Feb 2013 12:37:55 -0500
changeset 14824 e98ade781a3b90361c7085609deb73bb448b9442
parent 14823 4d0efe2291c3801ca2445857503709b2e85cae2e
child 14825 6b92c81ffe0403033c31b2a0c1ce1c76e0692272
push id867
push userbugzilla@standard8.plus.com
push dateMon, 01 Apr 2013 20:44:27 +0000
treeherdercomm-beta@797726b8d244 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersasuth
bugs436089
Bug 436089 - Convert nsIMsgFolder::ListDescendents() from nsISupportsArray to nsIArray descendants attribute - mailnews JS conversions. r=asuth
mailnews/base/content/newmailalert.js
mailnews/base/content/virtualFolderListDialog.js
mailnews/base/prefs/content/am-offline.js
mailnews/base/src/newMailNotificationService.js
mailnews/db/gloda/modules/gloda.js
mailnews/db/gloda/modules/index_msg.js
mailnews/db/gloda/test/unit/base_index_messages.js
mailnews/extensions/newsblog/js/newsblog.js
--- a/mailnews/base/content/newmailalert.js
+++ b/mailnews/base/content/newmailalert.js
@@ -1,13 +1,14 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 Components.utils.import("resource://gre/modules/Services.jsm");
+Components.utils.import("resource:///modules/iteratorUtils.jsm");
 
 // Copied from nsILookAndFeel.h, see comments on eMetric_AlertNotificationOrigin
 const NS_ALERT_HORIZONTAL = 1;
 const NS_ALERT_LEFT = 2;
 const NS_ALERT_TOP = 4;
 
 var gNumNewMsgsToShowInAlert = 4; // the more messages we show in the alert, the larger it will be
 var gOpenTime = 4000; // total time the alert should stay up once we are done animating.
@@ -46,26 +47,21 @@ function prefillAlertInfo()
   var message = totalNumNewMessages == 1 ? "newMailNotification_message"
                                          : "newMailNotification_messages";
   label.value = document.getElementById('bundle_messenger')
                         .getFormattedString(message,
                                             [rootFolder.prettiestName, totalNumNewMessages]);
 
   // This is really the root folder and we have to walk through the list to
   // find the real folder that has new mail in it...:(
-  var allFolders = Components.classes["@mozilla.org/supports-array;1"]
-                             .createInstance(Components.interfaces.nsISupportsArray);
-  rootFolder.ListDescendents(allFolders);
-  var numFolders = allFolders.Count();
+  let allFolders = rootFolder.descendants;
   var folderSummaryInfoEl = document.getElementById('folderSummaryInfo');
   folderSummaryInfoEl.mMaxMsgHdrsInPopup = gNumNewMsgsToShowInAlert;
-  for (let folderIndex = 0; folderIndex < numFolders; folderIndex++)
+  for (let folder in fixIterator(allFolders, Components.interfaces.nsIMsgFolder))
   {
-    var folder = allFolders.GetElementAt(folderIndex)
-                           .QueryInterface(Components.interfaces.nsIMsgFolder);
     const nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
     if (folder.hasNewMessages && !(folder.flags & nsMsgFolderFlags.Virtual))
     {
       var asyncFetch = {};
       folderSummaryInfoEl.parseFolder(folder, new urlListener(folder), asyncFetch);
       if (asyncFetch.value)
         gPendingPreviewFetchRequests++;
     }
--- a/mailnews/base/content/virtualFolderListDialog.js
+++ b/mailnews/base/content/virtualFolderListDialog.js
@@ -1,14 +1,15 @@
 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 Components.utils.import("resource:///modules/mailServices.js");
+Components.utils.import("resource:///modules/iteratorUtils.jsm");
 
 var gFolderPickerTree = null;
 
 function onLoad()
 {
   gFolderPickerTree = document.getElementById("folderPickerTree");
 
   if (window.arguments[0].searchFolderURIs)
@@ -57,59 +58,31 @@ function processSearchSettingForFolder(a
   
   aFolder.setInVFEditSearchScope(false, false);
   return aCurrentSearchURIString;
 }
 
 // warning: this routine also clears out the search property list from all of the msg folders
 function generateFoldersToSearchList()
 {
-  var uriSearchString = "";
-
-  var allServers = MailServices.accounts.allServers;
-  var numServers = allServers.length;
-  for (var index = 0; index < numServers; index++)
-  {
-    var rootFolder =
-      allServers.queryElementAt(index,
-                                Components.interfaces.nsIMsgIncomingServer).rootFolder;
-    if (rootFolder)
-    {
-      uriSearchString = processSearchSettingForFolder(rootFolder, uriSearchString);
-      var allFolders = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);
-      rootFolder.ListDescendents(allFolders);
-      var numFolders = allFolders.Count();
-      for (var folderIndex = 0; folderIndex < numFolders; folderIndex++)
-        uriSearchString = processSearchSettingForFolder(allFolders.GetElementAt(folderIndex).QueryInterface(Components.interfaces.nsIMsgFolder), uriSearchString);
-    }
-  } // for each account
+  let uriSearchString = "";
+  let allFolders = MailServices.accounts.allFolders;
+  for (let folder in fixIterator(allFolders, Components.interfaces.nsIMsgFolder))
+    uriSearchString = processSearchSettingForFolder(folder, uriSearchString);
 
   return uriSearchString;
 }
 
 function resetFolderToSearchAttribute()
 {
   // iterates over all accounts and all folders, clearing out the inVFEditScope property in case
   // we set it.
-  var allServers = MailServices.accounts.allServers;
-  var numServers = allServers.length;
-  for (var index = 0; index < numServers; index++)
-  {
-    var rootFolder =
-      allServers.queryElementAt(index,
-                                Components.interfaces.nsIMsgIncomingServer).rootFolder;
-    if (rootFolder)
-    {
-      var allFolders = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);
-      rootFolder.ListDescendents(allFolders);
-      var numFolders = allFolders.Count();
-      for (var folderIndex = 0; folderIndex < numFolders; folderIndex++)
-        allFolders.GetElementAt(folderIndex).QueryInterface(Components.interfaces.nsIMsgFolder).setInVFEditSearchScope(false, false);
-    }
-  } // for each account
+  let allFolders = MailServices.accounts.allFolders;
+  for (let folder in fixIterator(allFolders, Components.interfaces.nsIMsgFolder))
+    folder.setInVFEditSearchScope(false, false);
 }
 
 function ReverseStateFromNode(row)
 {
   var folder = GetFolderResource(row).QueryInterface(Components.interfaces.nsIMsgFolder);
   var currentState = folder.inVFEditSearchScope;
 
   folder.setInVFEditSearchScope(!currentState, false);
--- a/mailnews/base/prefs/content/am-offline.js
+++ b/mailnews/base/prefs/content/am-offline.js
@@ -1,13 +1,15 @@
 /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+Components.utils.import("resource:///modules/iteratorUtils.jsm");
+
 var gIncomingServer;
 var gServerType;
 var gImapIncomingServer;
 var gPref = null;
 var gLockedPref = null;
 var gOfflineMap = null; // map of folder URLs to offline flags
 
 function onInit(aPageId, aServerId) 
@@ -295,63 +297,38 @@ function onCheckItem(changeElementId, ch
     }
     else {
         element.setAttribute("disabled", "true");
     }
 }
 
 function toggleOffline()
 {
-    var offline = document.getElementById("offline.folders").checked;
-    var rootFolder = gIncomingServer.rootFolder;
-    var allFolders = Components.classes["@mozilla.org/supports-array;1"]
-                               .createInstance(Components.interfaces.nsISupportsArray);
-    rootFolder.ListDescendents(allFolders);
-    var numFolders = allFolders.Count();
-    var folder;
-    for (var folderIndex = 0; folderIndex < numFolders; folderIndex++)
-    {
-      folder = allFolders.QueryElementAt(folderIndex,
-                                         Components.interfaces.nsIMsgFolder);
+    let offline = document.getElementById("offline.folders").checked;
+    let allFolders = gIncomingServer.rootFolder.descendants;
+    for (let folder in fixIterator(allFolders, Components.interfaces.nsIMsgFolder)) {
       if (offline)
         folder.setFlag(Components.interfaces.nsMsgFolderFlags.Offline);
       else
         folder.clearFlag(Components.interfaces.nsMsgFolderFlags.Offline);
     }
-    
 }
 
 function collectOfflineFolders()
 {
-    var offlineFolderMap = {};
-    var rootFolder = gIncomingServer.rootFolder;
-    var allFolders = Components.classes["@mozilla.org/supports-array;1"]
-                               .createInstance(Components.interfaces.nsISupportsArray);
-    rootFolder.ListDescendents(allFolders);
-    var numFolders = allFolders.Count();
-    var folder;
-    for (var folderIndex = 0; folderIndex < numFolders; folderIndex++)
-    {
-      folder = allFolders.QueryElementAt(folderIndex,
-                                         Components.interfaces.nsIMsgFolder);
+    let offlineFolderMap = {};
+    let allFolders = gIncomingServer.rootFolder.descendants;
+    for (let folder in fixIterator(allFolders, Components.interfaces.nsIMsgFolder))
       offlineFolderMap[folder.folderURL] = folder.getFlag(Components.interfaces.nsMsgFolderFlags.Offline);
-    }
+
     return offlineFolderMap;
 }
 
 function restoreOfflineFolders(offlineFolderMap)
 {
-    var rootFolder = gIncomingServer.rootFolder;
-    var allFolders = Components.classes["@mozilla.org/supports-array;1"]
-                               .createInstance(Components.interfaces.nsISupportsArray);
-    rootFolder.ListDescendents(allFolders);
-    var numFolders = allFolders.Count();
-    var folder;
-    for (var folderIndex = 0; folderIndex < numFolders; folderIndex++)
-    {
-      folder = allFolders.QueryElementAt(folderIndex,
-                                         Components.interfaces.nsIMsgFolder);
+    let allFolders = gIncomingServer.rootFolder.descendants;
+    for (let folder in fixIterator(allFolders, Components.interfaces.nsIMsgFolder)) {
       if (offlineFolderMap[folder.folderURL])
         folder.setFlag(Components.interfaces.nsMsgFolderFlags.Offline);
       else
         folder.clearFlag(Components.interfaces.nsMsgFolderFlags.Offline);
     }
 }
--- a/mailnews/base/src/newMailNotificationService.js
+++ b/mailnews/base/src/newMailNotificationService.js
@@ -15,16 +15,17 @@
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cu = Components.utils;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource:///modules/mailServices.js");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource:///modules/gloda/log4moz.js");
+Cu.import("resource:///modules/iteratorUtils.jsm");
 
 const NMNS = Ci.mozINewMailNotificationService;
 
 const countInboxesPref = "mail.notification.count.inbox_only";
 // Old name for pref
 const countNewMessagesPref = "mail.biff.use_new_count_in_mac_dock";
 // When we go cross-platform we should migrate to
 // const countNewMessagesPref = "mail.notification.count.new";
@@ -125,37 +126,31 @@ NewMailNotificationService.prototype = {
     if (!this.countNew) {
       this._log.info("NMNS_initUnread notifying listeners: " + total + " total unread messages");
       this._notifyListeners(NMNS.count, "onCountChanged", total);
     }
   },
 
   // Count all the unread messages below the given folder
   _countUnread: function NMNS_countUnread(folder) {
-    let allFolders = Cc["@mozilla.org/supports-array;1"]
-                       .createInstance(Ci.nsISupportsArray);
-
     this._log.trace("NMNS_countUnread: parent folder " + folder.URI);
     let unreadCount = 0;
 
     if (this.confirmShouldCount(folder)) {
       let count = folder.getNumUnread(false);
       this._log.debug("NMNS_countUnread: folder " + folder.URI + ", " + count + " unread");
       if (count > 0)
         unreadCount += count;
     }
 
-    folder.ListDescendents(allFolders);
-    let numFolders = allFolders.Count();
-
-    for (let i = 0; i < numFolders; i++) {
-      let fold = allFolders.QueryElementAt(i, Ci.nsIMsgFolder);
-      if (this.confirmShouldCount(fold)) {
-        let count = fold.getNumUnread(false);
-        this._log.debug("NMNS_countUnread: folder " + fold.URI + ", " + count + " unread");
+    let allFolders = folder.descendants;
+    for (let folder in fixIterator(allFolders, Ci.nsIMsgFolder)) {
+      if (this.confirmShouldCount(folder)) {
+        let count = folder.getNumUnread(false);
+        this._log.debug("NMNS_countUnread: folder " + folder.URI + ", " + count + " unread");
         if (count > 0)
           unreadCount += count;
       }
     }
     return unreadCount;
   },
 
   // Filter out special folders and then ask for observers to see if
@@ -222,36 +217,33 @@ NewMailNotificationService.prototype = {
       if (folder.server && !folder.server.performingBiff) {
         this._log.debug("NMNS_biffStateChanged: folder " + folder.URI + " notified, but server not performing biff");
         return;
       }
 
       // Biff notifications come in for the top level of the server, we need to look for
       // the folder that actually contains the new mail
 
-      let allFolders = Cc["@mozilla.org/supports-array;1"]
-                         .createInstance(Ci.nsISupportsArray);
-      folder.ListDescendents(allFolders);
-      let numFolders = allFolders.Count();
+      let allFolders = folder.descendants;
+      let numFolders = allFolders.length;
 
       this._log.trace("NMNS_biffStateChanged: folder " + folder.URI + " New mail, " + numFolders + " subfolders");
       let newCount = 0;
 
       if (this.confirmShouldCount(folder)) {
         let folderNew = folder.getNumNewMessages(false);
         this._log.debug("NMNS_biffStateChanged: folder " + folder.URI + " new messages: " + folderNew);
         if (folderNew > 0)
           newCount += folderNew;
       }
 
-      for (let i = 0; i < numFolders; i++) {
-        let fold = allFolders.QueryElementAt(i, Ci.nsIMsgFolder);
-        if (this.confirmShouldCount(fold)) {
-          let folderNew = fold.getNumNewMessages(false);
-          this._log.debug("NMNS_biffStateChanged: folder " + fold.URI + " new messages: " + folderNew);
+      for (let folder in fixIterator(allFolders, Ci.nsIMsgFolder)) {
+        if (this.confirmShouldCount(folder)) {
+          let folderNew = folder.getNumNewMessages(false);
+          this._log.debug("NMNS_biffStateChanged: folder " + folder.URI + " new messages: " + folderNew);
           if (folderNew > 0)
             newCount += folderNew;
         }
       }
       if (newCount > 0) {
         this._mNewCount += newCount;
         this._log.debug("NMNS_biffStateChanged: " + folder.URI + " New mail count " + this._mNewCount);
         if (this.countNew)
--- a/mailnews/db/gloda/modules/gloda.js
+++ b/mailnews/db/gloda/modules/gloda.js
@@ -1175,23 +1175,18 @@ var Gloda = {
             let rootFolder = givenMsgFolder.rootFolder;
 
             // skip processing this folder if we have already processed its
             //  root folder.
             if (rootFolder.URI in seenRootFolders)
               continue;
             seenRootFolders[rootFolder.URI] = true;
 
-            let allFolders = Cc["@mozilla.org/supports-array;1"].
-              createInstance(Ci.nsISupportsArray);
-            rootFolder.ListDescendents(allFolders);
-            let numFolders = allFolders.Count();
-            for (let folderIndex = 0; folderIndex < numFolders; folderIndex++) {
-              let folder = allFolders.GetElementAt(folderIndex).QueryInterface(
-                Ci.nsIMsgFolder);
+            let allFolders = rootFolder.descendants;
+            for (let folder in fixIterator(allFolders, Ci.nsIMsgFolder)) {
               let folderFlags = folder.flags;
 
               // Ignore virtual folders, non-mail folders.
               // XXX this is derived from GlodaIndexer's shouldIndexFolder.
               //  This should probably just use centralized code or the like.
               if (!(folderFlags & Ci.nsMsgFolderFlags.Mail) ||
                   (folderFlags & Ci.nsMsgFolderFlags.Virtual))
                 continue;
--- a/mailnews/db/gloda/modules/index_msg.js
+++ b/mailnews/db/gloda/modules/index_msg.js
@@ -16,16 +16,17 @@ const EXPORTED_SYMBOLS = ['GlodaMsgIndex
 
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cr = Components.results;
 const Cu = Components.utils;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource:///modules/iteratorUtils.jsm");
+Cu.import("resource:///modules/mailServices.js");
 Cu.import("resource:///modules/MailUtils.js");
 
 Cu.import("resource:///modules/gloda/log4moz.js");
 
 Cu.import("resource:///modules/gloda/utils.js");
 Cu.import("resource:///modules/gloda/datastore.js");
 Cu.import("resource:///modules/gloda/datamodel.js");
 Cu.import("resource:///modules/gloda/gloda.js");
@@ -996,35 +997,20 @@ var GlodaMsgIndexer = {
    */
   _worker_indexingSweep: function gloda_worker_indexingSweep(aJob) {
     if (!aJob.mappedFolders) {
       // Walk the folders and make sure all the folders we would want to index
       //  are mapped.  Build up a list of GlodaFolders as we go, so that we can
       //  sort them by their indexing priority.
       let foldersToProcess = aJob.foldersToProcess = [];
 
-      let accountManager = Cc["@mozilla.org/messenger/account-manager;1"].
-                           getService(Ci.nsIMsgAccountManager);
-      let servers = accountManager.allServers;
-      for (let i = 0; i < servers.length; i++) {
-        let server = servers.queryElementAt(i, Ci.nsIMsgIncomingServer);
-        let rootFolder = server.rootFolder;
-
-        let allFolders = Cc["@mozilla.org/supports-array;1"].
-          createInstance(Ci.nsISupportsArray);
-        rootFolder.ListDescendents(allFolders);
-        let numFolders = allFolders.Count();
-        for (let folderIndex = 0; folderIndex < numFolders; folderIndex++) {
-          let folder = allFolders.GetElementAt(folderIndex).QueryInterface(
-            Ci.nsIMsgFolder);
-          if (!this.shouldIndexFolder(folder))
-            continue;
-
+      let allFolders = MailServices.accounts.allFolders;
+      for (let folder in fixIterator(allFolders, Ci.nsIMsgFolder)) {
+        if (this.shouldIndexFolder(folder))
           foldersToProcess.push(Gloda.getFolderForFolder(folder));
-        }
       }
 
       // sort the folders by priority (descending)
       foldersToProcess.sort(function (a, b) {
         return b.indexingPriority - a.indexingPriority;
       });
 
       aJob.mappedFolders = true;
@@ -1916,24 +1902,19 @@ var GlodaMsgIndexer = {
   /**
    * Queue all of the folders belonging to an account for indexing.
    */
   indexAccount: function glodaIndexAccount(aAccount) {
     let rootFolder = aAccount.incomingServer.rootFolder;
     if (rootFolder instanceof Ci.nsIMsgFolder) {
       this._log.info("Queueing account folders for indexing: " + aAccount.key);
 
-      let allFolders = Cc["@mozilla.org/supports-array;1"]
-                         .createInstance(Ci.nsISupportsArray);
-      rootFolder.ListDescendents(allFolders);
-      let numFolders = allFolders.Count();
+      let allFolders = rootFolder.descendants;
       let folderJobs = [];
-      for (let folderIndex = 0; folderIndex < numFolders; folderIndex++) {
-        let folder = allFolders.GetElementAt(folderIndex).QueryInterface(
-                                                            Ci.nsIMsgFolder);
+      for (let folder in fixIterator(allFolders, Ci.nsIMsgFolder)) {
         if (this.shouldIndexFolder(folder))
           GlodaIndexer.indexJob(
             new IndexingJob("folder", GlodaDatastore._mapFolder(folder).id));
       }
     }
     else {
       this._log.info("Skipping Account, root folder not nsIMsgFolder");
     }
@@ -2600,20 +2581,17 @@ var GlodaMsgIndexer = {
           }
           else {
             indexer._log.info("Ignoring deletion of folder " +
                               aFolder.prettiestName +
                               " because it is unknown to gloda.");
           }
         };
 
-        let descendentFolders = Cc["@mozilla.org/supports-array;1"].
-        createInstance(Ci.nsISupportsArray);
-        aFolder.ListDescendents(descendentFolders);
-
+        let descendentFolders = aFolder.descendants;
         // (the order of operations does not matter; child, non-child, whatever.)
         // delete the parent
         delFunc(aFolder, this.indexer);
         // delete all its descendents
         for (let folder in fixIterator(descendentFolders, Ci.nsIMsgFolder)) {
           delFunc(folder, this.indexer);
         }
 
@@ -2656,33 +2634,29 @@ var GlodaMsgIndexer = {
      *  will generate only a single notification.  Our logic primarily handles
      *  this by not exploding if the original folder no longer exists.
      */
     _folderRenameHelper: function gloda_indexer_folderRenameHelper(aOrigFolder,
                                                                    aNewURI) {
       let newFolder = MailUtils.getFolderForURI(aNewURI);
       let specialFolderFlags = Ci.nsMsgFolderFlags.Trash | Ci.nsMsgFolderFlags.Junk;
       if (newFolder.isSpecialFolder(specialFolderFlags, true)) {
-        let descendentFolders = Cc["@mozilla.org/supports-array;1"].
-                                  createInstance(Ci.nsISupportsArray);
-        newFolder.ListDescendents(descendentFolders);
+        let descendentFolders = newFolder.descendants;
 
         // First thing to do: make sure we don't index the resulting folder and
         //  its descendents.
         GlodaMsgIndexer.resetFolderIndexingPriority(newFolder);
         for (let folder in fixIterator(descendentFolders, Ci.nsIMsgFolder)) {
           GlodaMsgIndexer.resetFolderIndexingPriority(folder);
         }
 
         // Remove from the index messages from the original folder
         this.folderDeleted(aOrigFolder);
       } else {
-        let descendentFolders = Cc["@mozilla.org/supports-array;1"].
-                                  createInstance(Ci.nsISupportsArray);
-        aOrigFolder.ListDescendents(descendentFolders);
+        let descendentFolders = aOrigFolder.descendants;
 
         let origURI = aOrigFolder.URI;
         // this rename is straightforward.
         GlodaDatastore.renameFolder(aOrigFolder, aNewURI);
 
         for (let folder in fixIterator(descendentFolders, Ci.nsIMsgFolder)) {
           let oldSubURI = folder.URI;
           // mangle a new URI from the old URI.  we could also try and do a
--- a/mailnews/db/gloda/test/unit/base_index_messages.js
+++ b/mailnews/db/gloda/test/unit/base_index_messages.js
@@ -1029,19 +1029,17 @@ function test_folder_deletion_nested() {
   // IMAP, the moved message header are different entities and it's not msgSet2
   // that ends up indexed, but the fresh headers
   yield move_folder(folder2, folder1);
 
   // add a trash folder, and move folder1 into it
   let trash = make_empty_folder(null, [Ci.nsMsgFolderFlags.Trash]);
   yield move_folder(folder1, trash);
 
-  let descendentFolders = Cc["@mozilla.org/supports-array;1"]
-                          .createInstance(Ci.nsISupportsArray);
-  get_nsIMsgFolder(trash).ListDescendents(descendentFolders);
+  let descendentFolders = get_nsIMsgFolder(trash).descendants;
   let folders = [folder for (folder in fixIterator(descendentFolders, Ci.nsIMsgFolder))];
   do_check_eq(folders.length, 2);
   let [newFolder1, newFolder2] = folders;
 
   let glodaFolder1 = Gloda.getFolderForFolder(newFolder1);
   let glodaFolder2 = Gloda.getFolderForFolder(newFolder2);
 
   // verify that Gloda properly marked this folder as not to be indexed anymore 
--- a/mailnews/extensions/newsblog/js/newsblog.js
+++ b/mailnews/extensions/newsblog/js/newsblog.js
@@ -20,33 +20,35 @@ var nsNewsBlogFeedDownloader =
     // new feeds.
     if (FeedUtils.progressNotifier.mSubscribeMode)
     {
       FeedUtils.log.warn("downloadFeed: Aborting RSS New Mail Check. " +
                          "Feed subscription in progress\n");
       return;
     }
 
-    let allFolders = Cc["@mozilla.org/supports-array;1"].
-                     createInstance(Ci.nsISupportsArray);
-    if (!aFolder.isServer)
-      // Add the base folder; it does not get added by ListDescendents.  Do not
+    let allFolders = Cc["@mozilla.org/array;1"].
+                     createInstance(Ci.nsIMutableArray);
+    if (!aFolder.isServer) {
+      // Add the base folder; it does not get returned by ListDescendants. Do not
       // add the account folder as it doesn't have the feedUrl property or even
       // a msgDatabase necessarily.
-      allFolders.AppendElement(aFolder);
+      allFolders.appendElement(aFolder, false);
+    }
 
-    aFolder.ListDescendents(allFolders);
-    let numFolders = allFolders.Count();
+    aFolder.ListDescendants(allFolders);
+
     let trashFolder =
         aFolder.rootFolder.getFolderWithFlags(Ci.nsMsgFolderFlags.Trash);
 
     function feeder() {
       let folder;
+      let numFolders = allFolders.length;
       for (let i = 0; i < numFolders; i++) {
-        folder = allFolders.GetElementAt(i).QueryInterface(Ci.nsIMsgFolder);
+        folder = allFolders.queryElementAt(i, Ci.nsIMsgFolder);
         FeedUtils.log.debug("downloadFeed: START x/# foldername:uri - " +
                             (i+1) + "/" + numFolders + " " +
                             folder.name + ":" + folder.URI);
 
         // Ensure msgDatabase for the folder is open for new message processing.
         let msgDb;
         try {
           msgDb = folder.msgDatabase;