Bug 787186 - Thunderbird clears news feed display window and list when refreshing feeds. r+a=Standard8
authoralta88 <alta88@gmail.com>
Sun, 21 Oct 2012 13:11:35 -0600
changeset 13550 82fcebdc15e2eeeb6e34f4cf0fc3da8dc4c1a958
parent 13549 53faaeb4d17e9a41635c4116b61069f45d091a9d
child 13551 161c4dc3487c2b686500b0f6e2cb582f563a3e61
push id752
push userbugzilla@standard8.plus.com
push dateMon, 12 Nov 2012 12:15:57 +0000
treeherdercomm-beta@161c4dc3487c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs787186
Bug 787186 - Thunderbird clears news feed display window and list when refreshing feeds. r+a=Standard8
mailnews/extensions/newsblog/content/feed-subscriptions.js
mailnews/extensions/newsblog/content/utils.js
mailnews/extensions/newsblog/js/newsblog.js
--- a/mailnews/extensions/newsblog/content/feed-subscriptions.js
+++ b/mailnews/extensions/newsblog/content/feed-subscriptions.js
@@ -1644,17 +1644,17 @@ var FeedSubscriptions = {
       let curSelIndex = this.currentSelectedIndex;
       let curSelItem = this.currentSelectedItem;
       let firstVisRow = feedWindow.mView.treeBox.getFirstVisibleRow();
       let indexInView = feedWindow.mView.getItemInViewIndex(parentFolder);
       let open = indexInView != null;
 
       if (aFolder.isServer)
       {
-        if (indexInView)
+        if (indexInView != null)
           // Existing account root folder in the view.
           open = feedWindow.mView.getItemAtIndex(indexInView).open;
         else
         {
           // Add the account root folder to the view.
           feedWindow.mFeedContainers.push(feedWindow.makeFolderObject(parentFolder, 0));
           feedWindow.mView.mRowCount++;
           feedWindow.mTree.view = feedWindow.mView;
--- a/mailnews/extensions/newsblog/content/utils.js
+++ b/mailnews/extensions/newsblog/content/utils.js
@@ -128,16 +128,20 @@ var FeedUtils = {
 
     server = MailServices.accounts.createIncomingServer(userName, hostName, serverType);
     server.biffMinutes = FeedUtils.kBiffMinutesDefault;
     server.prettyName = aName ? aName : defaultName;
     server.valid = true;
     let account = MailServices.accounts.createAccount();
     account.incomingServer = server;
 
+    // Ensure the Trash folder db (.msf) is created otherwise folder/message
+    // deletes will throw until restart creates it.
+    server.msgStore.discoverSubFolders(server.rootMsgFolder, false);
+
     // Create "Local Folders" if none exist yet as it's guaranteed that
     // those exist when any account exists.
     let localFolders;
     try {
       localFolders = MailServices.accounts.localFoldersServer;
     }
     catch (ex) {}
 
--- a/mailnews/extensions/newsblog/js/newsblog.js
+++ b/mailnews/extensions/newsblog/js/newsblog.js
@@ -21,18 +21,22 @@ var nsNewsBlogFeedDownloader =
     {
       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);
-    // Add the base folder; it does not get added by ListDescendents.
-    allFolders.AppendElement(aFolder);
+    if (!aFolder.isServer)
+      // Add the base folder; it does not get added by ListDescendents.  Do not
+      // add the account folder as it doesn't have the feedUrl property or even
+      // a msgDatabase necessarily.
+      allFolders.AppendElement(aFolder);
+
     aFolder.ListDescendents(allFolders);
     let numFolders = allFolders.Count();
     let trashFolder =
         aFolder.rootFolder.getFolderWithFlags(Ci.nsMsgFolderFlags.Trash);
 
     function feeder() {
       let folder;
       for (let i = 0; i < numFolders; i++) {