Bug 1577835 - Fix 'else and comments' formatting in mail/. r=mkmelin
authorPaul Morris <paul@thunderbird.net>
Fri, 30 Aug 2019 21:52:10 -0400
changeset 35709 e8bbfa11d96e29a39aecc68e7fb01facafb1b0ae
parent 35708 f19f1829633fcb4a7496a96ab70bb92d5811f76c
child 35710 3aceadebffb57f6cc20db9a3a612e0af55071035
push id2486
push userclokep@gmail.com
push dateMon, 02 Sep 2019 20:24:43 +0000
treeherdercomm-beta@1b30a9a6e7f6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin
bugs1577835
Bug 1577835 - Fix 'else and comments' formatting in mail/. r=mkmelin
mail/base/content/contentAreaClick.js
mail/base/content/folderDisplay.js
mail/base/content/folderPane.js
mail/base/content/mailTabs.js
mail/base/content/mailWindowOverlay.js
mail/base/content/msgHdrView.js
mail/base/content/sanitize.js
mail/base/content/threadPane.js
mail/base/modules/DBViewWrapper.jsm
mail/base/modules/SearchSpec.jsm
mail/components/addrbook/content/abCardView.js
mail/components/addrbook/content/abCommon.js
mail/components/addrbook/content/addressbook.js
mail/components/compose/content/MsgComposeCommands.js
mail/components/im/modules/search_im.jsm
mail/components/search/SearchIntegration.jsm
mail/test/mozmill/attachment/test-attachment-size.js
mail/test/mozmill/shared-modules/test-folder-display-helpers.js
mail/test/resources/mozmill/mozmill/extension/content/stdlib/securable-module.jsm
--- a/mail/base/content/contentAreaClick.js
+++ b/mail/base/content/contentAreaClick.js
@@ -144,19 +144,18 @@ function contentAreaClick(aEvent) {
         return false;
       }
 
       // Is it an image?
       if (target.localName == "img" && target.hasAttribute("overflowing")) {
         if (target.hasAttribute("shrinktofit")) {
           // Currently shrunk to fit, so unshrink it.
           target.removeAttribute("shrinktofit");
-        }
-        // User wants to shrink now.
-        else {
+        } else {
+          // User wants to shrink now.
           target.setAttribute("shrinktofit", true);
         }
 
         return false;
       }
     }
     return true;
   }
--- a/mail/base/content/folderDisplay.js
+++ b/mail/base/content/folderDisplay.js
@@ -2649,27 +2649,25 @@ FolderDisplayWidget.prototype = {
     // Assume the bottom row is half-visible and should generally be ignored.
     // (We could actually do the legwork to see if there is a partial one...)
     const halfVisible = 1;
     let last = tree.getLastVisibleRow() - halfVisible;
     let span = tree.getPageLength() - halfVisible;
     let [topPadding, bottomPadding] = this.visibleRowPadding;
 
     let target;
-    // If the index is after the last visible guy (with padding), move down
-    //  so that the target index is padded in 1 from the bottom.
     if (aViewIndex >= last - bottomPadding) {
+      // The index is after the last visible guy (with padding),
+      // move down so that the target index is padded in 1 from the bottom.
       target = Math.min(maxIndex, aViewIndex + bottomPadding) - span;
-    }
-    // If the index is before the first visible guy (with padding), move up
-    else if (aViewIndex <= first + topPadding) {
-      // move up
+    } else if (aViewIndex <= first + topPadding) {
+      // The index is before the first visible guy (with padding), move up.
       target = Math.max(0, aViewIndex - topPadding);
-    } // it is already visible
-    else {
+    } else {
+      // It is already visible.
       return;
     }
 
     // this sets the first visible row
     tree.scrollToRow(target);
   },
 
   /**
--- a/mail/base/content/folderPane.js
+++ b/mail/base/content/folderPane.js
@@ -2858,18 +2858,18 @@ var gFolderTreeController = {
     let folder = aParent || gFolderTreeView.getSelectedFolders()[0];
 
     // Make sure we actually can create subfolders
     if (!folder.canCreateSubfolders) {
       // Check if we can create them at the root
       let rootMsgFolder = folder.server.rootMsgFolder;
       if (rootMsgFolder.canCreateSubfolders) {
         folder = rootMsgFolder;
-      } // just use the default account
-      else {
+      } else {
+        // Just use the default account.
         folder = GetDefaultAccountRootFolder();
       }
     }
 
     if (!folder) {
       return;
     }
 
--- a/mail/base/content/mailTabs.js
+++ b/mail/base/content/mailTabs.js
@@ -112,41 +112,37 @@ var mailTabType = {
         // (We don't want to assume that our immediate predecessor was a
         //  "folder" tab.)
         let modelTab = document
           .getElementById("tabmail")
           .getTabInfoForCurrentOrFirstModeInstance(aTab.mode);
 
         // - figure out whether to show the folder pane
         let folderPaneShouldBeVisible;
-        // explicitly told to us?
         if ("folderPaneVisible" in aArgs) {
+          // Explicitly told to us.
           folderPaneShouldBeVisible = aArgs.folderPaneVisible;
-        }
-        // inherit from the previous tab (if we've got one)
-        else if (modelTab) {
+        } else if (modelTab) {
+          // Inherit from the previous tab (if we've got one).
           folderPaneShouldBeVisible = modelTab.folderDisplay.folderPaneVisible;
-        }
-        // who doesn't love a folder pane?
-        else {
+        } else {
+          // Who doesn't love a folder pane?
           folderPaneShouldBeVisible = true;
         }
 
         // - figure out whether to show the message pane
         let messagePaneShouldBeVisible;
-        // explicitly told to us?
         if ("messagePaneVisible" in aArgs) {
+          // Explicitly told to us?
           messagePaneShouldBeVisible = aArgs.messagePaneVisible;
-        }
-        // inherit from the previous tab (if we've got one)
-        else if (modelTab) {
+        } else if (modelTab) {
+          // Inherit from the previous tab (if we've got one).
           messagePaneShouldBeVisible = modelTab.messageDisplay.visible;
-        }
-        // who doesn't love a message pane?
-        else {
+        } else {
+          // Who doesn't love a message pane?
           messagePaneShouldBeVisible = true;
         }
 
         this.openTab(
           aTab,
           false,
           new MessagePaneDisplayWidget(messagePaneShouldBeVisible),
           folderPaneShouldBeVisible
@@ -721,20 +717,19 @@ var mailTabType = {
     // -- display deck (thread pane / account central)
     // in a vertical view, the threadContentArea sits in the #threadPaneBox
     //  next to the message pane and its splitter.
     var kVerticalMailLayout = 2;
     if (layout == kVerticalMailLayout) {
       document.getElementById(
         "threadContentArea"
       ).collapsed = !displayDeckLegal;
-    }
-    // whereas in the default view, the displayDeck is the one next to the
-    //  message pane and its splitter
-    else {
+    } else {
+      // Whereas in the default view, the displayDeck is the one next to the
+      // message pane and its splitter.
       document.getElementById("displayDeck").collapsed = !displayDeckLegal;
     }
 
     // -- thread pane
     // the threadpane-splitter collapses the message pane (arguably a misnomer),
     //  but it only needs to exist when the thread-pane is legal
     document.getElementById(
       "threadpane-splitter"
--- a/mail/base/content/mailWindowOverlay.js
+++ b/mail/base/content/mailWindowOverlay.js
@@ -2197,21 +2197,22 @@ function getDestinationFolder(preselecte
   return destinationFolder;
 }
 
 /** Open subscribe window. */
 function MsgSubscribe() {
   var preselectedFolder = GetFirstSelectedMsgFolder();
 
   if (FeedMessageHandler.isFeedFolder(preselectedFolder)) {
+    // Open feed subscription dialog.
     openSubscriptionsDialog(preselectedFolder);
-  } // open feed subscription dialog
-  else {
+  } else {
+    // Open IMAP/NNTP subscription dialog.
     Subscribe(preselectedFolder);
-  } // open imap/nntp subscription dialog
+  }
 }
 
 /**
  * Show a confirmation dialog - check if the user really want to unsubscribe
  * from the given newsgroup/s.
  * @folders an array of newsgroup folders to unsubscribe from
  * @return true if the user said it's ok to unsubscribe
  */
--- a/mail/base/content/msgHdrView.js
+++ b/mail/base/content/msgHdrView.js
@@ -858,18 +858,18 @@ function SetTagHeader() {
     if (!(msgKeyArray[i] in tagKeys)) {
       msgKeyArray.splice(i, 1);
     }
   } // remove non-tag key
   var msgKeys = msgKeyArray.join(" ");
 
   if (msgKeys) {
     currentHeaderData.tags = { headerName: "tags", headerValue: msgKeys };
-  } // no more tags, so clear out the header field
-  else {
+  } else {
+    // No more tags, so clear out the header field.
     delete currentHeaderData.tags;
   }
 }
 
 function EnsureSubjectValue() {
   if (!("subject" in currentHeaderData)) {
     let foo = {};
     foo.headerValue = "";
--- a/mail/base/content/sanitize.js
+++ b/mail/base/content/sanitize.js
@@ -36,19 +36,19 @@ Sanitizer.prototype = {
    *           { itemName: error, ... } on (partial) failure
    */
   sanitize() {
     var branch = Services.prefs.getBranch(this.prefDomain);
     var errors = null;
 
     // Cache the range of times to clear
     if (this.ignoreTimespan) {
+      // If we ignore timespan, clear everything.
       var range = null;
-    } // If we ignore timespan, clear everything
-    else {
+    } else {
       range = this.range || Sanitizer.getClearRange();
     }
 
     for (var itemName in this.items) {
       var item = this.items[itemName];
       item.range = range;
       if ("clear" in item && item.canClear && branch.getBoolPref(itemName)) {
         // Some of these clear() may raise exceptions (see bug #265028)
--- a/mail/base/content/threadPane.js
+++ b/mail/base/content/threadPane.js
@@ -302,19 +302,18 @@ function MsgReverseSortThreadPane() {
   if (grouped) {
     if (gDBView.selection.count) {
       gFolderDisplay._saveSelection();
     }
 
     if (gFolderDisplay.view.isSingleFolder) {
       if (gFolderDisplay.view.isVirtual) {
         gFolderDisplay.view.showGroupedBySort = false;
-      }
-      // Must ensure rows are collapsed and kExpandAll is unset.
-      else {
+      } else {
+        // Must ensure rows are collapsed and kExpandAll is unset.
         gFolderDisplay.doCommand(Ci.nsMsgViewCommandType.collapseAll);
       }
     }
   }
 
   if (gFolderDisplay.view.isSortedAscending) {
     gFolderDisplay.view.sortDescending();
   } else {
--- a/mail/base/modules/DBViewWrapper.jsm
+++ b/mail/base/modules/DBViewWrapper.jsm
@@ -1840,19 +1840,18 @@ DBViewWrapper.prototype = {
    *  and setting us to false is ambiguous.  We should probably be using a
    *  single attribute with three constants...)
    */
   set showThreaded(aShowThreaded) {
     if (this.showThreaded != aShowThreaded) {
       let viewFlags = this._viewFlags;
       if (aShowThreaded) {
         viewFlags |= Ci.nsMsgViewFlagsType.kThreadedDisplay;
-      }
-      // maybe we shouldn't do anything in this case?
-      else {
+      } else {
+        // Maybe we shouldn't do anything in this case?
         viewFlags &= ~Ci.nsMsgViewFlagsType.kThreadedDisplay;
       }
       // lose the group bit...
       viewFlags &= ~Ci.nsMsgViewFlagsType.kGroupBySort;
       this._viewFlags = viewFlags;
     }
   },
 
@@ -1875,19 +1874,18 @@ DBViewWrapper.prototype = {
    */
   set showUnthreaded(aShowUnthreaded) {
     if (this.showUnthreaded != aShowUnthreaded) {
       if (aShowUnthreaded) {
         this._viewFlags &= ~(
           Ci.nsMsgViewFlagsType.kGroupBySort |
           Ci.nsMsgViewFlagsType.kThreadedDisplay
         );
-      }
-      // maybe we shouldn't do anything in this case?
-      else {
+      } else {
+        // Maybe we shouldn't do anything in this case?
         this._viewFlags =
           (this._viewFlags & ~Ci.nsMsgViewFlagsType.kGroupBySort) |
           Ci.nsMsgViewFlagsType.kThreadedDisplay;
       }
     }
   },
 
   /**
--- a/mail/base/modules/SearchSpec.jsm
+++ b/mail/base/modules/SearchSpec.jsm
@@ -252,19 +252,18 @@ SearchSpec.prototype = {
    *  weird combo-box that lets you view your unread messages, messages by tag,
    *  messages that aren't deleted, etc.
    *
    * @param aViewTerms The list of terms.  We take ownership and mutate it.
    */
   set viewTerms(aViewTerms) {
     if (aViewTerms) {
       this._viewTerms = this._groupifyTerms(aViewTerms);
-    }
-    // if they are nulling out already null values, do not apply view changes!
-    else if (this._viewTerms === null) {
+    } else if (this._viewTerms === null) {
+      // If they are nulling out already null values, do not apply view changes!
       return;
     } else {
       this._viewTerms = null;
     }
     this.owner._applyViewChanges();
   },
   /**
    * @return the view terms currently in effect.  Do not mutate this.
@@ -279,19 +278,18 @@ SearchSpec.prototype = {
    * @param aVirtualFolderTerms The list of terms.  We make our own copy and
    *     do not mutate yours.
    */
   set virtualFolderTerms(aVirtualFolderTerms) {
     if (aVirtualFolderTerms) {
       // we need to clone virtual folder terms because they are pulled from a
       //  persistent location rather than created on demand
       this._virtualFolderTerms = this._groupifyTerms(aVirtualFolderTerms, true);
-    }
-    // if they are nulling out already null values, do not apply view changes!
-    else if (this._virtualFolderTerms === null) {
+    } else if (this._virtualFolderTerms === null) {
+      // If they are nulling out already null values, do not apply view changes!
       return;
     } else {
       this._virtualFolderTerms = null;
     }
     this.owner._applyViewChanges();
   },
   /**
    * @return the Virtual folder terms currently in effect.  Do not mutate this.
@@ -305,19 +303,18 @@ SearchSpec.prototype = {
    *  augmented with the 'context' search terms potentially provided by
    *  viewTerms and virtualFolderTerms.
    *
    * @param aUserTerms The list of terms.  We take ownership and mutate it.
    */
   set userTerms(aUserTerms) {
     if (aUserTerms) {
       this._userTerms = this._groupifyTerms(aUserTerms);
-    }
-    // if they are nulling out already null values, do not apply view changes!
-    else if (this._userTerms === null) {
+    } else if (this._userTerms === null) {
+      // If they are nulling out already null values, do not apply view changes!
       return;
     } else {
       this._userTerms = null;
     }
     this.owner._applyViewChanges();
   },
   /**
    * @return the user terms currently in effect as set via the |userTerms|
@@ -421,20 +418,19 @@ SearchSpec.prototype = {
         scope = serverScope;
       } else {
         // we need to test the validity in online and offline tables
         let onlineValidityTable = validityManager.getTable(serverScope);
 
         let offlineScope;
         if (folder.flags & Ci.nsMsgFolderFlags.Offline) {
           offlineScope = Ci.nsMsgSearchScope.offlineMail;
-        }
-        // The onlineManual table is used for local search when there is no
-        //  body available.
-        else {
+        } else {
+          // The onlineManual table is used for local search when there is no
+          // body available.
           offlineScope = Ci.nsMsgSearchScope.onlineManual;
         }
 
         let offlineValidityTable = validityManager.getTable(offlineScope);
         let offlineAvailable = true;
         let onlineAvailable = true;
         for (let term of fixIterator(
           session.searchTerms,
@@ -464,22 +460,21 @@ SearchSpec.prototype = {
               }
               if (!onlineValidityTable.getAvailable(term.attrib, term.op)) {
                 onlineAvailable = false;
               }
             }
           }
         }
         // If both scopes work, honor the onlineSearch request, unless we're
-        // filtering (quick search and/or a view selected)
+        // filtering (quick search and/or a view selected).
+        // If only one works, use it. Otherwise, default to offline
         if (onlineAvailable && offlineAvailable) {
           scope = !filtering && this.onlineSearch ? serverScope : offlineScope;
-        }
-        // If only one works, use it. Otherwise, default to offline
-        else if (onlineAvailable) {
+        } else if (onlineAvailable) {
           scope = serverScope;
         } else {
           scope = offlineScope;
         }
       }
       session.addScopeTerm(scope, folder);
     }
   },
--- a/mail/components/addrbook/content/abCardView.js
+++ b/mail/components/addrbook/content/abCardView.js
@@ -200,23 +200,18 @@ function DisplayCardViewPane(realCard) {
   };
 
   var data = top.cvData;
   var visible;
 
   // Contact photo
   displayPhoto(card, cvData.cvPhoto);
 
-  var titleString;
-  if (generatedName == "") {
-    titleString = card.primaryEmail;
-  } // if no generatedName, use email
-  else {
-    titleString = generatedName;
-  }
+  // If no generatedName, use email.
+  let titleString = generatedName == "" ? card.primaryEmail : generatedName;
 
   // set fields in card view pane
   if (card.isMailList) {
     cvSetNode(
       data.CardTitle,
       gAddressBookBundle.getFormattedString("viewListTitle", [generatedName])
     );
   } else {
--- a/mail/components/addrbook/content/abCommon.js
+++ b/mail/components/addrbook/content/abCommon.js
@@ -743,19 +743,18 @@ function DirPaneSelectionChange() {
 
 function ChangeDirectoryByURI(uri = kPersonalAddressbookURI) {
   SetAbView(uri);
 
   // Actively de-selecting if there are any pre-existing selections
   // in the results list.
   if (gAbView && gAbView.getCardFromRow(0)) {
     gAbView.selection.clearSelection();
-  }
-  // the selection changes if we were switching directories.
-  else {
+  } else {
+    // The selection changes if we were switching directories.
     ResultsPaneSelectionChanged();
   }
 }
 
 function AbNewList() {
   goNewListDialog(getSelectedDirectoryURI());
 }
 
--- a/mail/components/addrbook/content/addressbook.js
+++ b/mail/components/addrbook/content/addressbook.js
@@ -784,22 +784,21 @@ function AbIMSelected() {
       } else if (chatContact.canSendMessage) {
         offline.push(chatContact);
       }
     }
   }
 
   let selectedContact;
 
-  // If we have any contacts in the online group, we'll take the first one.
   if (online.length) {
+    // We have contacts in the online group, take the first one.
     selectedContact = online[0];
-  }
-  // If not, we'll take the first contact in the offline group.
-  else if (offline.length) {
+  } else if (offline.length) {
+    // Else take the first contact in the offline group.
     selectedContact = offline[0];
   }
 
   // If we found a contact we can chat with, open / focus the chat tab with
   // a conversation opened with that contact.
   if (selectedContact) {
     let prplConv = selectedContact.createConversation();
     let uiConv = Services.conversations.getUIConversation(prplConv);
--- a/mail/components/compose/content/MsgComposeCommands.js
+++ b/mail/components/compose/content/MsgComposeCommands.js
@@ -4954,25 +4954,24 @@ function AddAttachments(aAttachments, aC
 
     if (!attachment.name) {
       attachment.name = gMsgCompose.AttachmentPrettyName(attachment.url, null);
     }
 
     // For security reasons, don't allow *-message:// uris to leak out.
     // We don't want to reveal the .slt path (for mailbox://), or the username
     // or hostname.
+    // Don't allow file or mail/news protocol uris to leak out either.
     if (
       /^mailbox-message:|^imap-message:|^news-message:/i.test(attachment.name)
     ) {
       attachment.name = getComposeBundle().getString(
         "messageAttachmentSafeName"
       );
-    }
-    // Don't allow file or mail/news protocol uris to leak out either.
-    else if (/^file:|^mailbox:|^imap:|^s?news:/i.test(attachment.name)) {
+    } else if (/^file:|^mailbox:|^imap:|^s?news:/i.test(attachment.name)) {
       attachment.name = getComposeBundle().getString("partAttachmentSafeName");
     }
 
     let item = bucket.appendItem(attachment);
     addedAttachments.appendElement(attachment);
 
     if (attachment.size != -1) {
       gAttachmentsSize += attachment.size;
--- a/mail/components/im/modules/search_im.jsm
+++ b/mail/components/im/modules/search_im.jsm
@@ -154,22 +154,21 @@ function scoreOffsets(aMessage, aContext
   for (let i = 0; i < offsetNums.length; i += 4) {
     let columnIndex = offsetNums[i];
     let termIndex = offsetNums[i + 1];
     columnTermIncidence[columnIndex][termIndex]++;
   }
 
   for (let iColumn = 0; iColumn < COLUMN_ALL_MATCH_SCORES.length; iColumn++) {
     let termIncidence = columnTermIncidence[iColumn];
-    // bestow all match credit
     if (termIncidence.every(identityFunc)) {
+      // Bestow all match credit.
       score += COLUMN_ALL_MATCH_SCORES[iColumn];
-    }
-    // bestow partial match credit
-    else if (termIncidence.some(identityFunc)) {
+    } else if (termIncidence.some(identityFunc)) {
+      // Bestow partial match credit.
       score += Math.min(
         COLUMN_ALL_MATCH_SCORES[iColumn],
         COLUMN_PARTIAL_PER_MATCH_SCORES[iColumn] *
           termIncidence.filter(identityFunc).length
       );
     }
     // bestow multiple match credit
     score +=
@@ -276,21 +275,19 @@ GlodaIMSearcher.prototype = {
         fulltextQueryString += this.andTerms ? " " : " OR ";
       }
 
       // Put our term in quotes.  This is needed for the tokenizer to be able
       //  to do useful things.  The exception is people clever enough to use
       //  NEAR.
       if (/^NEAR(\/\d+)?$/.test(term)) {
         fulltextQueryString += term;
-      }
-      // Check if this is a single-character CJK search query.  If so, we want
-      //  to add a wildcard.
-      // Our tokenizer treats anything at/above 0x2000 as CJK for now.
-      else if (term.length == 1 && term.charCodeAt(0) >= 0x2000) {
+      } else if (term.length == 1 && term.charCodeAt(0) >= 0x2000) {
+        // This is a single-character CJK search query, so add a wildcard.
+        // Our tokenizer treats anything at/above 0x2000 as CJK for now.
         fulltextQueryString += term + "*";
       } else if (
         (term.length == 2 &&
           term.charCodeAt(0) >= 0x2000 &&
           term.charCodeAt(1) >= 0x2000) ||
         term.length >= 3
       ) {
         fulltextQueryString += '"' + term + '"';
--- a/mail/components/search/SearchIntegration.jsm
+++ b/mail/components/search/SearchIntegration.jsm
@@ -494,20 +494,19 @@ var SearchSupport = {
       this._currentFolderToIndex = this._foldersToIndex.next().value;
     }
 
     // we'd like to index more than one message on each timer fire,
     // but since streaming is async, it's hard to know how long
     // it's going to take to stream any particular message.
     if (this._currentFolderToIndex) {
       msgHdrAndReindexTime = this._findNextHdrToIndex();
-    }
-    // we've cycled through all the folders, we should take a break
-    // from indexing of existing messages
-    else {
+    } else {
+      // We've cycled through all the folders. We should take a break
+      // from indexing of existing messages.
       this.__backgroundIndexingDone = true;
     }
 
     if (!msgHdrAndReindexTime) {
       this._log.debug("reached end of folder");
       if (this._currentFolderToIndex) {
         this._currentFolderToIndex = null;
       }
--- a/mail/test/mozmill/attachment/test-attachment-size.js
+++ b/mail/test/mozmill/attachment/test-attachment-size.js
@@ -208,18 +208,18 @@ function setupModule(module) {
   /* Much like the above comment, libmime counts bytes differently on Windows,
    * where it counts newlines (\r\n) as 2 bytes. Mac and Linux treats them as
    * 1 byte.
    */
   var attachedMessageLength;
   if (epsilon == 4) {
     // Windows
     attachedMessageLength = attachedMessage.toMessageString().length;
-  } // Mac/Linux
-  else {
+  } else {
+    // Mac/Linux
     attachedMessageLength = attachedMessage
       .toMessageString()
       .replace(/\r\n/g, "\n").length;
   }
 
   folder = create_folder("AttachmentSizeA");
   for (let i = 0; i < messages.length; i++) {
     // First, add any missing info to the message object.
--- a/mail/test/mozmill/shared-modules/test-folder-display-helpers.js
+++ b/mail/test/mozmill/shared-modules/test-folder-display-helpers.js
@@ -818,22 +818,21 @@ function switch_tab(aNewTab) {
     targetTab.messageDisplay.visible &&
     targetTab.folderDisplay.selectedCount
   ) {
     plan_for_message_display(targetTab);
   }
 
   mc.tabmail.switchToTab(targetTab);
   if (mc.messageDisplay.visible) {
-    // if there is something selected, wait for display completion
     if (mc.folderDisplay.selectedCount) {
+      // There is something selected, wait for display completion.
       wait_for_message_display_completion(mc, true);
-    }
-    // otherwise wait for the pane to end up blank
-    else {
+    } else {
+      // Wait for the pane to end up blank.
       wait_for_blank_content_pane();
     }
   }
 }
 
 /**
  * Assert that the currently selected tab is the given one.
  *
@@ -988,19 +987,18 @@ function close_tab(aTabToClose) {
   }
 
   mc.tabmail.closeTab(aTabToClose);
 
   // if there is a message visible in the tab, make sure we wait for the load
   if (nextTab && mc.messageDisplay.visible) {
     if (mc.folderDisplay.selectedCount) {
       wait_for_message_display_completion(mc, true);
-    }
-    // otherwise wait for the pane to end up blank
-    else {
+    } else {
+      // Otherwise wait for the pane to end up blank.
       wait_for_blank_content_pane();
     }
   }
 
   // check that the tab count decreased
   if (mc.tabmail.tabContainer.allTabs.length != preCount - 1) {
     throw new Error("The tab never actually got closed!");
   }
@@ -1759,18 +1757,18 @@ function close_popup(aController, eid) {
     return;
   }
   mark_action("fdh", "close_popup", [elem]);
   // if it's in the process of closing, don't push escape
   if (elem.state == "hiding") {
     mark_action("fdh", "close_popup", [
       "popup suspiciously already closing...",
     ]);
-  } // actually push escape because it's not closing/closed
-  else {
+  } else {
+    // Actually push escape because it's not closing/closed.
     aController.keypress(eid, "VK_ESCAPE", {});
   }
   utils.waitFor(() => elem.state == "closed", "Popup did not close!", 1000, 50);
 }
 
 /**
  * Pretend we are pressing the delete key, triggering message deletion of the
  *  selected messages.
--- a/mail/test/resources/mozmill/mozmill/extension/content/stdlib/securable-module.jsm
+++ b/mail/test/resources/mozmill/mozmill/extension/content/stdlib/securable-module.jsm
@@ -70,21 +70,20 @@
   // bug 418356:
   //
   // https://bugzilla.mozilla.org/show_bug.cgi?id=418356
   var parentChromeURIString;
   if (baseURI) {
     // We're being loaded from a chrome-privileged document, so
     // use its URL as the parent string.
     parentChromeURIString = baseURI.spec;
-  }
-  // We're being loaded from a chrome-privileged JS module or
-  // SecurableModule, so use its filename (which may itself
-  // contain a reference to a parent).
-  else {
+  } else {
+    // We're being loaded from a chrome-privileged JS module or
+    // SecurableModule, so use its filename (which may itself
+    // contain a reference to a parent).
     parentChromeURIString = Components.stack.filename;
   }
 
   function maybeParentifyFilename(filename) {
     var doParentifyFilename = true;
     try {
       // TODO: Ideally we should just make
       // nsIChromeRegistry.wrappersEnabled() available from script