Bug 1364167 - Do not change folders when repairing a folder other than the current one. r=jorgk
authorGeoff Lankow <geoff@darktrojan.net>
Tue, 12 Nov 2019 21:20:04 +1300
changeset 37599 39ed67f1df1f558ef4e5f2382b24ad6859db7171
parent 37598 3ea95f036953bba46cf9fa83ad442a785ad4c7f6
child 37600 f6af99c9ff9d90f6086e77addd21ba425ce6ac9b
push id396
push userclokep@gmail.com
push dateMon, 06 Jan 2020 23:11:57 +0000
reviewersjorgk
bugs1364167
Bug 1364167 - Do not change folders when repairing a folder other than the current one. r=jorgk
mail/base/content/folderPane.js
--- a/mail/base/content/folderPane.js
+++ b/mail/base/content/folderPane.js
@@ -2934,17 +2934,22 @@ var gFolderTreeController = {
         // Remove the offline store, if any.
         let offlineStore = folder.filePath;
         // XXX todo: figure out how to delete a maildir directory async. This
         // delete causes main thread lockup for large maildir folders.
         if (offlineStore.exists()) {
           offlineStore.remove(true);
         }
       }
-      gFolderDisplay.view.close();
+
+      // We may be rebuilding a folder that is not the displayed one.
+      let sameFolder = gFolderDisplay.displayedFolder == folder;
+      if (sameFolder) {
+        gFolderDisplay.view.close();
+      }
 
       // Send a notification that we are triggering a database rebuild.
       MailServices.mfn.notifyItemEvent(
         folder,
         "FolderReindexTriggered",
         null,
         null
       );
@@ -2955,17 +2960,19 @@ var gFolderTreeController = {
       msgDB.summaryValid = false;
       try {
         folder.closeAndBackupFolderDB("");
       } catch (e) {
         // In a failure, proceed anyway since we're dealing with problems
         folder.ForceDBClosed();
       }
       folder.updateFolder(msgWindow);
-      gFolderDisplay.show(folder);
+      if (sameFolder) {
+        gFolderDisplay.show(folder);
+      }
     }
 
     window.openDialog(
       "chrome://messenger/content/folderProps.xul",
       "",
       "chrome,modal,centerscreen",
       {
         folder,