Bug 1498041 - Part 0: Give modules in mail/base/modules proper names. r=jorgk
authorGeoff Lankow <geoff@darktrojan.net>
Thu, 11 Oct 2018 11:16:53 +1300
changeset 33351 5333ee90a410dedf329fe207fff3b6af98f370d2
parent 33350 7f3ce4f1b0a119e9428bbda4391765f009396368
child 33352 e4fff573e9c7593cfeec20903728590d37443c7b
push id387
push userclokep@gmail.com
push dateMon, 10 Dec 2018 21:30:47 +0000
reviewersjorgk
bugs1498041
Bug 1498041 - Part 0: Give modules in mail/base/modules proper names. r=jorgk
mail/app/profile/all-thunderbird.js
mail/base/content/SearchDialog.js
mail/base/content/folderDisplay.js
mail/base/content/folderPane.js
mail/base/content/mail3PaneWindowCommands.js
mail/base/content/mailCommands.js
mail/base/content/mailTabs.js
mail/base/content/mailWidgets.xml
mail/base/content/mailWindow.js
mail/base/content/mailWindowOverlay.js
mail/base/content/messageWindow.js
mail/base/content/msgHdrView.js
mail/base/content/msgMail3PaneWindow.js
mail/base/content/multimessageview.js
mail/base/content/nsContextMenu.js
mail/base/content/quickFilterBar.js
mail/base/modules/AttachmentChecker.jsm
mail/base/modules/DBViewWrapper.jsm
mail/base/modules/DisplayNameUtils.jsm
mail/base/modules/MailConsts.js
mail/base/modules/MailConsts.jsm
mail/base/modules/MailInstrumentation.jsm
mail/base/modules/MailMigrator.jsm
mail/base/modules/MailUtils.js
mail/base/modules/MailUtils.jsm
mail/base/modules/MailViewManager.jsm
mail/base/modules/MsgHdrSyntheticView.js
mail/base/modules/MsgHdrSyntheticView.jsm
mail/base/modules/QuickFilterManager.jsm
mail/base/modules/SearchSpec.jsm
mail/base/modules/SessionStoreManager.jsm
mail/base/modules/SummaryFrameManager.jsm
mail/base/modules/TBDistCustomizer.jsm
mail/base/modules/attachmentChecker.js
mail/base/modules/dbViewWrapper.js
mail/base/modules/displayNameUtils.js
mail/base/modules/distribution.js
mail/base/modules/mailInstrumentation.js
mail/base/modules/mailMigrator.js
mail/base/modules/mailViewManager.js
mail/base/modules/moz.build
mail/base/modules/oauth.jsm
mail/base/modules/quickFilterManager.js
mail/base/modules/searchSpec.js
mail/base/modules/sessionStoreManager.js
mail/base/modules/summaryFrameManager.js
mail/base/test/unit/resources/viewWrapperTestUtils.js
mail/base/test/unit/test_attachmentChecker.js
mail/base/test/unit/test_mailGlue_distribution.js
mail/base/test/unit/test_windows_font_migration.js
mail/components/compose/content/MsgComposeCommands.js
mail/components/mailGlue.js
mail/components/nsMailDefaultHandler.js
mail/components/search/content/SpotlightIntegration.js
mail/components/search/content/WinSearchIntegration.js
mail/extensions/mailviews/content/msgViewPickerOverlay.js
mail/test/mozmill/folder-display/test-columns.js
mail/test/mozmill/folder-display/test-mail-views.js
mail/test/mozmill/folder-display/test-message-commands.js
mail/test/mozmill/folder-display/test-opening-messages-without-a-backing-view.js
mail/test/mozmill/folder-display/test-recent-menu.js
mail/test/mozmill/instrumentation/test-instrument-setup.js
mail/test/mozmill/session-store/test-session-store.js
mail/test/mozmill/shared-modules/test-folder-display-helpers.js
mailnews/base/content/folderWidgets.xml
mailnews/base/content/junkCommands.js
mailnews/base/content/msgFolderPickerOverlay.js
mailnews/base/content/subscribe.js
mailnews/base/content/virtualFolderProperties.js
mailnews/base/prefs/content/am-copies.js
mailnews/base/prefs/content/am-junk.js
mailnews/base/prefs/content/am-server.js
mailnews/base/prefs/content/amUtils.js
mailnews/base/prefs/content/converterDialog.js
mailnews/base/search/content/FilterEditor.js
mailnews/base/search/content/searchWidgets.xml
mailnews/base/src/nsMailNewsCommandLineHandler.js
mailnews/base/src/nsMsgSearchDBView.cpp
mailnews/base/src/nsMsgXFVirtualFolderDBView.cpp
mailnews/base/util/mailstoreConverter.jsm
mailnews/db/gloda/modules/index_msg.js
mailnews/db/gloda/test/unit/base_index_messages.js
mailnews/extensions/newsblog/content/FeedUtils.jsm
mailnews/imap/test/unit/test_saveTemplate.js
--- a/mail/app/profile/all-thunderbird.js
+++ b/mail/app/profile/all-thunderbird.js
@@ -597,17 +597,17 @@ pref("font.name.sans-serif.el", "Lucida 
 pref("font.name.monospace.el", "Menlo");
 pref("font.name-list.sans-serif.el", "Lucida Grande");
 pref("font.name-list.monospace.el", "Menlo, Monaco");
 pref("font.size.variable.el", 15);
 pref("font.size.fixed.el", 12);
 #endif
 
 // Since different versions of Windows need different settings, we'll handle
-// this in mailMigrator.js.
+// this in MailMigrator.jsm.
 
 // Linux, in other words.  Other OSes may wish to override.
 #ifdef UNIX_BUT_NOT_MAC
 // The font.name-list fallback is defined in case font.name isn't
 // present -- e.g. in case a profile that's been used on Windows Vista or above
 // is used on Linux.
 pref("font.name-list.serif.x-unicode", "serif");
 pref("font.name-list.sans-serif.x-unicode", "sans-serif");
--- a/mail/base/content/SearchDialog.js
+++ b/mail/base/content/SearchDialog.js
@@ -1,13 +1,13 @@
 /* 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/. */
 
-ChromeUtils.import("resource:///modules/MailUtils.js");
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var gCurrentFolder;
 
 var gFolderDisplay;
 // Although we don't display messages, we have a message display object to
 //  simplify our code.  It's just always disabled.
--- a/mail/base/content/folderDisplay.js
+++ b/mail/base/content/folderDisplay.js
@@ -1,15 +1,15 @@
 /* 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/. */
 
-ChromeUtils.import("resource:///modules/dbViewWrapper.js");
+ChromeUtils.import("resource:///modules/DBViewWrapper.jsm");
 ChromeUtils.import("resource:///modules/jsTreeSelection.js");
-ChromeUtils.import("resource:///modules/MailUtils.js");
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var gFolderDisplay = null;
 var gMessageDisplay = null;
 
 var nsMsgFolderFlags = Ci.nsMsgFolderFlags;
 var nsMsgMessageFlags = Ci.nsMsgMessageFlags;
 
--- a/mail/base/content/folderPane.js
+++ b/mail/base/content/folderPane.js
@@ -5,17 +5,17 @@
 // Implements a tree of folders. It shows icons depending on folder type
 // and other fancy styling.
 // This is used in the main folder pane, but also some dialogs that need
 // to show a nice list of folders.
 
 ChromeUtils.import("resource:///modules/folderUtils.jsm");
 ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
 ChromeUtils.import("resource:///modules/MailServices.jsm");
-ChromeUtils.import("resource:///modules/MailUtils.js");
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 ChromeUtils.import("resource:///modules/IOUtils.js");
 ChromeUtils.import("resource:///modules/FeedUtils.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 if (typeof FeedMessageHandler != "object")
   Services.scriptloader.loadSubScript("chrome://messenger-newsblog/content/newsblogOverlay.js");
 
 var kDefaultMode = "all";
--- a/mail/base/content/mail3PaneWindowCommands.js
+++ b/mail/base/content/mail3PaneWindowCommands.js
@@ -3,17 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /**
  * Functionality for the main application window (aka the 3pane) usually
  * consisting of folder pane, thread pane and message pane.
  */
 
 ChromeUtils.import("resource:///modules/MailServices.jsm");
-ChromeUtils.import("resource:///modules/MailUtils.js");
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
 
 // Controller object for folder pane
 var FolderPaneController =
 {
   supportsCommand: function(command)
   {
--- a/mail/base/content/mailCommands.js
+++ b/mail/base/content/mailCommands.js
@@ -1,15 +1,15 @@
 /* -*- Mode: Javascript; 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/. */
 
 ChromeUtils.import("resource:///modules/MailServices.jsm");
-ChromeUtils.import("resource:///modules/MailUtils.js");
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 
 /**
  * Get the identity that most likely is the best one to use, given the hint.
  * @param identities    nsIArray<nsIMsgIdentity> of identities
  * @param optionalHint  string containing comma separated mailboxes
  * @param useDefault    If true, use the default identity of the default
  *                      account as last choice. This is useful when all
  *                      identities are passed in. Otherwise, use the first
--- a/mail/base/content/mailTabs.js
+++ b/mail/base/content/mailTabs.js
@@ -1,13 +1,13 @@
 /* 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/. */
 
-ChromeUtils.import("resource:///modules/MsgHdrSyntheticView.js");
+ChromeUtils.import("resource:///modules/MsgHdrSyntheticView.jsm");
 ChromeUtils.import("resource:///modules/errUtils.js");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 /**
  * Displays message "folder"s, mail "message"s, and "glodaList" results.  The
  *  commonality is that they all use the "mailContent" panel's folder tree,
  *  thread tree, and message pane objects.  This happens for historical reasons,
  *  likely involving the fact that prior to the introduction of this
--- a/mail/base/content/mailWidgets.xml
+++ b/mail/base/content/mailWidgets.xml
@@ -2407,17 +2407,17 @@
           <xul:spring anonid="spring" flex="100%"/>
         </xul:hbox>
         <xul:description anonid="preview" class="folderSummary-message-row folderSummary-previewText" xbl:inherits="value=previewText" crop="right"></xul:description>
       </xul:vbox>
     </content>
     <implementation>
       <constructor>
         <![CDATA[
-          ChromeUtils.import("resource:///modules/MailUtils.js");
+          ChromeUtils.import("resource:///modules/MailUtils.jsm");
           ChromeUtils.import("resource://gre/modules/Services.jsm", this);
 
           if (!this.Services.prefs.getBoolPref("mail.biff.alert.show_preview"))
             document.getAnonymousElementByAttribute(this, "anonid", "preview").hidden = true;
           var hideSubject = !this.Services.prefs.getBoolPref("mail.biff.alert.show_subject");
           var hideSender = !this.Services.prefs.getBoolPref("mail.biff.alert.show_sender");
           if (hideSubject)
             document.getAnonymousElementByAttribute(this, "anonid", "subject").hidden = true;
--- a/mail/base/content/mailWindow.js
+++ b/mail/base/content/mailWindow.js
@@ -1,16 +1,16 @@
 /**
  * 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/. */
 
 ChromeUtils.import("resource:///modules/MailServices.jsm");
 ChromeUtils.import("resource:///modules/appIdleManager.js");
-ChromeUtils.import("resource:///modules/MailUtils.js");
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 ChromeUtils.import("resource:///modules/gloda/log4moz.js");
 ChromeUtils.import("resource:///modules/gloda/public.js");
 
 //This file stores variables common to mail windows
 var messenger;
 var statusFeedback;
--- a/mail/base/content/mailWindowOverlay.js
+++ b/mail/base/content/mailWindowOverlay.js
@@ -1,18 +1,18 @@
 /* -*- 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/. */
 
 ChromeUtils.import("resource:///modules/FeedUtils.jsm");
 ChromeUtils.import("resource:///modules/gloda/dbview.js");
-ChromeUtils.import("resource:///modules/MailConsts.js");
+ChromeUtils.import("resource:///modules/MailConsts.jsm");
 ChromeUtils.import("resource:///modules/MailServices.jsm");
-ChromeUtils.import("resource:///modules/MailUtils.js");
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
 ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
 
 ChromeUtils.defineModuleGetter(this, "BrowserToolboxProcess", "resource://devtools/client/framework/ToolboxProcess.jsm");
 ChromeUtils.defineModuleGetter(this, "ScratchpadManager","resource://devtools/client/scratchpad/scratchpad-manager.jsm");
 Object.defineProperty(this, "HUDService", {
   get: function HUDService_getter() {
--- a/mail/base/content/messageWindow.js
+++ b/mail/base/content/messageWindow.js
@@ -1,21 +1,21 @@
 /**
  * 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/. */
 
 /* This is where functions related to the standalone message window are kept */
 
 ChromeUtils.import("resource:///modules/jsTreeSelection.js");
-ChromeUtils.import("resource:///modules/MailUtils.js");
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-ChromeUtils.import("resource:///modules/MsgHdrSyntheticView.js");
+ChromeUtils.import("resource:///modules/MsgHdrSyntheticView.jsm");
 
 // from MailNewsTypes.h
 var nsMsgKey_None = 0xFFFFFFFF;
 var nsMsgViewIndex_None = 0xFFFFFFFF;
 
 /* globals for a particular window */
 
 /// we have no tree view; let people know that.
--- a/mail/base/content/msgHdrView.js
+++ b/mail/base/content/msgHdrView.js
@@ -4,17 +4,17 @@
 
 /**
  * Functions related to displaying the headers for a selected message in the
  * message pane.
  */
 
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
-ChromeUtils.import("resource:///modules/displayNameUtils.js");
+ChromeUtils.import("resource:///modules/DisplayNameUtils.jsm");
 ChromeUtils.import("resource:///modules/MailServices.jsm");
 ChromeUtils.import("resource:///modules/gloda/utils.js");
 var {Status: statusUtils} =
   ChromeUtils.import("resource:///modules/imStatusUtils.jsm");
 
 ////////////////////////////////////////////////////////////////////////////////////
 // Warning: It's critical that the code in here for displaying the message
 // headers for a selected message remain as fast as possible. In particular,
@@ -1278,17 +1278,17 @@ function updateEmailAddressNode(emailAdd
   emailAddressNode.setAttribute("displayName", address.displayName || "");
 
   if (address.emailAddress)
     UpdateEmailNodeDetails(address.emailAddress, emailAddressNode);
 }
 
 function UpdateEmailNodeDetails(aEmailAddress, aDocumentNode, aCardDetails) {
   // If we haven't been given specific details, search for a card.
-  var cardDetails = aCardDetails || GetCardForEmail(aEmailAddress);
+  var cardDetails = aCardDetails || DisplayNameUtils.getCardForEmail(aEmailAddress);
   aDocumentNode.cardDetails = cardDetails;
 
   if (!cardDetails.card) {
     aDocumentNode.setAttribute("hascard", "false");
     aDocumentNode.setAttribute("tooltipstar",
       document.getElementById("addToAddressBookItem").label);
   } else {
     aDocumentNode.setAttribute("hascard", "true");
@@ -1342,20 +1342,22 @@ function UpdateEmailNodeDetails(aEmailAd
   UpdateEmailPresenceDetails(aDocumentNode, chatContact);
 
   // When we are adding cards, we don't want to move the display around if the
   // user has clicked on the star, therefore if it is locked, just exit and
   // leave the display updates until later.
   if (aDocumentNode.hasAttribute("updatingUI"))
     return;
 
-  var displayName = FormatDisplayName(aEmailAddress,
-                                      aDocumentNode.getAttribute("displayName"),
-                                      aDocumentNode.getAttribute("headerName"),
-                                      aDocumentNode.cardDetails.card);
+  var displayName = DisplayNameUtils.formatDisplayName(
+    aEmailAddress,
+    aDocumentNode.getAttribute("displayName"),
+    aDocumentNode.getAttribute("headerName"),
+    aDocumentNode.cardDetails.card
+  );
 
   if (gShowCondensedEmailAddresses && displayName) {
     aDocumentNode.setAttribute("tooltiptext", aEmailAddress);
   } else {
     aDocumentNode.removeAttribute("tooltiptext");
     displayName = aDocumentNode.getAttribute("fullAddress") ||
                   aDocumentNode.getAttribute("displayName");
   }
@@ -1389,20 +1391,22 @@ function UpdateExtraAddressProcessing(aA
                                       aParentDir, aItem)
 {
   switch (aAction) {
   case nsIAbListener.itemChanged:
     if (aAddressData &&
         aDocumentNode.cardDetails.card &&
         aItem.hasEmailAddress(aAddressData.emailAddress)) {
       aDocumentNode.cardDetails.card = aItem;
-      var displayName = FormatDisplayName(aAddressData.emailAddress,
-                                          aDocumentNode.getAttribute("displayName"),
-                                          aDocumentNode.getAttribute("headerName"),
-                                          aDocumentNode.cardDetails.card);
+      var displayName = DisplayNameUtils.formatDisplayName(
+        aAddressData.emailAddress,
+        aDocumentNode.getAttribute("displayName"),
+        aDocumentNode.getAttribute("headerName"),
+        aDocumentNode.cardDetails.card
+      );
 
       if (gShowCondensedEmailAddresses && displayName) {
         aDocumentNode.setAttribute("label", displayName);
       } else {
         aDocumentNode.setAttribute("label",
                                    aDocumentNode.getAttribute("fullAddress") ||
                                    aDocumentNode.getAttribute("displayName"));
       }
@@ -1487,50 +1491,16 @@ function setupEmailAddressPopup(emailAdd
     }
   } else {
     document.getElementById("addToAddressBookItem").removeAttribute("hidden");
     document.getElementById("editContactItem").setAttribute("hidden", true);
     document.getElementById("viewContactItem").setAttribute("hidden", true);
   }
 }
 
-/**
- * Returns an object with two properties, book and card. If the email address
- * is found in the address books, then the book will contain an nsIAbDirectory,
- * and card will contain an nsIAbCard. If the email address is not found, both
- * items will contain null.
- *
- * @param emailAddress  address to look for
- * @return              an object with two properties, .book and .card
- */
-function getCardForEmail(emailAddress)
-{
-  // Email address is searched for in any of the address books that support
-  // the cardForEmailAddress function.
-  // Future expansion could be to domain matches
-
-  var books = MailServices.ab.directories;
-
-  var result = { book: null, card: null };
-
-  while (!result.card && books.hasMoreElements()) {
-    var ab = books.getNext().QueryInterface(nsIAbDirectory);
-    try {
-      var card = ab.cardForEmailAddress(emailAddress);
-      if (card) {
-        result.book = ab;
-        result.card = card;
-      }
-    }
-    catch (ex) { }
-  }
-
-  return result;
-}
-
 function onClickEmailStar(event, emailAddressNode)
 {
   // Only care about left-click events
   if (event.button != 0)
     return;
 
   if (emailAddressNode && emailAddressNode.cardDetails &&
       emailAddressNode.cardDetails.card) {
--- a/mail/base/content/msgMail3PaneWindow.js
+++ b/mail/base/content/msgMail3PaneWindow.js
@@ -3,24 +3,24 @@
  * 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/. */
 
 ChromeUtils.import("resource:///modules/activity/activityModules.jsm");
 ChromeUtils.import("resource:///modules/errUtils.js");
 ChromeUtils.import("resource:///modules/folderUtils.jsm");
 ChromeUtils.import("resource:///modules/IOUtils.js");
 ChromeUtils.import("resource:///modules/jsTreeSelection.js");
-ChromeUtils.import("resource:///modules/MailConsts.js");
-ChromeUtils.import("resource:///modules/mailInstrumentation.js");
+ChromeUtils.import("resource:///modules/MailConsts.jsm");
+ChromeUtils.import("resource:///modules/MailInstrumentation.jsm");
 ChromeUtils.import("resource:///modules/mailnewsMigrator.js");
 ChromeUtils.import("resource:///modules/MailServices.jsm");
 ChromeUtils.import("resource:///modules/msgDBCacheManager.js");
-ChromeUtils.import("resource:///modules/sessionStoreManager.js");
-ChromeUtils.import("resource:///modules/summaryFrameManager.js");
-ChromeUtils.import("resource:///modules/MailUtils.js");
+ChromeUtils.import("resource:///modules/SessionStoreManager.jsm");
+ChromeUtils.import("resource:///modules/SummaryFrameManager.jsm");
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
 ChromeUtils.import("resource://gre/modules/Color.jsm");
 
 XPCOMUtils.defineLazyModuleGetters(this, {
   LightweightThemeManager: "resource://gre/modules/LightweightThemeManager.jsm",
 });
 
@@ -391,17 +391,17 @@ function OnLoadMessenger()
   MailOfflineMgr.init();
   CreateMailWindowGlobals();
   GetMessagePaneWrapper().collapsed = true;
   msgDBCacheManager.init();
   Services.search.init();
 
   // This needs to be before we throw up the account wizard on first run.
   try {
-    mailInstrumentationManager.init();
+    MailInstrumentation.init();
   } catch(ex) {logException(ex);}
 
   // - initialize tabmail system
   // Do this before LoadPostAccountWizard since that code selects the first
   //  folder for display, and we want gFolderDisplay setup and ready to handle
   //  that event chain.
   // Also, we definitely need to register the tab type prior to the call to
   //  specialTabs.openSpecialTabsOnStartup below.
@@ -454,17 +454,17 @@ function LoadPostAccountWizard()
 {
   InitMsgWindow();
   messenger.setWindow(window, msgWindow);
 
   InitPanes();
   MigrateJunkMailSettings();
   MigrateFolderViews();
   MigrateOpenMessageBehavior();
-  ChromeUtils.import("resource:///modules/mailMigrator.js");
+  ChromeUtils.import("resource:///modules/MailMigrator.jsm");
   MailMigrator.migratePostAccountWizard();
 
   accountManager.setSpecialFolders();
 
   try {
     accountManager.loadVirtualFolders();
   } catch (e) {Cu.reportError(e);}
   accountManager.addIncomingServerListener(gThreePaneIncomingServerListener);
@@ -625,17 +625,17 @@ function OnUnloadMessenger()
   Services.prefs.removeObserver("mail.showCondensedAddresses", MailPrefObserver);
 
   if (gRightMouseButtonSavedSelection) {
     // Avoid possible cycle leaks.
     gRightMouseButtonSavedSelection.view = null;
     gRightMouseButtonSavedSelection = null;
   }
 
-  sessionStoreManager.unloadingWindow(window);
+  SessionStoreManager.unloadingWindow(window);
 
   TabsInTitlebar.uninit();
 
   ToolbarIconColor.uninit();
 
   CompactTheme.uninit();
 
   let tabmail = document.getElementById("tabmail");
@@ -649,17 +649,17 @@ function OnUnloadMessenger()
 
   // FIX ME - later we will be able to use onload from the overlay
   OnUnloadMsgHeaderPane();
 
   UnloadPanes();
 
   OnMailWindowUnload();
   try {
-    mailInstrumentationManager.uninit();
+    MailInstrumentation.uninit();
   } catch (ex) {logException(ex);}
 }
 
 /**
  * Called by the session store manager periodically and at shutdown to get
  * the state of this window for persistence.
  */
 function getWindowStateForSessionPersistence()
@@ -676,26 +676,26 @@ function getWindowStateForSessionPersist
  * @param aDontRestoreFirstTab If this is true, the first tab will not be
  *                             restored, and will continue to retain focus at
  *                             the end. This is needed if the window was opened
  *                             with a folder or a message as an argument.
  *
  * @return true if the restoration was successful, false otherwise.
  */
 async function atStartupRestoreTabs(aDontRestoreFirstTab) {
-  let state = await sessionStoreManager.loadingWindow(window);
+  let state = await SessionStoreManager.loadingWindow(window);
   if (state) {
     let tabsState = state.tabs;
     let tabmail = document.getElementById("tabmail");
     tabmail.restoreTabs(tabsState, aDontRestoreFirstTab);
   }
 
   // it's now safe to load extra Tabs.
   setTimeout(loadExtraTabs, 0);
-  sessionStoreManager._restored = true;
+  SessionStoreManager._restored = true;
   Services.obs.notifyObservers(window, "mail-tabs-session-restored");
   return state ? true : false;
 }
 
 /**
  * Loads and restores tabs upon opening a window by evaluating window.arguments[1].
  *
  * The type of the object is specified by it's action property. It can be
--- a/mail/base/content/multimessageview.js
+++ b/mail/base/content/multimessageview.js
@@ -1,17 +1,17 @@
 /* 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/. */
 
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 ChromeUtils.import("resource:///modules/gloda/gloda.js");
 ChromeUtils.import("resource:///modules/gloda/connotent.js");
 ChromeUtils.import("resource:///modules/gloda/mimemsg.js");
-ChromeUtils.import("resource:///modules/displayNameUtils.js");
+ChromeUtils.import("resource:///modules/DisplayNameUtils.jsm");
 ChromeUtils.import("resource:///modules/MailServices.jsm");
 ChromeUtils.import("resource:///modules/templateUtils.js");
 
 var gMessenger = Cc["@mozilla.org/messenger;1"]
                    .createInstance(Ci.nsIMessenger);
 
 // Set up our string formatter for localizing strings.
 XPCOMUtils.defineLazyGetter(this, "formatString", function() {
@@ -227,17 +227,17 @@ MultiMessageSummary.prototype = {
                       '<div class="item_header"/>' +
                       '<div class="snippet"/>' +
                     '</div>';
 
     let itemHeaderNode = row.querySelector(".item_header");
 
     let authorNode = document.createElement("span");
     authorNode.classList.add("author");
-    authorNode.textContent = FormatDisplayNameList(
+    authorNode.textContent = DisplayNameUtils.formatDisplayNameList(
       message.mime2DecodedAuthor, "from"
     );
 
     if (aOptions && aOptions.showSubject) {
       authorNode.classList.add("right");
       itemHeaderNode.appendChild(authorNode);
 
       let subjectNode = document.createElement("span");
--- a/mail/base/content/nsContextMenu.js
+++ b/mail/base/content/nsContextMenu.js
@@ -3,17 +3,17 @@
  * 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/. */
 
 ChromeUtils.import("resource://gre/modules/InlineSpellChecker.jsm");
 ChromeUtils.import("resource://gre/modules/PlacesUtils.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-ChromeUtils.import("resource:///modules/MailUtils.js");
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "PageMenuParent", function() {
   let tmp = {};
   ChromeUtils.import("resource://gre/modules/PageMenu.jsm", tmp);
   return new tmp.PageMenuParent();
 });
 
 var gSpellChecker = new InlineSpellChecker();
--- a/mail/base/content/quickFilterBar.js
+++ b/mail/base/content/quickFilterBar.js
@@ -1,16 +1,16 @@
 /* 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/. */
 
 ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
 ChromeUtils.import("resource:///modules/errUtils.js");
-ChromeUtils.import("resource:///modules/quickFilterManager.js");
-ChromeUtils.import("resource:///modules/searchSpec.js");
+ChromeUtils.import("resource:///modules/QuickFilterManager.jsm");
+ChromeUtils.import("resource:///modules/SearchSpec.jsm");
 
 ////////////////////////////////////////////////////////////////////////////////
 //// Proper Code
 
 /**
  * There is only one message filter bar widget; the muxer deals with tab
  *  changes and directing modifications to and reflecting the state of the
  *  actual filterer objects.
rename from mail/base/modules/attachmentChecker.js
rename to mail/base/modules/AttachmentChecker.jsm
--- a/mail/base/modules/attachmentChecker.js
+++ b/mail/base/modules/AttachmentChecker.jsm
@@ -1,13 +1,17 @@
 /* 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/. */
 
-this.EXPORTED_SYMBOLS = ["GetAttachmentKeywords"];
+this.EXPORTED_SYMBOLS = ["AttachmentChecker"];
+
+var AttachmentChecker = {
+  getAttachmentKeywords,
+};
 
 /**
  * Check whether the character is a CJK character or not.
  *
  * @return true if it is a CJK character.
  */
 function IsCJK(code)
 {
@@ -26,17 +30,17 @@ function IsCJK(code)
   return false;
 }
 
 /**
  * Get the (possibly-empty) list of attachment keywords in this message.
  *
  * @return the (possibly-empty) list of attachment keywords in this message
  **/
-function GetAttachmentKeywords(mailData,keywordsInCsv)
+function getAttachmentKeywords(mailData,keywordsInCsv)
 {
   // The empty string would get split to an array of size 1.  Avoid that...
   var keywordsArray = (keywordsInCsv) ? keywordsInCsv.split(",") : [];
 
   function escapeRegxpSpecials(inputString)
   {
     const specials = [".", "\\", "^", "$", "*", "+", "?", "|",
                       "(", ")" , "[", "]", "{", "}"];
@@ -86,14 +90,13 @@ function GetAttachmentKeywords(mailData,
           break;
         }
       }
     }
   }
   return keywordsFound;
 }
 
-var onmessage = function(event)
-{
-  var keywordsFound = GetAttachmentKeywords(event.data[0], event.data[1]);
+var onmessage = function(event) {
+  var keywordsFound = AttachmentChecker.getAttachmentKeywords(event.data[0], event.data[1]);
   postMessage(keywordsFound);
 };
 
rename from mail/base/modules/dbViewWrapper.js
rename to mail/base/modules/DBViewWrapper.jsm
--- a/mail/base/modules/dbViewWrapper.js
+++ b/mail/base/modules/DBViewWrapper.jsm
@@ -1,17 +1,17 @@
 /* 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/. */
 
 this.EXPORTED_SYMBOLS = ['DBViewWrapper', 'IDBViewWrapperListener'];
 
 ChromeUtils.import("resource:///modules/MailServices.jsm");
-ChromeUtils.import("resource:///modules/mailViewManager.js");
-ChromeUtils.import("resource:///modules/searchSpec.js");
+ChromeUtils.import("resource:///modules/MailViewManager.jsm");
+ChromeUtils.import("resource:///modules/SearchSpec.jsm");
 ChromeUtils.import("resource:///modules/virtualFolderWrapper.js");
 
 var nsMsgFolderFlags = Ci.nsMsgFolderFlags;
 var nsMsgViewType = Ci.nsMsgViewType;
 var nsMsgViewFlagsType = Ci.nsMsgViewFlagsType;
 var nsMsgViewSortType = Ci.nsMsgViewSortType;
 var nsMsgViewSortOrder = Ci.nsMsgViewSortOrder;
 var nsMsgMessageFlags = Ci.nsMsgMessageFlags;
rename from mail/base/modules/displayNameUtils.js
rename to mail/base/modules/DisplayNameUtils.jsm
--- a/mail/base/modules/displayNameUtils.js
+++ b/mail/base/modules/DisplayNameUtils.jsm
@@ -1,35 +1,39 @@
 /* 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/. */
 
 ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
 ChromeUtils.import("resource:///modules/MailServices.jsm");
 ChromeUtils.import("resource:///modules/StringBundle.js");
 
-var EXPORTED_SYMBOLS = [
-  "GetCardForEmail", "FormatDisplayName", "FormatDisplayNameList",
-];
+var EXPORTED_SYMBOLS = ["DisplayNameUtils"];
+
+var DisplayNameUtils = {
+  formatDisplayName,
+  formatDisplayNameList,
+  getCardForEmail,
+};
 
 // XXX: Maybe the strings for this file should go in a separate bundle?
 var gMessengerBundle = new StringBundle(
   "chrome://messenger/locale/messenger.properties"
 );
 
 /**
  * Returns an object with two properties, .book and .card. If the email address
  * is found in the address books, then the book will contain an nsIAbDirectory,
  * and card will contain an nsIAbCard. If the email address is not found, both
  * items will contain null.
  *
  * @param aEmailAddress The address to look for.
  * @return An object with two properties, .book and .card.
  */
-function GetCardForEmail(aEmailAddress) {
+function getCardForEmail(aEmailAddress) {
   // Email address is searched for in any of the address books that support
   // the cardForEmailAddress function.
   // Future expansion could be to domain matches
   let books = MailServices.ab.directories;
   for (let book of fixIterator(books, Ci.nsIAbDirectory)) {
     try {
       let card = book.cardForEmailAddress(aEmailAddress);
       if (card)
@@ -62,21 +66,21 @@ function _getIdentityForAddress(aEmailAd
  * @param aEmailAddress      The email address to format.
  * @param aHeaderDisplayName The display name from the header, if any
  *                           (unused, maintained for add-ons, previously used
  *                           as a fallback).
  * @param aContext           The field being formatted (e.g. "to", "from").
  * @param aCard              The address book card, if any.
  * @return The formatted display name, or null.
  */
-function FormatDisplayName(aEmailAddress, aHeaderDisplayName, aContext, aCard)
+function formatDisplayName(aEmailAddress, aHeaderDisplayName, aContext, aCard)
 {
   var displayName = null;
   var identity = _getIdentityForAddress(aEmailAddress);
-  var card = aCard || GetCardForEmail(aEmailAddress).card;
+  var card = aCard || getCardForEmail(aEmailAddress).card;
 
   // If this address is one of the user's identities...
   if (identity) {
     // ...pick a localized version of the word "Me" appropriate to this
     // specific header; fall back to the version used by the "to" header
     // if nothing else is available.
     try {
       displayName = gMessengerBundle.getString("header" + aContext + "FieldMe");
@@ -103,27 +107,27 @@ function FormatDisplayName(aEmailAddress
     // caused by a collected address using an e-mail address as display name.
   }
 
   return displayName;
 }
 
 /**
  * Format the display name from a list of addresses. First, try using
- * FormatDisplayName, then fall back to the header's display name or the
+ * formatDisplayName, then fall back to the header's display name or the
  * address.
  *
  * @param aHeaderValue  The decoded header value (e.g. mime2DecodedAuthor).
  * @param aContext      The context of the header field (e.g. "to", "from").
  * @return The formatted display name.
  */
-function FormatDisplayNameList(aHeaderValue, aContext) {
+function formatDisplayNameList(aHeaderValue, aContext) {
   let addresses = MailServices.headerParser.parseDecodedHeader(aHeaderValue);
   if (addresses.length > 0) {
-    let displayName = FormatDisplayName(addresses[0].email,
+    let displayName = formatDisplayName(addresses[0].email,
                                         addresses[0].name, aContext);
     if (displayName)
       return displayName;
 
     // Construct default display.
     if (addresses[0].email) {
       return MailServices.headerParser
                          .makeMailboxObject(addresses[0].name,
rename from mail/base/modules/MailConsts.js
rename to mail/base/modules/MailConsts.jsm
rename from mail/base/modules/mailInstrumentation.js
rename to mail/base/modules/MailInstrumentation.jsm
--- a/mail/base/modules/mailInstrumentation.js
+++ b/mail/base/modules/MailInstrumentation.jsm
@@ -3,29 +3,29 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /**
  * Thunderbird UI Instrumentation, currently just the account setup process.
  */
 
 /* :::::::: Constants and Helpers ::::::::::::::: */
 
-this.EXPORTED_SYMBOLS = ["mailInstrumentationManager"];
+this.EXPORTED_SYMBOLS = ["MailInstrumentation"];
 
 var nsIMFNService = Ci.nsIMsgFolderNotificationService;
 
 ChromeUtils.import("resource:///modules/errUtils.js");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource:///modules/MailServices.jsm");
 
 Cu.importGlobalProperties(["XMLHttpRequest"]);
 
 /* :::::::: The Module ::::::::::::::: */
 
-var mailInstrumentationManager =
+var MailInstrumentation =
 {
   // JS object containing the current state object
   _currentState: null,
 
   /**
    * The string containing the JSON stringified representation of the last
    * state we uploaded.
    */
@@ -34,46 +34,46 @@ var mailInstrumentationManager =
   // if true, need to remove ourselves as a folder notification listener
   _mfnListener: false,
 
   // if true, we need to remove our observers in uninit.
   _observersRegistered: false,
 
   observe: function (aSubject, aTopic, aState) {
     if (aTopic == "mail:composeSendSucceeded")
-      mailInstrumentationManager.addEvent("msgSent", true);
+      MailInstrumentation.addEvent("msgSent", true);
     else if (aTopic == "mail:setAsDefault")
-      mailInstrumentationManager.addEvent("setAsDefault", true);
+      MailInstrumentation.addEvent("setAsDefault", true);
 
   },
   msgAdded: function (aMsg) {
     MailServices.mfn.removeListener(this);
     this._mfnListener = false;
-    mailInstrumentationManager.addEvent("msgDownloaded", true);
+    MailInstrumentation.addEvent("msgDownloaded", true);
   },
 
   _accountsChanged: function() {
     // check if there are at least two accounts - one is local folders account
     if (Services.prefs.getCharPref("mail.accountmanager.accounts").includes(',', 1)) {
-      mailInstrumentationManager.addEvent("accountAdded", true);
-      mailInstrumentationManager._removeObserver(
+      MailInstrumentation.addEvent("accountAdded", true);
+      MailInstrumentation._removeObserver(
         "mail.accountmanager.accounts",
-        mailInstrumentationManager._accountsChanged);
+        MailInstrumentation._accountsChanged);
 
     }
   },
   _smtpServerAdded: function() {
-    mailInstrumentationManager.addEvent("smtpServerAdded", true);
-    mailInstrumentationManager._removeObserver("mail.smtpservers",
-      mailInstrumentationManager._smtpServerAdded);
+    MailInstrumentation.addEvent("smtpServerAdded", true);
+    MailInstrumentation._removeObserver("mail.smtpservers",
+      MailInstrumentation._smtpServerAdded);
   },
   _userOptedIn: function() {
     try {
       if (Services.prefs.getBoolPref("mail.instrumentation.userOptedIn"))
-        mailInstrumentationManager._postStateObject();
+        MailInstrumentation._postStateObject();
     } catch (ex) {logException(ex);}
   },
 
   /**
    * Loads the last saved state. This should only be called by
    * _init and a unit test.
    */
   _loadState: function minst_loadState() {
rename from mail/base/modules/mailMigrator.js
rename to mail/base/modules/MailMigrator.jsm
--- a/mail/base/modules/MailUtils.js
+++ b/mail/base/modules/MailUtils.js
@@ -1,386 +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/. */
 
 var EXPORTED_SYMBOLS = ["MailUtils"];
 
-ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
-ChromeUtils.import("resource:///modules/MailConsts.js");
-ChromeUtils.import("resource:///modules/MailServices.jsm");
-ChromeUtils.import("resource://gre/modules/Services.jsm");
-ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
-
-var MC = MailConsts;
-
-/**
- * This module has several utility functions for use by both core and
- * third-party code. Some functions are aimed at code that doesn't have a
- * window context, while others can be used anywhere.
- */
-var MailUtils =
-{
-  /**
-   * Discover all folders. This is useful during startup, when you have code
-   * that deals with folders and that executes before the main 3pane window is
-   * open (the folder tree wouldn't have been initialized yet).
-   */
-  discoverFolders: function MailUtils_discoverFolders() {
-    let servers = MailServices.accounts.allServers;
-    for (let server of fixIterator(servers, Ci.nsIMsgIncomingServer)) {
-      // Bug 466311 Sometimes this can throw file not found, we're unsure
-      // why, but catch it and log the fact.
-      try {
-        server.rootFolder.subFolders;
-      }
-      catch (ex) {
-        Services.console.logStringMessage("Discovering folders for account failed with " +
-                                          "exception: " + ex);
-      }
-    }
-  },
-
-  /**
-   * Get the nsIMsgFolder corresponding to this file. This just looks at all
-   * folders and does a direct match.
-   *
-   * One of the places this is used is desktop search integration -- to open
-   * the search result corresponding to a mozeml/wdseml file, we need to figure
-   * out the folder using the file's path.
-   *
-   * @param aFile the nsIFile to convert to a folder
-   * @returns the nsIMsgFolder corresponding to aFile, or null if the folder
-   *          isn't found
-   */
-  getFolderForFileInProfile:
-      function MailUtils_getFolderForFileInProfile(aFile) {
-    let folders = MailServices.accounts.allFolders;
-
-    for (let folder of fixIterator(folders, Ci.nsIMsgFolder)) {
-      if (folder.filePath.equals(aFile))
-        return folder;
-    }
-    return null;
-  },
-
-  /**
-   * Get the nsIMsgFolder corresponding to this URI. This uses the RDF service
-   * to do the work.
-   *
-   * @param aFolderURI the URI to convert into a folder
-   * @param aCheckFolderAttributes whether to check that the folder either has
-   *                              a parent or isn't a server
-   * @returns the nsIMsgFolder corresponding to this URI, or null if
-   *          aCheckFolderAttributes is true and the folder doesn't have a
-   *          parent or is a server
-   */
-  getFolderForURI: function MailUtils_getFolderForURI(aFolderURI,
-                       aCheckFolderAttributes) {
-    let folder = null;
-    let rdfService = Cc['@mozilla.org/rdf/rdf-service;1']
-                       .getService(Ci.nsIRDFService);
-    folder = rdfService.GetResource(aFolderURI);
-    // This is going to QI the folder to an nsIMsgFolder as well
-    if (folder && folder instanceof Ci.nsIMsgFolder) {
-      if (aCheckFolderAttributes && !(folder.parent || folder.isServer))
-        return null;
-    }
-    else {
-      return null;
-    }
-
-    return folder;
-  },
-
-  /**
-   * Display this message header in a new tab, a new window or an existing
-   * window, depending on the preference and whether a 3pane or standalone
-   * window is already open. This function should be called when you'd like to
-   * display a message to the user according to the pref set.
-   *
-   * @note Do not use this if you want to open multiple messages at once. Use
-   *       |displayMessages| instead.
-   *
-   * @param aMsgHdr the message header to display
-   * @param [aViewWrapperToClone] a view wrapper to clone. If null or not
-   *                              given, the message header's folder's default
-   *                              view will be used
-   * @param [aTabmail] a tabmail element to use in case we need to open tabs.
-   *                   If null or not given:
-   *                   - if one or more 3pane windows are open, the most recent
-   *                     one's tabmail is used
-   *                   - if no 3pane windows are open, a standalone window is
-   *                     opened instead of a tab
-   */
-  displayMessage: function MailUtils_displayMessage(aMsgHdr,
-                      aViewWrapperToClone, aTabmail) {
-    this.displayMessages([aMsgHdr], aViewWrapperToClone, aTabmail);
-  },
-
-  /**
-   * Display the warning if the number of messages to be displayed is greater than
-   * the limit set in preferences.
-   * @param aNumMessages: number of messages to be displayed
-   * @param aConfirmTitle: title ID
-   * @param aConfirmMsg: message ID
-   * @param aLiitingPref: the name of the pref to retrieve the limit from
-   */
-  confirmAction: function (aNumMessages, aConfirmTitle, aConfirmMsg, aLimitingPref) {
-    let openWarning = Services.prefs.getIntPref(aLimitingPref);
-    if ((openWarning > 1) && (aNumMessages >= openWarning)) {
-      let bundle = Services.strings.createBundle(
-        "chrome://messenger/locale/messenger.properties");
-      let title = bundle.GetStringFromName(aConfirmTitle);
-      let message = PluralForm.get(aNumMessages,
-        bundle.GetStringFromName(aConfirmMsg))
-                .replace("#1", aNumMessages);
-      if (!Services.prompt.confirm(null, title, message))
-        return true;
-    }
-    return false;
-  },
-  /**
-   * Display these message headers in new tabs, new windows or existing
-   * windows, depending on the preference, the number of messages, and whether
-   * a 3pane or standalone window is already open. This function should be
-   * called when you'd like to display multiple messages to the user according
-   * to the pref set.
-   *
-   * @param aMsgHdrs an array containing the message headers to display. The
-   *                 array should contain at least one message header
-   * @param [aViewWrapperToClone] a DB view wrapper to clone for each of the
-   *                              tabs or windows
-   * @param [aTabmail] a tabmail element to use in case we need to open tabs.
-   *                   If given, the window containing the tabmail is assumed
-   *                   to be in front. If null or not given:
-   *                   - if one or more 3pane windows are open, the most recent
-   *                     one's tabmail is used, and the window is brought to the
-   *                     front
-   *                   - if no 3pane windows are open, standalone windows are
-   *                     opened instead of tabs
-   */
-  displayMessages: function MailUtils_displayMessages(aMsgHdrs,
-                       aViewWrapperToClone, aTabmail) {
-    let openMessageBehavior = Services.prefs.getIntPref(
-                                  "mail.openMessageBehavior");
-
-    if (openMessageBehavior == MC.OpenMessageBehavior.NEW_WINDOW) {
-      this.openMessagesInNewWindows(aMsgHdrs, aViewWrapperToClone);
-    }
-    else if (openMessageBehavior == MC.OpenMessageBehavior.EXISTING_WINDOW) {
-      // Try reusing an existing window. If we can't, fall back to opening new
-      // windows
-      if (aMsgHdrs.length > 1 || !this.openMessageInExistingWindow(aMsgHdrs[0]))
-        this.openMessagesInNewWindows(aMsgHdrs, aViewWrapperToClone);
-    }
-    else if (openMessageBehavior == MC.OpenMessageBehavior.NEW_TAB) {
-      let mail3PaneWindow = null;
-      if (!aTabmail) {
-        // Try opening new tabs in a 3pane window
-        mail3PaneWindow = Services.wm.getMostRecentWindow("mail:3pane");
-        if (mail3PaneWindow)
-          aTabmail = mail3PaneWindow.document.getElementById("tabmail");
-      }
-
-      if (aTabmail) {
-        if (this.confirmAction(aMsgHdrs.length, "openTabWarningTitle",
-                               "openTabWarningConfirmation",
-                               "mailnews.open_tab_warning"))
-          return;
-        for (let [i, msgHdr] of aMsgHdrs.entries())
-          // Open all the tabs in the background, except for the last one
-          aTabmail.openTab("message", {msgHdr: msgHdr,
-              viewWrapperToClone: aViewWrapperToClone,
-              background: (i < (aMsgHdrs.length - 1)),
-              disregardOpener: (aMsgHdrs.length > 1),
-          });
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 
-        if (mail3PaneWindow)
-          mail3PaneWindow.focus();
-      }
-      else {
-        // We still haven't found a tabmail, so we'll need to open new windows
-        this.openMessagesInNewWindows(aMsgHdrs, aViewWrapperToClone);
-      }
-    }
-  },
-
-  /**
-   * Show this message in an existing window.
-   *
-   * @param aMsgHdr the message header to display
-   * @param [aViewWrapperToClone] a DB view wrapper to clone for the message
-   *                              window
-   * @returns true if an existing window was found and the message header was
-   *          displayed, false otherwise
-   */
-  openMessageInExistingWindow:
-      function MailUtils_openMessageInExistingWindow(aMsgHdr,
-                                                     aViewWrapperToClone) {
-    let messageWindow = Services.wm.getMostRecentWindow("mail:messageWindow");
-    if (messageWindow) {
-      messageWindow.displayMessage(aMsgHdr, aViewWrapperToClone);
-      return true;
-    }
-    return false;
-  },
-
-  /**
-   * Open a new standalone message window with this header.
-   *
-   * @param aMsgHdr the message header to display
-   * @param [aViewWrapperToClone] a DB view wrapper to clone for the message
-   *                              window
-   */
-  openMessageInNewWindow:
-      function MailUtils_openMessageInNewWindow(aMsgHdr, aViewWrapperToClone) {
-    // It sucks that we have to go through XPCOM for this
-    let args = {msgHdr: aMsgHdr, viewWrapperToClone: aViewWrapperToClone};
-    args.wrappedJSObject = args;
-
-    Services.ww.openWindow(null,
-        "chrome://messenger/content/messageWindow.xul", "",
-        "all,chrome,dialog=no,status,toolbar", args);
-  },
-
-  /**
-   * Open new standalone message windows for these headers. This will prompt
-   * for confirmation if the number of windows to be opened is greater than the
-   * value of the mailnews.open_window_warning preference.
-   *
-   * @param aMsgHdrs an array containing the message headers to display
-   * @param [aViewWrapperToClone] a DB view wrapper to clone for each message
-   *                              window
-   */
-   openMessagesInNewWindows:
-       function MailUtils_openMessagesInNewWindows(aMsgHdrs,
-                                                   aViewWrapperToClone) {
-    if (this.confirmAction(aMsgHdrs.length, "openWindowWarningTitle",
-                           "openWindowWarningConfirmation",
-                           "mailnews.open_window_warning"))
-      return;
-
-    for (let msgHdr of aMsgHdrs)
-      this.openMessageInNewWindow(msgHdr, aViewWrapperToClone);
-  },
-
-  /**
-   * Display this message header in a folder tab in a 3pane window. This is
-   * useful when the message needs to be displayed in the context of its folder
-   * or thread.
-   *
-   * @param aMsgHdr the message header to display
-   */
-  displayMessageInFolderTab: function MailUtils_displayMessageInFolderTab(
-                                 aMsgHdr) {
-    // Try opening new tabs in a 3pane window
-    let mail3PaneWindow = Services.wm.getMostRecentWindow("mail:3pane");
-    if (mail3PaneWindow) {
-      mail3PaneWindow.MsgDisplayMessageInFolderTab(aMsgHdr);
-    }
-    else {
-      let args = {msgHdr: aMsgHdr};
-      args.wrappedJSObject = args;
-      Services.ww.openWindow(null,
-          "chrome://messenger/content/", "",
-          "all,chrome,dialog=no,status,toolbar", args);
-    }
-  },
-
-  /**
-   * The number of milliseconds to wait between loading of folders in
-   * |setStringPropertyOnFolderAndDescendents|.  We wait at all because
-   * opening msf databases is a potentially expensive synchronous operation that
-   * can approach the order of a second in pathological cases like gmail's
-   * all mail folder.
-   *
-   * If we did not use a timer or otherwise spin the event loop we would
-   * completely lock up the UI.  In theory we would still maintain some degree
-   * of UI responsiveness if we just used postMessage to break up our work so
-   * that the event loop still got a chance to run between our folder openings.
-   * The use of any delay between processing folders is to try and avoid causing
-   * system-wide interactivity problems from dominating the system's available
-   * disk seeks to such an extent that other applications start experiencing
-   * non-trivial I/O waits.
-   *
-   * The specific choice of delay remains an arbitrary one to maintain app
-   * and system responsiveness per the above while also processing as many
-   * folders as quickly as possible.
-   *
-   * This is exposed primarily to allow unit tests to set this to 0 to minimize
-   * throttling.
-   */
-  INTER_FOLDER_PROCESSING_DELAY_MS: 10,
-
-  /**
-   * Set a string property on a folder and all of its descendents, taking care
-   * to avoid locking up the main thread and to avoid leaving folder databases
-   * open.  To avoid locking up the main thread we operate in an asynchronous
-   * fashion; we invoke a callback when we have completed our work.
-   *
-   * Using this function will write the value into the folder cache
-   * (panacea.dat) as well as the folder itself.  Hopefully you want this; if
-   * you do not, keep in mind that the only way to avoid that is to retrieve
-   * the nsIMsgDatabase and then the nsIDbFolderInfo.  You would want to avoid
-   * that as much as possible because once those are exposed to you, XPConnect
-   * is going to hold onto them creating a situation where you are going to be
-   * in severe danger of extreme memory bloat unless you force garbage
-   * collections after every time you close a database.
-   *
-   * @param aPropertyName The name of the property to set.
-   * @param aPropertyValue The (string) value of the property to set.
-   *     Alternately, you can pass a function that takes the nsIMsgFolder and
-   *     returns a string value.
-   * @param aFolder The parent folder; we set the string property on it and all
-   *     of its descendents.
-   * @param [aCallback] The optional callback to invoke once we finish our work.
-   *     The callback is provided a boolean success value; true means we
-   *     managed to set the values on all folders, false means we encountered a
-   *     problem.
-   */
-  setStringPropertyOnFolderAndDescendents:
-      function MailUtils_setStringPropertyOnFolderAndDescendents(aPropertyName,
-                                                                 aPropertyValue,
-                                                                 aFolder,
-                                                                 aCallback) {
-    // We need to add the base folder as it does not get added by ListDescendants.
-    let allFolders = toXPCOMArray([aFolder], Ci.nsIMutableArray);
-    // - get all the descendants
-    aFolder.ListDescendants(allFolders);
-
-    // - worker function
-    function* folder_string_setter_worker() {
-      for (let folder of fixIterator(allFolders, Ci.nsIMsgFolder)) {
-        // set the property; this may open the database...
-        let value = (typeof aPropertyValue == "function" ?
-                     aPropertyValue(folder) : aPropertyValue);
-        folder.setStringProperty(aPropertyName, value);
-        // force the reference to be forgotten.
-        folder.msgDatabase = null;
-        yield undefined;
-      }
-    }
-    let worker = folder_string_setter_worker();
-
-    // - driver logic
-    let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
-    function folder_string_setter_driver() {
-      try {
-        if (worker.next().done) {
-          timer.cancel();
-          if (aCallback)
-            aCallback(true);
-        }
-      }
-      catch (ex) {
-        // Any type of exception kills the generator.
-        timer.cancel();
-        if (aCallback)
-          aCallback(false);
-      }
-    }
-    // make sure there is at least 100 ms of not us between doing things.
-    timer.initWithCallback(folder_string_setter_driver,
-                           this.INTER_FOLDER_PROCESSING_DELAY_MS,
-                           Ci.nsITimer.TYPE_REPEATING_SLACK);
-  },
-};
+ChromeUtils.import("resource://gre/modules/Deprecated.jsm");
+Deprecated.warning(
+    "MailUtils.js has been renamed MailUtils.jsm",
+    "https://bugzilla.mozilla.org/show_bug.cgi?id=1498041",
+    Components.stack.caller
+);
copy from mail/base/modules/MailUtils.js
copy to mail/base/modules/MailUtils.jsm
--- a/mail/base/modules/MailUtils.js
+++ b/mail/base/modules/MailUtils.jsm
@@ -1,16 +1,16 @@
 /* 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/. */
 
 var EXPORTED_SYMBOLS = ["MailUtils"];
 
 ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
-ChromeUtils.import("resource:///modules/MailConsts.js");
+ChromeUtils.import("resource:///modules/MailConsts.jsm");
 ChromeUtils.import("resource:///modules/MailServices.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
 
 var MC = MailConsts;
 
 /**
  * This module has several utility functions for use by both core and
rename from mail/base/modules/mailViewManager.js
rename to mail/base/modules/MailViewManager.jsm
rename from mail/base/modules/MsgHdrSyntheticView.js
rename to mail/base/modules/MsgHdrSyntheticView.jsm
rename from mail/base/modules/quickFilterManager.js
rename to mail/base/modules/QuickFilterManager.jsm
--- a/mail/base/modules/quickFilterManager.js
+++ b/mail/base/modules/QuickFilterManager.jsm
@@ -7,17 +7,17 @@ this.EXPORTED_SYMBOLS = ["QuickFilterSta
 
 ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
 
 ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
 ChromeUtils.import("resource:///modules/errUtils.js");
 ChromeUtils.import("resource:///modules/MailServices.jsm");
-ChromeUtils.import("resource:///modules/searchSpec.js");
+ChromeUtils.import("resource:///modules/SearchSpec.jsm");
 
 var nsMsgSearchAttrib = Ci.nsMsgSearchAttrib;
 var nsMsgMessageFlags = Ci.nsMsgMessageFlags;
 var nsMsgSearchOp = Ci.nsMsgSearchOp;
 
 // XXX we need to know whether the gloda indexer is enabled for upsell reasons,
 // but this should really just be exposed on the main Gloda public interface.
 ChromeUtils.import("resource:///modules/gloda/indexer.js");
rename from mail/base/modules/searchSpec.js
rename to mail/base/modules/SearchSpec.jsm
rename from mail/base/modules/sessionStoreManager.js
rename to mail/base/modules/SessionStoreManager.jsm
--- a/mail/base/modules/sessionStoreManager.js
+++ b/mail/base/modules/SessionStoreManager.jsm
@@ -3,31 +3,31 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /**
  * Session Storage and Restoration
  */
 
 /* :::::::: Constants and Helpers ::::::::::::::: */
 
-this.EXPORTED_SYMBOLS = ["sessionStoreManager"];
+this.EXPORTED_SYMBOLS = ["SessionStoreManager"];
 
 ChromeUtils.import("resource://gre/modules/JSONFile.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 /**
  * asuth arbitrarily chose this value to trade-off powersaving,
  * processor usage, and recency of state in the face of the impossibility of
  * our crashing; he also worded this.
  */
 var SESSION_AUTO_SAVE_DEFAULT_MS = 300000; // 5 minutes
 
 /* :::::::: The Module ::::::::::::::: */
 
-var sessionStoreManager =
+var SessionStoreManager =
 {
   _initialized: false,
 
   /**
    * Session restored successfully on startup; use this to test for an early
    * failed startup which does not restore user tab state to ensure a session
    * save on close will not overwrite the last good session state.
    */
@@ -128,17 +128,17 @@ var sessionStoreManager =
   },
 
   /**
    * Writes the state object to disk.
    */
   _saveStateObject: function ssm_saveStateObject(aStateObj)
   {
     if (!this.store) {
-      Cu.reportError("sessionStoreManager: could not create data store from file");
+      Cu.reportError("SessionStoreManager: could not create data store from file");
       return;
     }
 
     let currentStateString = JSON.stringify(aStateObj);
     let storedStateString = this.store.dataReady && this.store.data ?
                               JSON.stringify(this.store.data) : null;
 
     // Do not save state (overwrite last good state) in case of a failed startup.
@@ -180,17 +180,17 @@ var sessionStoreManager =
 
     this._saveStateObject(state);
   },
 
 /* ........ Timer Callback ................*/
 
   _sessionAutoSaveTimerCallback: function ssm_sessionAutoSaveTimerCallback()
   {
-    sessionStoreManager._saveState();
+    SessionStoreManager._saveState();
   },
 
 /* ........ Observer Notification Handler ................*/
 
   observe: function ssm_observe(aSubject, aTopic, aData) {
     switch (aTopic) {
     // This is observed before any windows start unloading if something other
     // than the last 3pane window closing requested the application be
rename from mail/base/modules/summaryFrameManager.js
rename to mail/base/modules/SummaryFrameManager.jsm
rename from mail/base/modules/distribution.js
rename to mail/base/modules/TBDistCustomizer.jsm
--- a/mail/base/modules/moz.build
+++ b/mail/base/modules/moz.build
@@ -1,28 +1,28 @@
 # vim: set filetype=python:
 # 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/.
 
 EXTRA_JS_MODULES += [
-    'attachmentChecker.js',
-    'dbViewWrapper.js',
-    'displayNameUtils.js',
-    'distribution.js',
-    'MailConsts.js',
-    'mailInstrumentation.js',
-    'mailMigrator.js',
+    'AttachmentChecker.jsm',
+    'DBViewWrapper.jsm',
+    'DisplayNameUtils.jsm',
+    'MailConsts.jsm',
+    'MailInstrumentation.jsm',
+    'MailMigrator.jsm',
     'MailUtils.js',
-    'mailViewManager.js',
-    'MsgHdrSyntheticView.js',
-    'oauth.jsm',
-    'quickFilterManager.js',
-    'searchSpec.js',
-    'sessionStoreManager.js',
-    'summaryFrameManager.js',
+    'MailUtils.jsm',
+    'MailViewManager.jsm',
+    'MsgHdrSyntheticView.jsm',
+    'QuickFilterManager.jsm',
+    'SearchSpec.jsm',
+    'SessionStoreManager.jsm',
+    'SummaryFrameManager.jsm',
+    'TBDistCustomizer.jsm',
     'Windows8WindowFrameColor.jsm',
 ]
 
 FINAL_TARGET_FILES.modules += [
     'ThemeVariableMap.jsm'
 ]
 
deleted file mode 100644
--- a/mail/base/modules/oauth.jsm
+++ /dev/null
@@ -1,315 +0,0 @@
-/* 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/. */
-
-/**
- * This js module does OAuth 1.0 authentication. It was originally intended to
- * be shareable by various components that need Oauth, but some changes will
- * need to be made to support differences in OAuth usage.
- */
-
-var EXPORTED_SYMBOLS = ["OAuth"];
-
-ChromeUtils.import("resource://gre/modules/Http.jsm");
-ChromeUtils.import("resource://gre/modules/Services.jsm");
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-ChromeUtils.import("resource:///modules/gloda/log4moz.js");
-
-function OAuth(aDisplayName, aBaseUri, aAuthUri, aAuthToken, aAuthTokenSecret,
-               aAppKey, aAppSecret, aSignatureMethod,
-               aTempCredentialsMethod = "oauth/request_token",
-               aAuthorizeMethod = "oauth/authorize",
-               aRequestCredentialsMethod = "oauth/access_token")
-{
-  this._userInfo = {};
-  this.displayName = aDisplayName;
-  this.baseURI = aBaseUri;
-  this.authURI = aAuthUri;
-  this.token = aAuthToken;
-  this.tokenSecret = aAuthTokenSecret;
-  this.consumerKey = aAppKey;
-  this.consumerSecret = aAppSecret;
-  this.log = Log4Moz.getConfiguredLogger("TBOAuth");
-
-  this.signatureMethod = aSignatureMethod || "HMAC-SHA1";
-  this.tempCredentialsMethod = aTempCredentialsMethod;
-  this.authorizeMethod = aAuthorizeMethod;
-  this.requestCredentialsMethod = aRequestCredentialsMethod;
-}
-
-OAuth.prototype = {
-  consumerKey: "",
-  consumerSecret: "",
-  completionURI: "http://oauthcallback.local/",
-  baseURI: "",
-  token : "",
-  tokenSecret : "",
-  connectSuccessCallback : null,
-  connectFailureCallback : null,
-  /**
-   * Start the OAuth connection process, if not connected.
-   *
-   * @param aSuccess success callback, called synchronously if we are already
-                     connected, or the connection succeeds.
-   * @param aFailure failure callback.
-   */
-  connect: function(aSuccess, aFailure, aWithUI) {
-    if (this.connected || this.connecting)
-      return;
-
-    this._enabled = true;
-    // Get a new token if needed...
-    if (!this.token || !this.tokenSecret) {
-      if (!aWithUI) {
-        aFailure();
-        return;
-      }
-      this.connectSuccessCallback = aSuccess;
-      this.connectFailureCallback = aFailure;
-      this.log.info("don't think we have a token or token secret");
-      this.requestToken();
-      return;
-    }
-
-    this.log.info("Connecting using existing token");
-    aSuccess();
-  },
-  /**
-   * Sign a request and send it, using the oauth connection.
-   *
-   * @param aUrl Url to open
-   * @param aHeaders Additional headers to send
-   * @param aMethod "Get"/"Post"/"Put"
-   * @param aPOSTData Data to post
-   * @param aOnLoad Success callback
-   * @param aOnError Error callback
-   * @param aThis passed as first param to success and error callbacks
-   * @param aOAuthParams additional params to pass to request
-   */
-  signAndSend: function(aUrl, aHeaders, aMethod, aPOSTData, aOnLoad, aOnError, aThis,
-                        aOAuthParams) {
-    this.log.info("sign and send aUrl = " + aUrl);
-    const kChars =
-      "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
-    const kNonceLength = 6;
-    let nonce = "";
-    for (let i = 0; i < kNonceLength; ++i)
-      nonce += kChars[Math.floor(Math.random() * kChars.length)];
-
-    let params = (aOAuthParams || []).concat([
-      ["oauth_consumer_key", this.consumerKey],
-      ["oauth_nonce", nonce],
-      ["oauth_signature_method", this.signatureMethod],
-      ["oauth_timestamp", Math.floor(((new Date()).getTime()) / 1000)],
-      ["oauth_version", "1.0"]
-    ]);
-    if (this.token) {
-      params.push(["oauth_token", this.token]);
-    }
-
-    let dataParams = [];
-    let url = /^https?:/.test(aUrl) ? aUrl : this.baseURI + aUrl;
-    let urlSpec = url;
-    let queryIndex = url.indexOf("?");
-    if (queryIndex != -1) {
-      urlSpec = url.slice(0, queryIndex);
-      dataParams = url.slice(queryIndex + 1).split("&")
-                      .map(p => p.split("=").map(percentEncode));
-    }
-    this.log.info("in sign and send url = " + url + "\nurlSpec = " + urlSpec);
-    this.log.info("dataParams = " + dataParams);
-
-    let signature;
-    if (this.signatureMethod === "HMAC-SHA1") {
-      let signatureKey = this.consumerSecret + "&" + this.tokenSecret;
-      let signatureBase =
-        aMethod + "&" + encodeURIComponent(urlSpec) + "&" +
-        params.concat(dataParams)
-              .sort((a, b) => (a[0] < b[0]) ? -1 : (a[0] > b[0]) ? 1 : 0)
-              .map(p => p.map(percentEncode).join("%3D"))
-              .join("%26");
-
-      this.log.info("sig base = " + signatureBase);
-      let keyFactory = Cc["@mozilla.org/security/keyobjectfactory;1"]
-                       .getService(Ci.nsIKeyObjectFactory);
-      let hmac =
-        Cc["@mozilla.org/security/hmac;1"].createInstance(Ci.nsICryptoHMAC);
-      hmac.init(hmac.SHA1,
-                keyFactory.keyFromString(Ci.nsIKeyObject.HMAC, signatureKey));
-      // No UTF-8 encoding, special chars are already escaped.
-      let bytes = Array.from(signatureBase).map(b => b.charCodeAt(0));
-      hmac.update(bytes, bytes.length);
-      signature = encodeURIComponent(hmac.finish(true));
-    }
-    else if (this.signatureMethod == "PLAINTEXT") {
-      signature = percentEncode(percentEncode(this.consumerSecret) + "&" +
-                                percentEncode(this.tokenSecret));
-    }
-    else {
-      throw Cr.NS_ERROR_NOT_IMPLEMENTED;
-    }
-
-    params.push(["oauth_signature", signature]);
-
-    let authorization =
-      "OAuth " + params.map(p => p[0] + "=\"" + p[1] + "\"").join(", ");
-    let options = {
-      headers: (aHeaders || []).concat([["Authorization", authorization]]),
-      postData: aPOSTData,
-      method: aMethod,
-      onLoad: aOnLoad.bind(aThis),
-      onError: aOnError.bind(aThis)
-    };
-    return httpRequest(url, options);
-  },
-  _parseURLData: function(aData) {
-    let result = {};
-    aData.split("&").forEach(function (aParam) {
-      let [key, value] = aParam.split("=");
-      result[key] = value;
-    });
-    return result;
-  },
-
-  _streamingRequest: null,
-  _pendingData: "",
-  _receivedLength: 0,
-  onDataAvailable: function(aRequest) {
-    let text = aRequest.target.responseText;
-    let newText = this._pendingData + text.slice(this._receivedLength);
-    this.log.info("Received data: " + newText);
-    let messages = newText.split(/\r\n?/);
-  },
-
-  requestToken: function() {
-    let oauthParams =
-      [["oauth_callback", encodeURIComponent(this.completionURI)]];
-    this.signAndSend(this.tempCredentialsMethod,
-                     null, "POST", null,
-                     this.onRequestTokenReceived,
-                     this.connectFailureCallback, this,
-                     oauthParams);
-  },
-  onRequestTokenReceived: function(aData) {
-    this.log.info("Received request token.");
-    let data = this._parseURLData(aData);
-    if (!data.oauth_token ||
-        (this.signatureMethod == "HMAC-SHA1" && !data.oauth_token_secret)) {
-      this.log.info("didn't get request token");
-      this.connectFailureCallback();
-      return;
-    }
-    this.token = data.oauth_token;
-    this.tokenSecret = data.oauth_token_secret;
-
-    this.requestAuthorization();
-  },
-  requestAuthorization: function() {
-    this.log.info("requesting oauth");
-    const url = this.authURI + this.authorizeMethod + "?oauth_token=";
-    this._browserRequest =
-      { promptText : "auth prompt",
-        account: this,
-        url: url + this.token + "&oauth_callback=" + this.completionURI,
-        _active: true,
-        iconURI : "",  // would be nice to set this from the oauth user...
-        cancelled: function() {
-          if (!this._active)
-            return;
-          this.account.log.info("auth cancelled");
-          this.account.finishAuthorizationRequest();
-          this.account.onAuthorizationReceived(null);
-          this.account.connectFailureCallback();
-        // ### auth cancelled.
-        },
-        loaded: function(aWindow, aWebProgress) {
-          if (!this._active)
-            return;
-
-          this._listener = {
-            QueryInterface: ChromeUtils.generateQI([Ci.nsIWebProgressListener,
-                                                    Ci.nsISupportsWeakReference]),
-            _cleanUp: function() {
-              this.webProgress.removeProgressListener(this);
-              this.window.close();
-              delete this.window;
-            },
-            _checkForRedirect: function(aURL) {
-              if (!aURL.startsWith(this._parent.completionURI))
-                return;
-
-              this._parent.finishAuthorizationRequest();
-              this._parent.onAuthorizationReceived(aURL);
-            },
-            onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus) {
-              const wpl = Ci.nsIWebProgressListener;
-              if (aStateFlags & (wpl.STATE_START | wpl.STATE_IS_NETWORK))
-                this._checkForRedirect(aRequest.name);
-            },
-            onLocationChange: function(aWebProgress, aRequest, aLocation) {
-              this._checkForRedirect(aLocation.spec);
-            },
-            onProgressChange: function() {},
-            onStatusChange: function() {},
-            onSecurityChange: function() {},
-
-            window: aWindow,
-            webProgress: aWebProgress,
-            _parent: this.account
-          };
-        aWebProgress.addProgressListener(this._listener,
-                                         Ci.nsIWebProgress.NOTIFY_ALL);
-      },
-    };
-     this.wrappedJSObject = this._browserRequest;
-     Services.ww.openWindow(null,
-                            "chrome://messenger/content/browserRequest.xul",
-                             null, "chrome,centerscreen,width=980px,height=600px", this);
-  },
-  finishAuthorizationRequest: function() {
-    if (!("_browserRequest" in this))
-      return;
-
-    this._browserRequest._active = false;
-    if ("_listener" in this._browserRequest)
-      this._browserRequest._listener._cleanUp();
-    delete this._browserRequest;
-  },
-  onAuthorizationReceived: function(aData) {
-    this.log.info("authorization received");
-    let data = this._parseURLData(aData);
-
-    this.requestAccessToken([["oauth_verifier", data.oauth_verifier]]);
-  },
-  requestAccessToken: function(aVerifier) {
-    this.signAndSend(this.requestCredentialsMethod, null, "POST", null,
-                     this.onAccessTokenReceived, this.connectFailureCallback, this,
-                     aVerifier);
-  },
-  onAccessTokenReceived: function(aData) {
-    this.log.info("Received access token. urlData = " + aData);
-    let result = this._parseURLData(aData);
-
-    this.token = result.oauth_token;
-    this.tokenSecret = result.oauth_token_secret;
-    this.connectSuccessCallback(result);
-  },
-
-
-  cleanUp: function() {
-    this.finishAuthorizationRequest();
-    if (this._pendingRequests.length != 0) {
-      for (let request of this._pendingRequests)
-        request.abort();
-      delete this._pendingRequests;
-    }
-    if (this._streamingRequest) {
-      this._streamingRequest.abort();
-      delete this._streamingRequest;
-    }
-  },
-  unInit: function() {
-    this.cleanUp();
-  },
-};
-
--- a/mail/base/test/unit/resources/viewWrapperTestUtils.js
+++ b/mail/base/test/unit/resources/viewWrapperTestUtils.js
@@ -1,14 +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/. */
 
-ChromeUtils.import("resource:///modules/dbViewWrapper.js");
-ChromeUtils.import("resource:///modules/mailViewManager.js");
+ChromeUtils.import("resource:///modules/DBViewWrapper.jsm");
+ChromeUtils.import("resource:///modules/MailViewManager.jsm");
 ChromeUtils.import("resource:///modules/virtualFolderWrapper.js");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var gInbox;
 
 /**
  * Do initialization for xpcshell-tests; not used by
  *  test-folder-display-helpers.js, our friendly mozmill test helper.
--- a/mail/base/test/unit/test_attachmentChecker.js
+++ b/mail/base/test/unit/test_attachmentChecker.js
@@ -2,24 +2,24 @@
 /* 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/. */
 
 /*
  * Test suite for the attachmentChecker class
  *
  * Currently tested:
- * - GetAttachmentKeywords function.
+ * - getAttachmentKeywords function.
  */
 
 // make xpcshell-tests TEST_PATH=mail/base/test/unit/test_attachmentChecker.js
 
 // Globals
 
-ChromeUtils.import("resource:///modules/attachmentChecker.js");
+ChromeUtils.import("resource:///modules/AttachmentChecker.jsm");
 
 /*
  * UTILITIES
  */
 
 function assert(aBeTrue, aWhy)
 {
   if (!aBeTrue)
@@ -31,19 +31,19 @@ function assert_equal(aA, aB, aWhy)
   assert(aA == aB, aWhy + " (" + unescape(encodeURIComponent(aA)) + " != " +
                                  unescape(encodeURIComponent(aB)) + ").");
 };
 
 /*
  * TESTS
  */
 
-function test_GetAttachmentKeywords(desc, mailData, keywords, expected)
+function test_getAttachmentKeywords(desc, mailData, keywords, expected)
 {
-  let result = GetAttachmentKeywords(mailData, keywords);
+  let result = AttachmentChecker.getAttachmentKeywords(mailData, keywords);
   assert_equal(result, expected, desc + " not equal!");
 }
 
 var tests = [
   // Desc, mail body Data, keywords to search for, expected keywords found.
   ["Simple keyword", "latte.ca", "latte", "latte"],
   ["Extension", "testing document.pdf", ".pdf", "document.pdf"],
   ["Two Extensions", "testing document.pdf and test.pdf", ".pdf",
@@ -77,12 +77,12 @@ var tests = [
 function run_test()
 {
   do_test_pending();
 
   for (var i in tests)
     if (typeof(tests[i]) == "function")
       tests[i]();
     else
-      test_GetAttachmentKeywords.apply(null, tests[i]);
+      test_getAttachmentKeywords.apply(null, tests[i]);
 
   do_test_finished();
 };
--- a/mail/base/test/unit/test_mailGlue_distribution.js
+++ b/mail/base/test/unit/test_mailGlue_distribution.js
@@ -1,9 +1,9 @@
-ChromeUtils.import("resource:///modules/distribution.js");
+ChromeUtils.import("resource:///modules/TBDistCustomizer.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 function run_test()
 {
   do_test_pending();
 
   Services.locale.requestedLocales = ["en-US"];
 
--- a/mail/base/test/unit/test_windows_font_migration.js
+++ b/mail/base/test/unit/test_windows_font_migration.js
@@ -4,17 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
  * Test font preference migration. This currently only makes sense on Windows --
  * however, we're able to test for all versions of Windows, regardless of which
  * version the test is run on.
  */
 
-ChromeUtils.import("resource:///modules/mailMigrator.js");
+ChromeUtils.import("resource:///modules/MailMigrator.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 /**
  * A list of font names to verify using |makeVerifier| and
  * |verifier|. |makeVerifier| expects all the prefs to be passed in, while
  * |verifier| doesn't require any.
  */
 var kNamesToVerify = ["serif", "sans", "monospace"];
--- a/mail/components/compose/content/MsgComposeCommands.js
+++ b/mail/components/compose/content/MsgComposeCommands.js
@@ -5,23 +5,23 @@
 /* import-globals-from addressingWidgetOverlay.js */
 
 /**
  * Commands for the message composition window.
  */
 
 // Ensure the activity modules are loaded for this window.
 ChromeUtils.import("resource:///modules/activity/activityModules.jsm");
-const { GetAttachmentKeywords } = ChromeUtils.import("resource:///modules/attachmentChecker.js", null);
+ChromeUtils.import("resource:///modules/AttachmentChecker.jsm");
 ChromeUtils.import("resource:///modules/cloudFileAccounts.js");
 const { MimeParser } = ChromeUtils.import("resource:///modules/mimeParser.jsm", null);
 const { allAccountsSorted } = ChromeUtils.import("resource:///modules/folderUtils.jsm", null);
 const { fixIterator, toArray } = ChromeUtils.import("resource:///modules/iteratorUtils.jsm", null);
 ChromeUtils.import("resource:///modules/MailServices.jsm");
-ChromeUtils.import("resource:///modules/MailUtils.js");
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 ChromeUtils.import("resource://gre/modules/InlineSpellChecker.jsm");
 ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
 
 ChromeUtils.defineModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
 ChromeUtils.defineModuleGetter(this, "ShortcutUtils",
@@ -2232,17 +2232,17 @@ function manageAttachmentNotification(aF
  * Returns whether the attachment notification should be suppressed regardless of
  * the state of keywords.
  */
 function attachmentNotificationSupressed() {
   return (gDisableAttachmentReminder || gManualAttachmentReminder ||
           AttachmentElementHasItems());
 }
 
-var attachmentWorker = new Worker("resource:///modules/attachmentChecker.js");
+var attachmentWorker = new Worker("resource:///modules/AttachmentChecker.jsm");
 
 // The array of currently found keywords. Or null if keyword detection wasn't
 // run yet so we don't know.
 attachmentWorker.lastMessage = null;
 
 attachmentWorker.onerror = function(error) {
   Cu.reportError("Attachment Notification Worker error!!! " + error.message);
   throw error;
@@ -6474,17 +6474,17 @@ var gAttachmentNotifier = {
           gComposeType == Ci.nsIMsgCompType.Draft ||
           gComposeType == Ci.nsIMsgCompType.Template ||
           gComposeType == Ci.nsIMsgCompType.EditTemplate ||
           gComposeType == Ci.nsIMsgCompType.EditAsNew ||
           gComposeType == Ci.nsIMsgCompType.MailToUrl))))
       mailData = subject + " " + mailData;
 
     if (!async)
-      return GetAttachmentKeywords(mailData, keywordsInCsv);
+      return AttachmentChecker.getAttachmentKeywords(mailData, keywordsInCsv);
 
     attachmentWorker.postMessage([mailData, keywordsInCsv]);
     return null;
   },
 
   shutdown: function gAN_shutdown() {
     if (this._obs)
       this._obs.disconnect();
--- a/mail/components/mailGlue.js
+++ b/mail/components/mailGlue.js
@@ -4,18 +4,18 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/AddonManager.jsm");
 ChromeUtils.import("resource://gre/modules/LightweightThemeConsumer.jsm");
-const { TBDistCustomizer } = ChromeUtils.import("resource:///modules/distribution.js", null);
-const { MailMigrator } = ChromeUtils.import("resource:///modules/mailMigrator.js", null);
+ChromeUtils.import("resource:///modules/TBDistCustomizer.jsm");
+ChromeUtils.import("resource:///modules/MailMigrator.jsm");
 const {
   ExtensionSupport,
   extensionDefaults,
 } = ChromeUtils.import("resource:///modules/extensionSupport.jsm", null);
 const { L10nRegistry, FileSource } = ChromeUtils.import("resource://gre/modules/L10nRegistry.jsm", null);
 
 // lazy module getters
 
@@ -35,17 +35,17 @@ ChromeUtils.defineModuleGetter(this, "Ac
                                "resource://gre/modules/ActorManagerParent.jsm");
 
 let ACTORS = {
 };
 
 /**
  * Glue code that should be executed before any windows are opened. Any
  * window-independent helper methods (a la nsBrowserGlue.js) should go in
- * MailUtils.js instead.
+ * MailUtils.jsm instead.
  */
 
 function MailGlue() {
   XPCOMUtils.defineLazyGetter(this, "_sanitizer",
     function() {
       let sanitizerScope = {};
       Services.scriptloader.loadSubScript("chrome://messenger/content/sanitize.js", sanitizerScope);
       return sanitizerScope.Sanitizer;
--- a/mail/components/nsMailDefaultHandler.js
+++ b/mail/components/nsMailDefaultHandler.js
@@ -34,17 +34,17 @@ function resolveURIInternal(aCmdLine, aA
     Cu.reportError(e);
   }
 
   return uri;
 }
 
 function handleIndexerResult(aFile) {
   // Do this here because xpcshell isn't too happy with this at startup
-  ChromeUtils.import("resource:///modules/MailUtils.js");
+  ChromeUtils.import("resource:///modules/MailUtils.jsm");
   // Make sure the folder tree is initialized
   MailUtils.discoverFolders();
 
   // Use the search integration module to convert the indexer result into a
   // message header
   ChromeUtils.import("resource:///modules/SearchIntegration.jsm");
   let msgHdr = SearchIntegration.handleResult(aFile);
 
--- a/mail/components/search/content/SpotlightIntegration.js
+++ b/mail/components/search/content/SpotlightIntegration.js
@@ -1,17 +1,17 @@
 /* -*- Mode: JavaScript; 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/. */
 
 // SearchIntegration.jsm
 /* globals SearchIntegration, SearchSupport, Services */
 
-ChromeUtils.import("resource:///modules/MailUtils.js");
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 
 var MSG_DB_LARGE_COMMIT = 1;
 var gFileHeader = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.\ncom/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>";
 
 SearchIntegration = { // eslint-disable-line no-global-assign
   __proto__: SearchSupport,
 
   // The property of the header and (sometimes) folders that's used to check
--- a/mail/components/search/content/WinSearchIntegration.js
+++ b/mail/components/search/content/WinSearchIntegration.js
@@ -1,17 +1,17 @@
 /* -*- Mode: JavaScript; 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/. */
 
 // SearchIntegration.jsm
 /* globals SearchIntegration, SearchSupport, Services */
 
-ChromeUtils.import("resource:///modules/MailUtils.js");
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 
 var MSG_DB_LARGE_COMMIT = 1;
 var CRLF = "\r\n";
 
 /**
  * Required to access the 64-bit registry, even though we're probably a 32-bit
  * program
  */
--- a/mail/extensions/mailviews/content/msgViewPickerOverlay.js
+++ b/mail/extensions/mailviews/content/msgViewPickerOverlay.js
@@ -1,16 +1,16 @@
 /* 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/. */
 
 ChromeUtils.import("resource:///modules/MailServices.jsm");
-ChromeUtils.import("resource:///modules/mailViewManager.js");
+ChromeUtils.import("resource:///modules/MailViewManager.jsm");
 
-// these constants are now authoritatively defined in mailViewManager.js (above)
+// these constants are now authoritatively defined in MailViewManager.jsm (above)
 // tag views have kViewTagMarker + their key as value
 var kViewItemAll         = MailViewConstants.kViewItemAll;
 var kViewItemUnread      = MailViewConstants.kViewItemUnread;
 var kViewItemTags        = MailViewConstants.kViewItemTags; // former labels used values 2-6
 var kViewItemNotDeleted  = MailViewConstants.kViewItemNotDeleted;
 // not a real view! a sentinel value to pop up a dialog
 var kViewItemVirtual     = MailViewConstants.kViewItemVirtual;
 // not a real view! a sentinel value to pop up a dialog
--- a/mail/test/mozmill/folder-display/test-columns.js
+++ b/mail/test/mozmill/folder-display/test-columns.js
@@ -3,17 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 var elib = {};
 ChromeUtils.import("chrome://mozmill/content/modules/elementslib.js", elib);
 
 // needed to zero inter-folder processing delay
-ChromeUtils.import("resource:///modules/MailUtils.js");
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 
 
 /*
  * Test column default logic and persistence logic.  Persistence comes in both
  *  tab-switching (because of the multiplexed implementation) and
  *  folder-switching forms.
  */
 
--- a/mail/test/mozmill/folder-display/test-mail-views.js
+++ b/mail/test/mozmill/folder-display/test-mail-views.js
@@ -7,17 +7,17 @@
 var MODULE_NAME = 'test-mail-views';
 
 var RELATIVE_ROOT = '../shared-modules';
 var MODULE_REQUIRES = ['folder-display-helpers', 'window-helpers'];
 
 var baseFolder, savedFolder;
 var setUntagged, setTagged;
 
-ChromeUtils.import("resource:///modules/mailViewManager.js");
+ChromeUtils.import("resource:///modules/MailViewManager.jsm");
 
 var setupModule = function(module) {
   let fdh = collector.getModule('folder-display-helpers');
   fdh.installInto(module);
   let wh = collector.getModule('window-helpers');
   wh.installInto(module);
 
   // Create a folder with some messages that have no tags and some that are
--- a/mail/test/mozmill/folder-display/test-message-commands.js
+++ b/mail/test/mozmill/folder-display/test-message-commands.js
@@ -11,17 +11,17 @@
 "use strict";
 
 var MODULE_NAME = 'test-message-commands';
 
 var RELATIVE_ROOT = '../shared-modules';
 var MODULE_REQUIRES = ['folder-display-helpers', 'content-tab-helpers',
                        'window-helpers'];
 
-ChromeUtils.import("resource:///modules/MailUtils.js");
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var unreadFolder, shiftDeleteFolder, threadDeleteFolder;
 var archiveSrcFolder = null;
 var archiveURI;
 
 var acctMgr;
 var tagArray;
--- a/mail/test/mozmill/folder-display/test-opening-messages-without-a-backing-view.js
+++ b/mail/test/mozmill/folder-display/test-opening-messages-without-a-backing-view.js
@@ -10,17 +10,17 @@
 
 "use strict";
 
 var MODULE_NAME = 'test-opening-messages-without-a-backing-view';
 
 var RELATIVE_ROOT = '../shared-modules';
 var MODULE_REQUIRES = ['folder-display-helpers', 'window-helpers'];
 
-ChromeUtils.import("resource:///modules/MailUtils.js");
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 
 // One folder's enough
 var folder = null;
 
 // A list of the message headers in this folder
 var msgHdrsInFolder = null;
 
 // Number of messages to open for multi-message tests
--- a/mail/test/mozmill/folder-display/test-recent-menu.js
+++ b/mail/test/mozmill/folder-display/test-recent-menu.js
@@ -5,17 +5,17 @@
 /**
  * This tests the move/copy to recent folder menus to make sure
  * that they get updated when messages are moved to folders, and
  * don't get updated when we archive.
  */
 
 "use strict";
 
-ChromeUtils.import("resource:///modules/MailUtils.js");
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 ChromeUtils.import("resource:///modules/MailServices.jsm");
 
 var MODULE_NAME = 'test-recent-menu';
 
 var RELATIVE_ROOT = '../shared-modules';
 var MODULE_REQUIRES = ['folder-display-helpers', 'window-helpers'];
 
 var folder1, folder2;
--- a/mail/test/mozmill/instrumentation/test-instrument-setup.js
+++ b/mail/test/mozmill/instrumentation/test-instrument-setup.js
@@ -54,17 +54,17 @@ function test_mail_account_setup() {
   // XXX: This should probably use a notification, once we fix bug 561143.
   awc.waitFor(() => awc.window.gEmailConfigWizard._currentConfig != null,
               "Timeout waiting for current config to become non-null",
               8000, 600);
   config = awc.window.gEmailConfigWizard._currentConfig;
   plan_for_window_close(awc);
   awc.e("create_button").click();
 
-  let events = mc.window.mailInstrumentationManager._currentState.events;
+  let events = mc.window.MailInstrumentation._currentState.events;
   wait_for_window_close();
 
   // we expect to have accountAdded and smtpServerAdded events.
   if (! (events["accountAdded"].data))
     throw new Error("failed to add an account");
   else if (! (events["smtpServerAdded"].data))
     throw new Error("failed to add an smtp server");
 }
--- a/mail/test/mozmill/session-store/test-session-store.js
+++ b/mail/test/mozmill/session-store/test-session-store.js
@@ -13,17 +13,17 @@ var MODULE_NAME = "test-session-store";
 
 var RELATIVE_ROOT = "../shared-modules";
 var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
 
 var controller = {};
 ChromeUtils.import("chrome://mozmill/content/modules/controller.js", controller);
 
 ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
-ChromeUtils.import("resource:///modules/sessionStoreManager.js");
+ChromeUtils.import("resource:///modules/SessionStoreManager.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var folderA, folderB;
 
 // Default JSONFile save delay with saveSoon().
 var kSaveDelayMs = 1500;
 
 // With async file writes, use a delay larger than the session autosave timer.
@@ -31,31 +31,31 @@ var asyncFileWriteDelayMS = 3000;
 
 /* ........ Helper Functions ................*/
 
 /**
  * Reads the contents of the session file into a JSON object.
  */
 function readFile() {
   try {
-    let data = IOUtils.loadFileToString(sessionStoreManager.sessionFile);
+    let data = IOUtils.loadFileToString(SessionStoreManager.sessionFile);
     if (data)
       return JSON.parse(data);
   }
   catch (ex) {
     // fall through and return null if the session file cannot be read
     // or is bad
   }
 
   return null;
 }
 
 function waitForFileRefresh() {
   controller.sleep(kSaveDelayMs);
-  utils.waitFor(() => sessionStoreManager.sessionFile.exists(),
+  utils.waitFor(() => SessionStoreManager.sessionFile.exists(),
                 "session file should exist");
   controller.sleep(asyncFileWriteDelayMS);
 }
 
 function open3PaneWindow() {
   plan_for_new_window("mail:3pane");
   Services.ww.openWindow(null,
                          "chrome://messenger/content/messenger.xul", "",
@@ -81,77 +81,77 @@ function setupModule(module) {
   }
 
   folderA = create_folder("SessionStoreA");
   make_new_sets_in_folder(folderA, [{count: 3}]);
 
   folderB = create_folder("SessionStoreB");
   make_new_sets_in_folder(folderB, [{count: 3}]);
 
-  sessionStoreManager.stopPeriodicSave();
+  SessionStoreManager.stopPeriodicSave();
 
   // Opt out of calendar promotion so we don't show the "ligthing now
   // integrated" notification bar (which gives us unexpected heights).
   Services.prefs.setBoolPref("calendar.integration.notify", false);
 }
 
 function teardownModule(module) {
   folderA.Delete();
   folderB.Delete();
   Services.prefs.clearUserPref("calendar.integration.notify");
 }
 
 function test_periodic_session_persistence_simple() {
   // delete the session file if it exists
-  let sessionFile = sessionStoreManager.sessionFile;
+  let sessionFile = SessionStoreManager.sessionFile;
   if (sessionFile.exists())
     sessionFile.remove(false);
 
   utils.waitFor(() => !sessionFile.exists(),
                 "session file should not exist");
 
   // change some state to guarantee the file will be recreated
   // if periodic session persistence works
   be_in_folder(folderA);
 
   // if periodic session persistence is working, the file should be
   // re-created
-  sessionStoreManager._saveState();
+  SessionStoreManager._saveState();
   waitForFileRefresh();
 }
 
 function test_periodic_nondirty_session_persistence() {
   // This changes state.
   be_in_folder(folderB);
 
-  sessionStoreManager._saveState();
+  SessionStoreManager._saveState();
   waitForFileRefresh();
 
   // delete the session file
-  let sessionFile = sessionStoreManager.sessionFile;
+  let sessionFile = SessionStoreManager.sessionFile;
   sessionFile.remove(false);
 
   // Since the state of the session hasn't changed since last _saveState(),
   // the session file should not be re-created.
-  sessionStoreManager._saveState();
+  SessionStoreManager._saveState();
   controller.sleep(kSaveDelayMs + asyncFileWriteDelayMS);
 
   utils.waitFor(() => !sessionFile.exists(),
                 "session file should not exist");
 }
 
 function test_single_3pane_periodic_session_persistence() {
   be_in_folder(folderA);
 
   // get the state object. this assumes there is one and only one
   // 3pane window.
   let mail3PaneWindow = Services.wm.getMostRecentWindow("mail:3pane");
   let state = mail3PaneWindow.getWindowStateForSessionPersistence();
 
-  sessionStoreManager._saveState();
+  SessionStoreManager._saveState();
   waitForFileRefresh();
 
   // load the saved state from disk
   let loadedState = readFile();
   assert_true(loadedState, "previously saved state should be non-null");
 
   // get the state object for the one and only one 3pane window
   let windowState = loadedState.windows[0];
@@ -364,17 +364,17 @@ function test_multiple_3pane_periodic_se
     open3PaneWindow();
 
   // then get the state objects for each window
   let state = [];
   let enumerator = Services.wm.getEnumerator("mail:3pane");
   while (enumerator.hasMoreElements())
     state.push(enumerator.getNext().getWindowStateForSessionPersistence());
 
-  sessionStoreManager._saveState();
+  SessionStoreManager._saveState();
   waitForFileRefresh();
 
   // load the saved state from disk
   let loadedState = readFile();
   assert_true(loadedState, "previously saved state should be non-null");
 
   assert_equals(loadedState.windows.length, state.length,
           "number of windows in saved state and loaded state should be equal");
@@ -392,32 +392,32 @@ function test_multiple_3pane_periodic_se
     if (enumerator.hasMoreElements())
       window.close();
   }
 }
 
 async function test_bad_session_file_simple() {
   // forcefully write a bad session file
   let data = "BAD SESSION FILE";
-  let fos = FileUtils.openSafeFileOutputStream(sessionStoreManager.sessionFile);
+  let fos = FileUtils.openSafeFileOutputStream(SessionStoreManager.sessionFile);
   fos.write(data, data.length);
   FileUtils.closeSafeFileOutputStream(fos);
 
   // tell the session store manager to try loading the bad session file.
   // NOTE: periodic session persistence is not enabled in this test
-  sessionStoreManager._store = null;
-  await sessionStoreManager._loadSessionFile();
+  SessionStoreManager._store = null;
+  await SessionStoreManager._loadSessionFile();
 
   // since the session file is bad, the session store manager's state field
   // should be null
-  assert_false(sessionStoreManager._initialState,
+  assert_false(SessionStoreManager._initialState,
                "saved state is bad so state object should be null");
 
   // The bad session file should now not exist.
-  utils.waitFor(() => !sessionStoreManager.sessionFile.exists(),
+  utils.waitFor(() => !SessionStoreManager.sessionFile.exists(),
                 "session file should now not exist");
 }
 
 function test_clean_shutdown_session_persistence_simple() {
   // open a few more 3pane windows
   for (var i = 0; i < 3; ++i) {
     open3PaneWindow();
   }
--- a/mail/test/mozmill/shared-modules/test-folder-display-helpers.js
+++ b/mail/test/mozmill/shared-modules/test-folder-display-helpers.js
@@ -19,20 +19,20 @@ ChromeUtils.import("chrome://mozmill/con
 var os = {};
 ChromeUtils.import("chrome://mozmill/content/stdlib/os.js", os);
 var utils = {};
 ChromeUtils.import("chrome://mozmill/content/modules/utils.js", utils);
 
 ChromeUtils.import("resource:///modules/gloda/log4moz.js");
 
 var nsMsgViewIndex_None = 0xffffffff;
-ChromeUtils.import('resource:///modules/MailConsts.js');
+ChromeUtils.import('resource:///modules/MailConsts.jsm');
 ChromeUtils.import("resource:///modules/MailServices.jsm");
-ChromeUtils.import('resource:///modules/MailUtils.js');
-ChromeUtils.import('resource:///modules/mailViewManager.js');
+ChromeUtils.import('resource:///modules/MailUtils.jsm');
+ChromeUtils.import('resource:///modules/MailViewManager.jsm');
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var FILE_LOAD_PATHS = [
   "../",
   "../../",
   "../../../../mailnews/test/",
   "../../../../mail/base/test/unit/",
 ];
--- a/mailnews/base/content/folderWidgets.xml
+++ b/mailnews/base/content/folderWidgets.xml
@@ -13,17 +13,17 @@
   <binding id="folder-menupopup"
            extends="chrome://global/content/bindings/popup.xml#popup">
     <implementation>
       <constructor><![CDATA[
         ChromeUtils.import("resource:///modules/FeedUtils.jsm", this);
         ChromeUtils.import("resource:///modules/folderUtils.jsm", this);
         ChromeUtils.import("resource:///modules/iteratorUtils.jsm", this);
         ChromeUtils.import("resource:///modules/MailServices.jsm", this);
-        ChromeUtils.import("resource:///modules/MailUtils.js", this);
+        ChromeUtils.import("resource:///modules/MailUtils.jsm", this);
         ChromeUtils.import("resource:///modules/StringBundle.js", this);
         this._stringBundle = new this
             .StringBundle("chrome://messenger/locale/folderWidgets.properties");
 
         // Get the displayformat if set.
         if (this.parentNode && this.parentNode.localName == "menulist")
           this._displayformat = this.parentNode.getAttribute("displayformat");
 
--- a/mailnews/base/content/junkCommands.js
+++ b/mailnews/base/content/junkCommands.js
@@ -21,17 +21,17 @@
   *   either gMsgFolderSelected or gFolderDisplay
   *   MsgJunkMailInfo(aCheckFirstUse)
   *   SetNextMessageAfterDelete()
   *   pref
   *   msgWindow
   */
 
 ChromeUtils.import("resource:///modules/MailServices.jsm");
-ChromeUtils.import("resource:///modules/MailUtils.js");
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 /*
  * determineActionsForJunkMsgs
  *
  * Determines the actions that should be carried out on the messages
  * that are being marked as junk
  *
--- a/mailnews/base/content/msgFolderPickerOverlay.js
+++ b/mailnews/base/content/msgFolderPickerOverlay.js
@@ -1,14 +1,14 @@
 /* -*- 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/. */
 
-ChromeUtils.import("resource:///modules/MailUtils.js");
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 
 var gMessengerBundle;
 
 // call this from dialog onload() to set the menu item to the correct value
 function MsgFolderPickerOnLoad(pickerID)
 {
   var uri = null;
   try {
--- a/mailnews/base/content/subscribe.js
+++ b/mailnews/base/content/subscribe.js
@@ -1,13 +1,13 @@
 /* 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/. */
 
-ChromeUtils.import("resource:///modules/MailUtils.js");
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
 
 var gSubscribeTree = null;
 var gSubscribeBody = null;
 var gSearchTree;
 var okCallback = null;
 var gChangeTable = {};
 var gServerURI = null;
--- a/mailnews/base/content/virtualFolderProperties.js
+++ b/mailnews/base/content/virtualFolderProperties.js
@@ -12,17 +12,17 @@ var gMessengerBundle = null;
 
 var nsMsgSearchScope = Ci.nsMsgSearchScope;
 
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/PluralForm.jsm");
 ChromeUtils.import("resource:///modules/MailServices.jsm");
 ChromeUtils.import("resource:///modules/virtualFolderWrapper.js");
 ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
-ChromeUtils.import("resource:///modules/MailUtils.js");
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 
 function onLoad()
 {
   var windowArgs = window.arguments[0];
   var acceptButton = document.documentElement.getButton("accept");
 
   gMessengerBundle = document.getElementById("bundle_messenger");
 
--- a/mailnews/base/prefs/content/am-copies.js
+++ b/mailnews/base/prefs/content/am-copies.js
@@ -1,14 +1,14 @@
 /* -*- 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/. */
 
-ChromeUtils.import("resource:///modules/MailUtils.js");
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 
 var gFccRadioElemChoice, gDraftsRadioElemChoice, gArchivesRadioElemChoice, gTmplRadioElemChoice;
 var gFccRadioElemChoiceLocked, gDraftsRadioElemChoiceLocked, gArchivesRadioElemChoiceLocked, gTmplRadioElemChoiceLocked;
 var gDefaultPickerMode = "1";
 
 var gFccFolderWithDelim, gDraftsFolderWithDelim, gArchivesFolderWithDelim, gTemplatesFolderWithDelim;
 var gAccount;
 var gCurrentServerId;
--- a/mailnews/base/prefs/content/am-junk.js
+++ b/mailnews/base/prefs/content/am-junk.js
@@ -1,16 +1,16 @@
 /* -*- 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/.
  */
 ChromeUtils.import("resource:///modules/MailServices.jsm");
 ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
-ChromeUtils.import("resource:///modules/MailUtils.js");
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 
 var gDeferredToAccount = "";
 
 function onInit(aPageId, aServerId)
 {
   // manually adjust several pref UI elements
   document.getElementById('server.spamLevel.visible').setAttribute("checked",
     document.getElementById('server.spamLevel').value > 0);
--- a/mailnews/base/prefs/content/am-server.js
+++ b/mailnews/base/prefs/content/am-server.js
@@ -1,15 +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/. */
 
 ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
-ChromeUtils.import("resource:///modules/MailUtils.js");
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var gServer;
 var gOriginalStoreType;
 
 /**
  * Called when the store type menu is clicked.
  * @param {Object} aStoreTypeElement - store type menu list element.
--- a/mailnews/base/prefs/content/amUtils.js
+++ b/mailnews/base/prefs/content/amUtils.js
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 4; 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/. */
 
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource:///modules/MailServices.jsm");
-ChromeUtils.import("resource:///modules/MailUtils.js");
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
 
 function BrowseForLocalFolders()
 {
   const nsIFilePicker = Ci.nsIFilePicker;
   const nsIFile = Ci.nsIFile;
 
   var currentFolderTextBox = document.getElementById("server.localPath");
--- a/mailnews/base/prefs/content/converterDialog.js
+++ b/mailnews/base/prefs/content/converterDialog.js
@@ -4,17 +4,17 @@
 
 /**
  * This file contains functionality for the front-end part of the mail store
  * type conversion.
  */
 
 ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
 ChromeUtils.import("resource://gre/modules/BrowserUtils.jsm");
-ChromeUtils.import("resource:///modules/MailUtils.js");
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
 ChromeUtils.import("resource://gre/modules/osfile.jsm");
 ChromeUtils.import("resource://gre/modules/Log.jsm");
 ChromeUtils.import("resource:///modules/mailstoreConverter.jsm");
 ChromeUtils.import("resource:///modules/folderUtils.jsm");
 
 var log = Log.repository.getLogger("MailStoreConverter");
--- a/mailnews/base/search/content/FilterEditor.js
+++ b/mailnews/base/search/content/FilterEditor.js
@@ -1,16 +1,16 @@
 /* -*- 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/. */
 
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource:///modules/MailServices.jsm");
-ChromeUtils.import("resource:///modules/MailUtils.js");
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 
 // The actual filter that we're editing if it is a _saved_ filter or prefill;
 // void otherwise.
 var gFilter;
 // cache the key elements we need
 var gFilterList;
 // The filter name as it appears in the "Filter Name" field of dialog.
 var gFilterNameElement;
--- a/mailnews/base/search/content/searchWidgets.xml
+++ b/mailnews/base/search/content/searchWidgets.xml
@@ -442,17 +442,17 @@
         </body>
       </method>
 
       <method name="validateAction">
         <body>
           <![CDATA[
             // returns true if this row represents a valid filter action and false otherwise.
             // This routine also prompts the user.
-            ChromeUtils.import("resource:///modules/MailUtils.js", this);
+            ChromeUtils.import("resource:///modules/MailUtils.jsm", this);
             var filterActionString = this.getAttribute('value');
             var actionTarget = document.getAnonymousNodes(this)[1];
             var errorString, customError;
 
             switch (filterActionString)
             {
               case "movemessage":
               case "copymessage":
@@ -716,17 +716,17 @@
                        recentLabel="&recentFolders.label;"
                        showFileHereLabel="true"/>
       </xul:menulist>
     </content>
 
     <implementation>
       <constructor>
         <![CDATA[
-          ChromeUtils.import("resource:///modules/MailUtils.js", this);
+          ChromeUtils.import("resource:///modules/MailUtils.jsm", this);
           let folder = this.menulist.value ?
                          this.MailUtils.getFolderForURI(this.menulist.value) :
                          gFilterList.folder;
           // An account folder is not a move/copy target; show "Choose Folder".
           folder = folder.isServer ? null : folder;
           let menupopup = this.menulist.menupopup;
           // The menupopup constructor needs to finish first.
           setTimeout(function() { menupopup.selectFolder(folder); }, 0);
--- a/mailnews/base/src/nsMailNewsCommandLineHandler.js
+++ b/mailnews/base/src/nsMailNewsCommandLineHandler.js
@@ -25,17 +25,17 @@ var nsMailNewsCommandLineHandler =
   /**
    * Handles the following command line arguments:
    * - -mail: opens the mail folder view
    * - -MapiStartup: indicates that this startup is due to MAPI.
    *   Don't do anything for now.
    */
   handle: function nsMailNewsCommandLineHandler_handle(aCommandLine) {
     // Do this here because xpcshell isn't too happy with this at startup
-    ChromeUtils.import("resource:///modules/MailUtils.js");
+    ChromeUtils.import("resource:///modules/MailUtils.jsm");
     // -mail <URL>
     let mailURL = null;
     try {
       mailURL = aCommandLine.handleFlagWithParam("mail", false);
     }
     catch (e) {
       // We're going to cover -mail without a parameter later
     }
--- a/mailnews/base/src/nsMsgSearchDBView.cpp
+++ b/mailnews/base/src/nsMsgSearchDBView.cpp
@@ -44,17 +44,17 @@ NS_IMPL_ISUPPORTS_INHERITED(nsMsgSearchD
 
 NS_IMETHODIMP
 nsMsgSearchDBView::Open(nsIMsgFolder *folder,
                         nsMsgViewSortTypeValue sortType,
                         nsMsgViewSortOrderValue sortOrder,
                         nsMsgViewFlagsTypeValue viewFlags,
                         int32_t *pCount)
 {
-  // dbViewWrapper.js likes to create search views with a sort order
+  // DBViewWrapper.jsm likes to create search views with a sort order
   // of byNone, in order to have the order be the order the search results
   // are returned. But this doesn't work with threaded view, so make the
   // sort order be byDate if we're threaded.
 
   if (viewFlags & nsMsgViewFlagsType::kThreadedDisplay &&
       sortType == nsMsgViewSortType::byNone)
     sortType = nsMsgViewSortType::byDate;
 
--- a/mailnews/base/src/nsMsgXFVirtualFolderDBView.cpp
+++ b/mailnews/base/src/nsMsgXFVirtualFolderDBView.cpp
@@ -433,17 +433,17 @@ nsMsgXFVirtualFolderDBView::OnNewSearch(
   dbFolderInfo->GetCharProperty("searchStr", terms);
   nsCOMPtr<nsIMutableArray> searchTerms;
   rv = searchSession->GetSearchTerms(getter_AddRefs(searchTerms));
   NS_ENSURE_SUCCESS(rv, rv);
   nsCString curSearchAsString;
 
   rv = MsgTermListToString(searchTerms, curSearchAsString);
   // Trim off the initial AND/OR, which is irrelevant and inconsistent between
-  // what searchSpec.js generates, and what's in virtualFolders.dat.
+  // what SearchSpec.jsm generates, and what's in virtualFolders.dat.
   curSearchAsString.Cut(0, StringBeginsWith(curSearchAsString,
                                             NS_LITERAL_CSTRING("AND")) ? 3 : 2);
   terms.Cut(0, StringBeginsWith(terms, NS_LITERAL_CSTRING("AND")) ? 3 : 2);
 
   NS_ENSURE_SUCCESS(rv, rv);
   // If the search session search string doesn't match the vf search str,
   // then we're doing quick search, which means we don't want to invalidate
   // cached results, or used cached results.
--- a/mailnews/base/util/mailstoreConverter.jsm
+++ b/mailnews/base/util/mailstoreConverter.jsm
@@ -1,16 +1,16 @@
 /* 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/. */
 
 var EXPORTED_SYMBOLS = ["convertMailStoreTo", "terminateWorkers"];
 
 ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
-ChromeUtils.import("resource:///modules/MailUtils.js");
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 ChromeUtils.import("resource:///modules/MailServices.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
 ChromeUtils.import("resource://gre/modules/osfile.jsm");
 ChromeUtils.import("resource://gre/modules/Log.jsm");
 
 var log = Log.repository.getLogger("MailStoreConverter");
 log.level = Log.Level.Debug;
--- a/mailnews/db/gloda/modules/index_msg.js
+++ b/mailnews/db/gloda/modules/index_msg.js
@@ -12,17 +12,17 @@
  *  benefit readability/size as well.
  */
 
 this.EXPORTED_SYMBOLS = ['GlodaMsgIndexer'];
 
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 ChromeUtils.import("resource:///modules/iteratorUtils.jsm");
 ChromeUtils.import("resource:///modules/MailServices.jsm");
-ChromeUtils.import("resource:///modules/MailUtils.js");
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 
 ChromeUtils.import("resource:///modules/gloda/log4moz.js");
 
 ChromeUtils.import("resource:///modules/gloda/utils.js");
 ChromeUtils.import("resource:///modules/gloda/datastore.js");
 ChromeUtils.import("resource:///modules/gloda/datamodel.js");
 ChromeUtils.import("resource:///modules/gloda/gloda.js");
 ChromeUtils.import("resource:///modules/gloda/collection.js");
--- a/mailnews/db/gloda/test/unit/base_index_messages.js
+++ b/mailnews/db/gloda/test/unit/base_index_messages.js
@@ -12,17 +12,17 @@
  *  variants.  See the text_index_messages_*.js files.
  *
  * Things we don't test that you think we might test:
  * - Full-text search.  Happens in query testing.
  */
 
 load("resources/glodaTestHelper.js");
 
-ChromeUtils.import("resource:///modules/MailUtils.js");
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 // Whether we can expect fulltext results
 var expectFulltextResults = true;
 
 /**
  * Should we force our folders offline after we have indexed them once.  We do
--- a/mailnews/extensions/newsblog/content/FeedUtils.jsm
+++ b/mailnews/extensions/newsblog/content/FeedUtils.jsm
@@ -3,17 +3,17 @@
  * 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/. */
 
 this.EXPORTED_SYMBOLS = ["Feed", "FeedItem", "FeedParser", "FeedUtils"];
 
 /* eslint-disable-next-line no-unused-vars */
 ChromeUtils.import("resource:///modules/gloda/log4moz.js");
 ChromeUtils.import("resource:///modules/MailServices.jsm");
-ChromeUtils.import("resource:///modules/MailUtils.js");
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 ChromeUtils.import("resource:///modules/jsmime.jsm");
 ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 Cu.importGlobalProperties(["XMLHttpRequest"]);
 
 Services.scriptloader.loadSubScript("chrome://messenger-newsblog/content/Feed.js");
--- a/mailnews/imap/test/unit/test_saveTemplate.js
+++ b/mailnews/imap/test/unit/test_saveTemplate.js
@@ -4,17 +4,17 @@
 
 /*
  * Tests imap save of message as a template, and test initial save right after
  * creation of folder.
  */
 
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource:///modules/MailServices.jsm");
-ChromeUtils.import("resource:///modules/MailUtils.js");
+ChromeUtils.import("resource:///modules/MailUtils.jsm");
 
 load("../../../resources/logHelper.js");
 load("../../../resources/asyncTestUtils.js");
 load("../../../resources/messageGenerator.js");
 
 // IMAP pump
 
 setupIMAPPump();