Final part of Bug 473458 Drop nsIMsgWindow argument from nsIMsgFolder's getMessages and getMsgDatabase functions. r=Neil,sr=bienvenu
authorMark Banner <bugzilla@standard8.plus.com>
Thu, 22 Jan 2009 10:15:14 +0000
changeset 1714 649e4c6a0e38e805c882ef633083927e6642c51d
parent 1713 5ae254acdf1e78d3c91d19281e72570543310978
child 1715 1df064913853bac2453c018b385ebe5fad7c7f4b
push idunknown
push userunknown
push dateunknown
reviewersNeil, bienvenu
bugs473458
Final part of Bug 473458 Drop nsIMsgWindow argument from nsIMsgFolder's getMessages and getMsgDatabase functions. r=Neil,sr=bienvenu
mail/base/content/commandglue.js
mail/base/content/folderPane.js
mail/base/content/mailContextMenus.js
mail/base/content/mailWidgets.xml
mail/base/content/mailWindowOverlay.js
mail/base/content/messageWindow.js
mail/base/content/msgMail3PaneWindow.js
mail/base/content/searchBar.js
mail/components/search/SpotlightIntegration.js
mail/components/search/WinSearchIntegration.js
mail/components/search/content/searchCommon.js
mailnews/base/public/nsIMsgFolder.idl
mailnews/base/resources/content/commandglue.js
mailnews/base/resources/content/junkCommands.js
mailnews/base/resources/content/mailCommands.js
mailnews/base/resources/content/mailContextMenus.js
mailnews/base/resources/content/mailWindowOverlay.js
mailnews/base/resources/content/markByDate.js
mailnews/base/resources/content/messageWindow.js
mailnews/base/resources/content/msgMail3PaneWindow.js
mailnews/base/resources/content/searchBar.js
mailnews/base/resources/content/virtualFolderProperties.js
mailnews/base/resources/content/widgetglue.js
mailnews/base/search/resources/content/searchWidgets.xml
mailnews/base/search/src/nsMsgLocalSearch.cpp
mailnews/base/src/nsMessengerBootstrap.cpp
mailnews/base/src/nsMsgAccountManager.cpp
mailnews/base/src/nsMsgDBView.cpp
mailnews/base/src/nsMsgFolderCompactor.cpp
mailnews/base/src/nsMsgSearchDBView.cpp
mailnews/base/src/nsMsgXFViewThread.cpp
mailnews/base/src/nsMsgXFVirtualFolderDBView.cpp
mailnews/base/test/unit/test_bug428427.js
mailnews/base/test/unit/test_folderCompact.js
mailnews/base/test/unit/test_nsIMsgFolderListenerLocal.js
mailnews/base/util/nsMsgDBFolder.cpp
mailnews/base/util/nsMsgTxn.cpp
mailnews/compose/src/nsMsgCompose.cpp
mailnews/compose/src/nsMsgComposeService.cpp
mailnews/compose/src/nsMsgSendLater.cpp
mailnews/db/gloda/modules/datamodel.js
mailnews/db/gloda/modules/indexer.js
mailnews/extensions/mailviews/resources/content/msgViewPickerOverlay.js
mailnews/extensions/newsblog/content/feed-subscriptions.js
mailnews/extensions/newsblog/content/utils.js
mailnews/extensions/newsblog/js/newsblog.js
mailnews/imap/src/nsAutoSyncState.cpp
mailnews/imap/src/nsImapMailFolder.cpp
mailnews/imap/src/nsImapMailFolder.h
mailnews/imap/src/nsImapService.cpp
mailnews/imap/src/nsImapUndoTxn.cpp
mailnews/local/src/nsLocalMailFolder.cpp
mailnews/local/src/nsLocalMailFolder.h
mailnews/local/src/nsLocalUndoTxn.cpp
mailnews/local/src/nsMailboxService.cpp
mailnews/local/src/nsMovemailIncomingServer.cpp
mailnews/local/src/nsPop3IncomingServer.cpp
mailnews/local/src/nsRssIncomingServer.cpp
mailnews/mapi/mapihook/src/msgMapiImp.cpp
mailnews/news/src/nsNNTPArticleList.cpp
mailnews/news/src/nsNNTPNewsgroupList.cpp
mailnews/news/src/nsNewsDownloader.cpp
mailnews/news/src/nsNewsFolder.cpp
mailnews/news/src/nsNewsFolder.h
mailnews/news/test/unit/head_server_setup.js
mailnews/news/test/unit/test_filter.js
suite/mailnews/mailWidgets.xml
--- a/mail/base/content/commandglue.js
+++ b/mail/base/content/commandglue.js
@@ -227,18 +227,17 @@ function isNewsURI(uri)
 function RerootFolder(uri, newFolder, viewType, viewFlags, sortType, sortOrder)
 {
   viewDebug("In reroot folder, sortType = " +  sortType + "viewType = " + viewType + "\n");
 
   if (sortType == 0)
   {
     try
     {
-      var msgdb = newFolder.getMsgDatabase(msgWindow);
-      var dbFolderInfo = msgdb.dBFolderInfo;
+      var dbFolderInfo = newFolder.msgDatabase.dBFolderInfo;
       sortType = dbFolderInfo.sortType;
       sortOrder = dbFolderInfo.sortOrder;
       viewFlags = dbFolderInfo.viewFlags;
       viewType = dbFolderInfo.viewType;
       dbFolderInfo = null;
     }
     catch(ex)
     {
@@ -293,17 +292,17 @@ function RerootFolder(uri, newFolder, vi
 
   if (oldFolder)
   {
     /* we don't null out the db reference for inbox because inbox is like the "main" folder
                and performance outweighs footprint*/
     if (!IsSpecialFolder(oldFolder, Components.interfaces.nsMsgFolderFlags.Inbox, false))
     {
       if (oldFolder.URI != newFolder.URI)
-        oldFolder.setMsgDatabase(null);
+        oldFolder.msgDatabase = null;
     }
   }
   // that should have initialized gDBView, now re-root the thread pane
   RerootThreadPane();
   SetUpToolbarButtons(uri);
   UpdateStatusMessageCounts(gMsgFolderSelected);
   
   // hook for extra toolbar items
@@ -845,17 +844,17 @@ function FolderPaneSelectionChange()
             gPrevFolderFlags = folderFlags;
             gCurrentVirtualFolderUri = null;
             // don't get the db if this folder is a server
             // we're going to be display account central
             if (!(msgFolder.isServer)) 
             {
               try 
               {
-                var msgDatabase = msgFolder.getMsgDatabase(msgWindow);
+                var msgDatabase = msgFolder.msgDatabase;
                 if (msgDatabase)
                 {
                   var dbFolderInfo = msgDatabase.dBFolderInfo;
                   sortType = dbFolderInfo.sortType;
                   sortOrder = dbFolderInfo.sortOrder;
                   viewFlags = dbFolderInfo.viewFlags;
                   if (folderFlags & Components.interfaces.nsMsgFolderFlags.Virtual)
                   {
@@ -881,17 +880,17 @@ function FolderPaneSelectionChange()
                     }
                     else
                     {
                       gSearchSession = null;
                       uriToLoad = srchFolderUri;
                       // we need to load the db for the actual folder so that many hdrs to download
                       // will return false...
                       realFolder = GetMsgFolderFromUri(uriToLoad);
-                      msgDatabase = realFolder.getMsgDatabase(msgWindow);
+                      msgDatabase = realFolder.msgDatabase;
                       gVirtualFolderTerms = CreateGroupedSearchTerms(tempFilter.searchTerms);
                     }
                   }
                   else
                   {
                     gSearchSession = null;
                     viewFlags = dbFolderInfo.viewFlags;
                     viewType = dbFolderInfo.viewType;
@@ -1009,17 +1008,17 @@ function  CreateVirtualFolder(newName, p
   // ### need to make sure view/folder doesn't exist.
   if (searchFolderURIs && (searchFolderURIs != "") && newName && (newName != "")) 
   {
     try
     {
       var newFolder = parentFolder.addSubfolder(newName);
       newFolder.prettyName = newName;
       newFolder.setFlag(Components.interfaces.nsMsgFolderFlags.Virtual);
-      var vfdb = newFolder.getMsgDatabase(msgWindow);
+      var vfdb = newFolder.msgDatabase;
       var searchTermString = getSearchTermString(searchTerms);
       var dbFolderInfo = vfdb.dBFolderInfo;
       // set the view string as a property of the db folder info
       // set the original folder name as well.
       dbFolderInfo.setCharProperty("searchStr", searchTermString);
       dbFolderInfo.setCharProperty("searchFolderUri", searchFolderURIs);
       dbFolderInfo.setBooleanProperty("searchOnline", searchOnline);
 
--- a/mail/base/content/folderPane.js
+++ b/mail/base/content/folderPane.js
@@ -1148,19 +1148,19 @@ let gFolderTreeController = {
 
     //xxx useless param
     function rebuildSummary(aFolder) {
       let folder = aFolder || gFolderTreeView.getSelectedFolders()[0];
       if (folder.locked) {
         folder.throwAlertMsg("operationFailedFolderBusy", msgWindow);
         return;
       }
-      folder.getMsgDatabase(msgWindow).summaryValid = false;
+      folder.msgDatabase.summaryValid = false;
 
-      var msgDB = folder.getMsgDatabase(msgWindow);
+      var msgDB = folder.msgDatabase;
       msgDB.summaryValid = false;
       try {
         folder.closeAndBackupFolderDB("");
       }
       catch(e) {
         // In a failure, proceed anyway since we're dealing with problems
         folder.ForceDBClosed();
       }
@@ -1286,17 +1286,17 @@ let gFolderTreeController = {
       return;
 
     // Delete any subfolders this folder might have
     let iter = folder.subFolders;
     while (iter.hasMoreElements())
       folder.propagateDelete(iter.getNext(), true, msgWindow);
 
     // Now delete the messages
-    let iter = fixIterator(folder.getMessages(msgWindow));
+    let iter = fixIterator(folder.messages);
     let messages = [m for each (m in iter)];
     let children = toXPCOMArray(messages, Ci.nsIMutableArray);
     folder.deleteMessages(children, msgWindow, true, false, null, false);
   },
 
   /**
    * Compacts either a particular folder, or all folders
    *
--- a/mail/base/content/mailContextMenus.js
+++ b/mail/base/content/mailContextMenus.js
@@ -425,17 +425,17 @@ function SearchForMessageIdInSubFolder(f
 
   return messageHeader;
 }
 
 // check folder for corresponding message to given message id
 // return message header if message was found
 function CheckForMessageIdInFolder(folder, messageId)
 {
-  var messageDatabase = folder.getMsgDatabase(msgWindow);
+  var messageDatabase = folder.msgDatabase;
   var messageHeader;
 
   try
   {
     messageHeader = messageDatabase.getMsgHdrForMessageID(messageId);
   }
   catch (ex)
   {
@@ -443,17 +443,17 @@ function CheckForMessageIdInFolder(folde
   }
   var mailSession = Components.classes["@mozilla.org/messenger/services/session;1"]
                               .getService(Components.interfaces.nsIMsgMailSession);
 
   const nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
   if (!mailSession.IsFolderOpenInWindow(folder) &&
       !(folder.flags & (nsMsgFolderFlags.Trash | nsMsgFolderFlags.Inbox)))
   {
-    folder.setMsgDatabase(null);
+    folder.msgDatabase = null;
   }
 
   return messageHeader;
 }
 
 function folderPaneOnPopupHiding()
 {
   RestoreSelectionWithoutContentLoad(document.getElementById("folderTree"));
--- a/mail/base/content/mailWidgets.xml
+++ b/mail/base/content/mailWidgets.xml
@@ -1901,18 +1901,17 @@
             // skip servers, Trash and Junk folders
             if (!aFolder || aFolder.isServer || aFolder.getFlag(kMsgPopupFolderFlagJunk) || aFolder.getFlag(kMsgPopupFolderFlagTrash))
               return false;
             var pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
             var showPreviewText = pref.getBoolPref("mail.biff.alert.show_preview");
             var folderArray = new Array;
             if (aFolder.flags & Components.interfaces.nsMsgFolderFlags.Virtual)
             {
-              var msgDatabase = aFolder.getMsgDatabase(null);
-              var dbFolderInfo = msgDatabase.dBFolderInfo;
+              var dbFolderInfo = aFolder.msgDatabase.dBFolderInfo;
               var srchFolderUri = dbFolderInfo.getCharProperty("searchFolderUri");
               var srchFolderUriArray = srchFolderUri.split('|');
               var foldersAdded = 0;
               var RDF = Components.classes['@mozilla.org/rdf/rdf-service;1'].getService().QueryInterface(Components.interfaces.nsIRDFService);
               for (var i in srchFolderUriArray)
               {
                 var realFolder = RDF.GetResource(srchFolderUriArray[i]).QueryInterface(Components.interfaces.nsIMsgFolder);
                 if (!realFolder.isServer)
@@ -1921,38 +1920,38 @@
             }
             else
               folderArray[0] = aFolder;
             var foundNewMsg = false;
             for (var folderIndex = 0; folderIndex < folderArray.length; folderIndex++)
             {
               aFolder = folderArray[folderIndex];
               // now get the database
-              var msgDatabase = aFolder.getMsgDatabase(null);
-              aFolder.setMsgDatabase(null);
+              var msgDatabase = aFolder.msgDatabase;
+              aFolder.msgDatabase = null;
               var msgKeys = {};
               var numMsgKeys = {};
               msgDatabase.getNewList(numMsgKeys, msgKeys);
 
               if (!numMsgKeys.value)
                 continue;
 
               if (showPreviewText)
               {
                 // fetchMsgPreviewText forces the previewText property to get generated
                 // for each of the message keys.
                 try {
                   aOutAsync.value = aFolder.fetchMsgPreviewText(msgKeys.value, numMsgKeys.value, false, aUrlListener);
-                  aFolder.setMsgDatabase(null);
+                  aFolder.msgDatabase = null;
                 }
                 catch (ex)
                 {
                   // fetchMsgPreviewText throws an error when we call it on a news folder, we should just not show
                   // the tooltip if this method returns an error.
-                  aFolder.setMsgDatabase(null);
+                  aFolder.msgDatabase = null;
                   continue;
                 }
               }
               // if fetching the preview text is going to be an asynch operation and the caller
               // is set up to handle that fact, then don't bother filling in any of the fields since
               // we'll have to do this all over again when the fetch for the preview text completes.
               // We don't expect to get called with a urlListener if we're doing a virtual folder.
               if (aOutAsync.value && aUrlListener)
--- a/mail/base/content/mailWindowOverlay.js
+++ b/mail/base/content/mailWindowOverlay.js
@@ -1640,17 +1640,17 @@ let mailTabType = {
       try
       {
         if (aTab.selectedMsgId && aTab.msgSelectedFolder)
         {
           // We clear the selection in order to generate an event when we
           // re-select our message.
           ClearThreadPaneSelection();
 
-          var msgDB = aTab.msgSelectedFolder.getMsgDatabase(msgWindow);
+          var msgDB = aTab.msgSelectedFolder.msgDatabase;
           var msgHdr = msgDB.getMsgHdrForMessageID(aTab.selectedMsgId);
           setTimeout(gDBView.selectFolderMsgByKey, 0, aTab.msgSelectedFolder,
                      msgHdr.messageKey);
         }
         // We do not clear the selection if there was more than one message
         // displayed.  this leaves our selection intact. there was originally
         // some claim that the selection might lose synchronization with the
         // view, but this is unsubstantiated.  said comment came from the
@@ -2748,17 +2748,17 @@ function OnMsgLoaded(aUrl)
   if (imapServer.storeReadMailInPFC)
   {
     // Look in read mail PFC for msg with same msg id - if we find one,
     // don't put this message in the read mail pfc.
     var outputPFC = imapServer.GetReadMailPFC(true);
 
     if (msgHdr && msgHdr.messageId.length > 0)
     {
-      var readMailDB = outputPFC.getMsgDatabase(msgWindow);
+      var readMailDB = outputPFC.msgDatabase;
       if (readMailDB && readMailDB.getMsgHdrForMessageID(msgHdr.messageId))
         return; // Don't copy to offline folder.
     }
 
     var messages = Components.classes["@mozilla.org/array;1"]
                               .createInstance(Components.interfaces.nsIMutableArray);
     messages.appendElement(msgHdr, false);
     outputPFC.copyMessages(folder, messages, false /*isMove*/,
@@ -2828,17 +2828,17 @@ function HandleMDNResponse(aUrl)
                        msgHdr.messageKey, mimeHdr, false);
 
   // Reset mark msg MDN "Sent" and "Not Needed".
   const MSG_FLAG_MDN_REPORT_NEEDED = 0x400000;
   msgHdr.flags = (msgFlags & ~MSG_FLAG_MDN_REPORT_NEEDED);
   msgHdr.OrFlags(MSG_FLAG_MDN_REPORT_SENT);
 
   // Commit db changes.
-  var msgdb = msgFolder.getMsgDatabase(msgWindow);
+  var msgdb = msgFolder.msgDatabase;
   if (msgdb)
     msgdb.Commit(ADDR_DB_LARGE_COMMIT);
 }
 
 function QuickSearchFocus() 
 {
   var quickSearchTextBox = document.getElementById('searchInput');
   if (quickSearchTextBox)
--- a/mail/base/content/messageWindow.js
+++ b/mail/base/content/messageWindow.js
@@ -369,17 +369,17 @@ function CreateView(originalView)
   {
     viewType = originalView.viewType;
     viewFlags = originalView.viewFlags;
     sortType = originalView.sortType;
     sortOrder = originalView.sortOrder;
   }
   else if (msgFolder)
   {
-    var msgDatabase = msgFolder.getMsgDatabase(msgWindow);
+    var msgDatabase = msgFolder.msgDatabase;
     if (msgDatabase)
     {
       var dbFolderInfo = msgDatabase.dBFolderInfo;
       sortType = dbFolderInfo.sortType;
       sortOrder = dbFolderInfo.sortOrder;
       viewFlags = dbFolderInfo.viewFlags;
       viewType = dbFolderInfo.viewType;
       msgDatabase = null;
@@ -623,17 +623,17 @@ function SelectFolder(folderUri)
 
   if (msgfolder.manyHeadersToDownload)
   {
     gRerootOnFolderLoadForStandAlone = true;
     try
     {
       // accessing the db causes the folder loaded notification to get sent
       // for local folders.
-      var db = msgfolder.getMsgDatabase(msgWindow);
+      var db = msgfolder.msgDatabase;
       msgfolder.startFolderLoading();
       msgfolder.updateFolder(msgWindow);
     }
     catch(ex)
     {
       dump("Error loading with many headers to download: " + ex + "\n");
     }
   }
--- a/mail/base/content/msgMail3PaneWindow.js
+++ b/mail/base/content/msgMail3PaneWindow.js
@@ -258,17 +258,17 @@ var folderListener = {
                 // If the db's view isn't set, something went wrong and we
                 // should reroot the folder, which will re-open the view.
                 if (!gDBView.db)
                   gRerootOnFolderLoad = true;
               }
               if (gRerootOnFolderLoad)
                 RerootFolder(uri, msgFolder, gCurrentLoadingFolderViewType, gCurrentLoadingFolderViewFlags, gCurrentLoadingFolderSortType, gCurrentLoadingFolderSortOrder);
 
-              var db = msgFolder.getMsgDatabase(msgWindow);
+              var db = msgFolder.msgDatabase;
               if (db)
                 db.resetHdrCacheSize(100);
 
               if (gDBView) {
                 gDBView.suppressCommandUpdating = false;
               }
 
               gCurrentLoadingFolderSortType = 0;
@@ -572,18 +572,17 @@ function LoadCurrentlyDisplayedMessage()
 }
 
 function IsCurrentLoadedFolder(folder)
 {
   var msgfolder = folder.QueryInterface(Components.interfaces.nsIMsgFolder);
   var currentLoadedFolder = GetThreadPaneFolder();
   if (currentLoadedFolder.flags & Components.interfaces.nsMsgFolderFlags.Virtual)
   {
-    var msgDatabase = currentLoadedFolder.getMsgDatabase(msgWindow);
-    var dbFolderInfo = msgDatabase.dBFolderInfo;
+    var dbFolderInfo = currentLoadedFolder.msgDatabase.dBFolderInfo;
     var srchFolderUri = dbFolderInfo.getCharProperty("searchFolderUri");
     var re = new RegExp("^" + msgfolder.URI + "$|^" + msgfolder.URI + "\||\|" +
                         msgfolder.URI + "$|\|" + msgfolder.URI +"\|");
 
     return currentLoadedFolder.URI.match(re);
   }
 
   return (currentLoadedFolder.URI == folder.URI);
--- a/mail/base/content/searchBar.js
+++ b/mail/base/content/searchBar.js
@@ -102,23 +102,22 @@ var gSearchNotificationListener =
         gStatusBar.setAttribute("mode","normal");
         gSearchInProgress = false;
 
         // ### TODO need to find out if there's quick search within a virtual folder.
         if (gCurrentVirtualFolderUri &&
          (!gSearchInput || gSearchInput.value == "" || gSearchInput.showingSearchCriteria))
         {
           var vFolder = GetMsgFolderFromUri(gCurrentVirtualFolderUri, false);
-          var dbFolderInfo = vFolder.getMsgDatabase(msgWindow).dBFolderInfo;
+          var dbFolderInfo = vFolder.msgDatabase.dBFolderInfo;
           dbFolderInfo.numUnreadMessages = gNumUnreadMessages;
           dbFolderInfo.numMessages = gNumTotalMessages;
           vFolder.updateSummaryTotals(true); // force update from db.
-          var msgdb = vFolder.getMsgDatabase(msgWindow);
           const MSG_DB_LARGE_COMMIT = 1;
-          msgdb.Commit(MSG_DB_LARGE_COMMIT);
+          vFolder.msgDatabase.Commit(MSG_DB_LARGE_COMMIT);
           // now that we have finished loading a virtual folder,
           // scroll to the correct message if there is at least one.
           if (vFolder.getTotalMessages(false) > 0)
             ScrollToMessageAfterFolderLoad(vFolder);
         }
     },
 
     onNewSearch: function()
@@ -349,17 +348,17 @@ function createSearchTermsWithList(aTerm
   var selectedFolder = GetThreadPaneFolder();
   var ioService = Components.classes["@mozilla.org/network/io-service;1"]
                   .getService(Components.interfaces.nsIIOService);
   
   var termsArray = aTermsArray.QueryInterface(Components.interfaces.nsISupportsArray);
 
   if (gXFVirtualFolderTerms)
   {
-    var msgDatabase = selectedFolder.getMsgDatabase(msgWindow);
+    var msgDatabase = selectedFolder.msgDatabase;
     if (msgDatabase)
     {
       var dbFolderInfo = msgDatabase.dBFolderInfo;
       var srchFolderUri = dbFolderInfo.getCharProperty("searchFolderUri");
       viewDebug("createSearchTermsWithList xf vf scope = " + srchFolderUri + "\n");
       var srchFolderUriArray = srchFolderUri.split('|');
       for (i in srchFolderUriArray) 
       {
--- a/mail/components/search/SpotlightIntegration.js
+++ b/mail/components/search/SpotlightIntegration.js
@@ -163,17 +163,17 @@ let SearchIntegration =
         text = this._xmlEscapeString(text);
         SearchIntegration._log.debug("utf8 text = *****************\n"+ text);
         this._outputStream.write(text, text.length);
         // close out the content, dict, and plist
         this._outputStream.write("</string>\n</dict>\n</plist>\n", 26);
 
         this._msgHdr.setUint32Property(SearchIntegration._hdrIndexedProperty,
                                        1);
-        folder.getMsgDatabase(null).Commit(MSG_DB_LARGE_COMMIT);
+        folder.msgDatabase.Commit(MSG_DB_LARGE_COMMIT);
 
         this._message = "";
       }
       catch (ex) {
         SearchIntegration._log.error(ex);
         this._onDoneStreaming(false);
         return;
       }
--- a/mail/components/search/WinSearchIntegration.js
+++ b/mail/components/search/WinSearchIntegration.js
@@ -302,17 +302,17 @@ let SearchIntegration =
           "Date: " + new Date(this._msgHdr.date / 1000).toUTCString() + CRLF);
         this._outputStream.writeString("Content-Type: " + contentType.value +
                                        "; charset=utf-8" + CRLF + CRLF);
 
         this._outputStream.writeString(text + CRLF + CRLF);
 
         this._msgHdr.setUint32Property(SearchIntegration._hdrIndexedProperty,
                                        1);
-        folder.getMsgDatabase(null).Commit(MSG_DB_LARGE_COMMIT);
+        folder.msgDatabase.Commit(MSG_DB_LARGE_COMMIT);
 
         this._message = "";
         SearchIntegration._log.info("Successfully written file");
       }
       catch (ex) {
         SearchIntegration._log.error(ex);
         this._onDoneStreaming(false);
         return;
--- a/mail/components/search/content/searchCommon.js
+++ b/mail/components/search/content/searchCommon.js
@@ -278,17 +278,17 @@ let SearchSupport =
       this._currentFolderToIndex = null;
   },
 
   _findNextHdrToIndex: function search_find_next_header()
   {
     try
     {
       if (!this._headerEnumerator)
-        this._headerEnumerator = this._currentFolderToIndex.getMessages(null);
+        this._headerEnumerator = this._currentFolderToIndex.messages;
 
       // iterate over the folder finding the next message to index
       while (this._headerEnumerator.hasMoreElements())
       {
         let msgHdr = this._headerEnumerator.getNext()
                          .QueryInterface(Ci.nsIMsgDBHdr);
         if (!msgHdr.getUint32Property(this._hdrIndexedProperty))
           return msgHdr;
--- a/mailnews/base/public/nsIMsgFolder.idl
+++ b/mailnews/base/public/nsIMsgFolder.idl
@@ -62,24 +62,25 @@ interface nsILocalFile;
 interface nsIMsgIdentity;
 interface nsIArray;
 interface nsIMutableArray;
 
 typedef long nsMsgBiffState;
 
 // enumerated type for determining if a message has been replied to, forwarded, etc.
 typedef long nsMsgDispositionState;
-[scriptable, uuid(38444311-d7fb-4fbc-a52e-1899320ce1da)]
+[scriptable, uuid(f64a0335-2b72-4320-89f6-8d57ac5e70ca)]
 interface nsIMsgFolder : nsISupports {
 
   const nsMsgBiffState nsMsgBiffState_NewMail = 0; // User has new mail waiting.
   const nsMsgBiffState nsMsgBiffState_NoMail =  1; // No new mail is waiting.
   const nsMsgBiffState nsMsgBiffState_Unknown = 2; // We dunno whether there is new mail.
 
-  nsISimpleEnumerator getMessages(in nsIMsgWindow aMsgWindow);
+  /// Returns an enumerator containing the messages within the current database.
+  readonly attribute nsISimpleEnumerator messages;
 
   void startFolderLoading();
   void endFolderLoading();
 
   /* get new headers for db */
   void updateFolder(in nsIMsgWindow aWindow);
 
   readonly attribute AString prettiestName;
@@ -437,18 +438,18 @@ interface nsIMsgFolder : nsISupports {
    * one can use getDBFolderInfoAndDB.
    *
    * @exception NS_MSG_ERROR_FOLDER_SUMMARY_MISSING If the database does not
    *                         exist.
    * @exception NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE If the database contains
    *                         out of date information.
    * @see nsIMsgFolder::getDBFolderInfoAndDB.
    */
-  nsIMsgDatabase getMsgDatabase(in nsIMsgWindow msgWindow);
-  void setMsgDatabase (in nsIMsgDatabase msgDatabase);
+  attribute nsIMsgDatabase msgDatabase;
+
   /**
    * Get the backup message database, used in reparsing. This database must
    * be created first using closeAndBackupFolderDB()
    *
    * @return   backup message database
    */
   nsIMsgDatabase getBackupMsgDatabase();
   /**
--- a/mailnews/base/resources/content/commandglue.js
+++ b/mailnews/base/resources/content/commandglue.js
@@ -266,18 +266,17 @@ function isNewsURI(uri)
 
 function RerootFolder(uri, newFolder, viewType, viewFlags, sortType, sortOrder)
 {
   viewDebug("In reroot folder, sortType = " +  sortType + "viewType = " + viewType + "\n");
   if (sortType == 0)
   {
     try
     {
-      var msgdb = newFolder.getMsgDatabase(msgWindow);
-      var dbFolderInfo = msgdb.dBFolderInfo;
+      var dbFolderInfo = newFolder.msgDatabase.dBFolderInfo;
       sortType = dbFolderInfo.sortType;
       sortOrder = dbFolderInfo.sortOrder;
       viewFlags = dbFolderInfo.viewFlags;
       viewType = dbFolderInfo.viewType;
       dbFolderInfo = null;
     }
     catch(ex)
     {
@@ -334,17 +333,17 @@ function RerootFolder(uri, newFolder, vi
   {
     /*disable quick search clear button if we were in the search view on folder switching*/
     disableQuickSearchClearButton();
 
      /*we don't null out the db reference for inbox because inbox is like the "main" folder
        and performance outweighs footprint */
     if (!IsSpecialFolder(oldFolder, nsMsgFolderFlags.Inbox, false))
       if (oldFolder.URI != newFolder.URI)
-        oldFolder.setMsgDatabase(null);
+        oldFolder.msgDatabase = null;
   }
   // that should have initialized gDBView, now re-root the thread pane
   RerootThreadPane();
 
   UpdateLocationBar(gMsgFolderSelected);
 
   UpdateStatusMessageCounts(gMsgFolderSelected);
   
@@ -816,17 +815,17 @@ function FolderPaneSelectionChange()
 //            gSearchInput.showingSearchCriteria = false;
             gCurrentVirtualFolderUri = null;
             // don't get the db if this folder is a server
             // we're going to be display account central
             if (!(msgFolder.isServer)) 
             {
               try 
               {
-                var msgDatabase = msgFolder.getMsgDatabase(msgWindow);
+                var msgDatabase = msgFolder.msgDatabase;
                 if (msgDatabase)
                 {
                   gSearchSession = null;
                   var dbFolderInfo = msgDatabase.dBFolderInfo;
                   sortType = dbFolderInfo.sortType;
                   sortOrder = dbFolderInfo.sortOrder;
                   viewType = dbFolderInfo.viewType;
                   viewFlags = dbFolderInfo.viewFlags;
@@ -854,17 +853,17 @@ function FolderPaneSelectionChange()
                     }
                     else
                     {
                       uriToLoad = srchFolderUri;
                       // we need to load the db for the actual folder so that many hdrs to download
                       // will return false...
                       var realFolderRes = GetResourceFromUri(uriToLoad);
                       var realFolder = realFolderRes.QueryInterface(Components.interfaces.nsIMsgFolder);
-                      msgDatabase = realFolder.getMsgDatabase(msgWindow);
+                      msgDatabase = realFolder.msgDatabase;
 //                      dump("search term string = " + searchTermString + "\n");
                     
                       gVirtualFolderTerms = CreateGroupedSearchTerms(tempFilter.searchTerms);
 //                      gSearchInput.showingSearchCriteria = false;
                     }
                   }
                   msgDatabase = null;
                   dbFolderInfo = null;
@@ -1017,17 +1016,17 @@ function  CreateVirtualFolder(newName, p
 {
   // ### need to make sure view/folder doesn't exist.
   if (searchFolderURIs && (searchFolderURIs != "") && newName && (newName != "")) 
   {
     try
     {
       var newFolder = parentFolder.addSubfolder(newName);
       newFolder.setFlag(Components.interfaces.nsMsgFolderFlags.Virtual);
-      var vfdb = newFolder.getMsgDatabase(msgWindow);
+      var vfdb = newFolder.msgDatabase;
       var searchTermString = getSearchTermString(searchTerms);
       var dbFolderInfo = vfdb.dBFolderInfo;
       // set the view string as a property of the db folder info
       // set the original folder name as well.
       dbFolderInfo.setCharProperty("searchStr", searchTermString);
       dbFolderInfo.setCharProperty("searchFolderUri", searchFolderURIs);
       dbFolderInfo.setBooleanProperty("searchOnline", searchOnline);
       vfdb.summaryValid = true;
--- a/mailnews/base/resources/content/junkCommands.js
+++ b/mailnews/base/resources/content/junkCommands.js
@@ -206,17 +206,17 @@ MessageClassifier.prototype =
       var authorEmailAddress = headerParser.extractHeaderAddressMailboxes(aMsgHdr.author);
       var abCard = false;
       for (var abCount = 0; abCount < aWhiteListDirectories.length; abCount++)
       {
         try {
           if (aWhiteListDirectories[abCount].cardForEmailAddress(authorEmailAddress))
           {
             // message is ham from whitelist
-            var db = aMsgHdr.folder.getMsgDatabase(msgWindow);
+            var db = aMsgHdr.folder.msgDatabase;
             db.setStringProperty(aMsgHdr.messageKey, "junkscore",
                                  Components.interfaces.nsIJunkMailPlugin.IS_HAM_SCORE);
             db.setStringProperty(aMsgHdr.messageKey, "junkscoreorigin", "whitelist");
             this.mGoodMsgHdrs.appendElement(aMsgHdr, false);
             return;
           }
         } catch (e) {}
       }
@@ -254,17 +254,17 @@ MessageClassifier.prototype =
     var score = (aClassification == nsIJunkMailPlugin.JUNK) ?
       nsIJunkMailPlugin.IS_SPAM_SCORE : nsIJunkMailPlugin.IS_HAM_SCORE;
     const statusDisplayInterval = 1000; // milliseconds between status updates
 
     // set these props via the db (instead of the message header
     // directly) so that the nsMsgDBView knows to update the UI
     //
     var msgHdr = this.mMessages[aClassifiedMsgURI];
-    var db = msgHdr.folder.getMsgDatabase(msgWindow);
+    var db = msgHdr.folder.msgDatabase;
     db.setStringProperty(msgHdr.messageKey, "junkscore", score);
     db.setStringProperty(msgHdr.messageKey, "junkscoreorigin", "plugin");
     db.setStringProperty(msgHdr.messageKey, "junkpercent", aJunkPercent);
 
     if (aClassification == nsIJunkMailPlugin.JUNK)
       this.mJunkMsgHdrs.appendElement(msgHdr, false);
     else if (aClassification == nsIJunkMailPlugin.GOOD)
       this.mGoodMsgHdrs.appendElement(msgHdr, false);
@@ -418,17 +418,17 @@ function deleteJunkInFolder()
 {
   MsgJunkMailInfo(true);
 
   // use direct folder commands if possible so we don't mess with the selection
   if ( !(gMsgFolderSelected.flags & Components.interfaces.nsMsgFolderFlags.Virtual) )
   {
     var junkMsgHdrs = Components.classes["@mozilla.org/array;1"]
                                 .createInstance(Components.interfaces.nsIMutableArray);
-    var enumerator = gDBView.msgFolder.getMessages(msgWindow);
+    var enumerator = gDBView.msgFolder.messages;
     while (enumerator.hasMoreElements())
     {
       var msgHdr = enumerator.getNext().QueryInterface(Components.interfaces.nsIMsgDBHdr);
       var junkScore = msgHdr.getStringProperty("junkscore");
       if (junkScore == Components.interfaces.nsIJunkMailPlugin.IS_SPAM_SCORE)
         junkMsgHdrs.appendElement(msgHdr, false);
     }
 
--- a/mailnews/base/resources/content/mailCommands.js
+++ b/mailnews/base/resources/content/mailCommands.js
@@ -498,15 +498,15 @@ function deleteAllInFolder(commandName)
   var iter = folder.subFolders;
   while (iter.hasMoreElements())
     folder.propagateDelete(iter.getNext(), true, msgWindow);
   
   var children = Components.classes["@mozilla.org/array;1"]
                   .createInstance(Components.interfaces.nsIMutableArray);
                   
   // Delete messages.
-  iter = folder.getMessages(msgWindow);
+  iter = folder.messages;
   while (iter.hasMoreElements()) {
     children.appendElement(iter.getNext(), false);
   }
   folder.deleteMessages(children, msgWindow, true, false, null, false); 
   children.clear();
 }
--- a/mailnews/base/resources/content/mailContextMenus.js
+++ b/mailnews/base/resources/content/mailContextMenus.js
@@ -775,17 +775,17 @@ function SearchForMessageIdInSubFolder(f
 
   return messageHeader;
 }
 
 // check folder for corresponding message to given message id
 // return message header if message was found
 function CheckForMessageIdInFolder(folder, messageId)
 {
-  var messageDatabase = folder.getMsgDatabase(msgWindow);
+  var messageDatabase = folder.msgDatabase;
   var messageHeader;
 
   try
   {
     messageHeader = messageDatabase.getMsgHdrForMessageID(messageId);
   }
   catch (ex)
   {
@@ -797,17 +797,17 @@ function CheckForMessageIdInFolder(folde
     gMailSession = Components.classes[mailSessionContractID]
                              .getService(Components.interfaces.nsIMsgMailSession);
   }
 
   const nsMsgFolderFlags = Components.interfaces.nsMsgFolderFlags;
   if (!gMailSession.IsFolderOpenInWindow(folder) &&
       !(folder.flags & (nsMsgFolderFlags.Trash | nsMsgFolderFlags.Inbox)))
   {
-    folder.setMsgDatabase(null);
+    folder.msgDatabase = null;
   }
 
   return messageHeader;
 }
 
 // CreateFilter opens the Message Filters and Filter Rules dialogs.
 //The Filter Rules dialog has focus. The window is prefilled with filtername <email address>
 //Sender condition is selected and the value is prefilled <email address>
--- a/mailnews/base/resources/content/mailWindowOverlay.js
+++ b/mailnews/base/resources/content/mailWindowOverlay.js
@@ -2499,17 +2499,17 @@ function OnMsgLoaded(aUrl)
       // don't put this message in the read mail pfc.
       var outputPFC = imapServer.GetReadMailPFC(true);
 
       if (msgHdr)
       {
         messageID = msgHdr.messageId;
         if (messageID.length > 0)
         {
-          var readMailDB = outputPFC.getMsgDatabase(msgWindow);
+          var readMailDB = outputPFC.msgDatabase;
           if (readMailDB)
           {
             var hdrInDestDB = readMailDB.getMsgHdrForMessageID(messageID);
             if (hdrInDestDB)
               copyToOfflineFolder = false;
           }
         }
       }
@@ -2580,17 +2580,17 @@ function HandleMDNResponse(aUrl)
                                   createInstance(Components.interfaces.nsIMsgMdnGenerator);
   mdnGenerator.process(MDN_DISPOSE_TYPE_DISPLAYED, msgWindow, msgFolder, msgHdr.messageKey, mimeHdr, false);
 
   // Reset mark msg MDN "Sent" and "Not Needed".
   msgHdr.flags = (msgFlags & ~MSG_FLAG_MDN_REPORT_NEEDED);
   msgHdr.OrFlags(MSG_FLAG_MDN_REPORT_SENT);
 
   // Commit db changes.
-  var msgdb = msgFolder.getMsgDatabase(msgWindow);
+  var msgdb = msgFolder.msgDatabase;
   if (msgdb)
     msgdb.Commit(MSG_DB_LARGE_COMMIT);
 }
 
 function MsgSearchMessages()
 {
   var preselectedFolder = null;
   if ("GetFirstSelectedMsgFolder" in window)
--- a/mailnews/base/resources/content/markByDate.js
+++ b/mailnews/base/resources/content/markByDate.js
@@ -103,17 +103,17 @@ function onAccept()
 function markInDatabase( lower, upper )
 {
   var messageFolder;
   var messageDatabase;
   // extract the database
   if ( window.arguments && window.arguments[0] )
   {
     messageFolder = window.arguments[0];
-    messageDatabase = messageFolder.getMsgDatabase( null );
+    messageDatabase = messageFolder.msgDatabase;
   }
 
   if ( !messageDatabase )
   {
     dump( "markByDate::markInDatabase: there /is/ no database to operate on!\n" );
     return;
   }
 
--- a/mailnews/base/resources/content/messageWindow.js
+++ b/mailnews/base/resources/content/messageWindow.js
@@ -363,17 +363,17 @@ function CreateView(originalView)
   {
     viewType = originalView.viewType;
     viewFlags = originalView.viewFlags;
     sortType = originalView.sortType;
     sortOrder = originalView.sortOrder;
   }
   else if (msgFolder)
   {
-    var msgDatabase = msgFolder.getMsgDatabase(msgWindow);
+    var msgDatabase = msgFolder.msgDatabase;
     if (msgDatabase)
     {
       var dbFolderInfo = msgDatabase.dBFolderInfo;
       sortType = dbFolderInfo.sortType;
       sortOrder = dbFolderInfo.sortOrder;
       viewFlags = dbFolderInfo.viewFlags;
       viewType = dbFolderInfo.viewType;
       msgDatabase = null;
--- a/mailnews/base/resources/content/msgMail3PaneWindow.js
+++ b/mailnews/base/resources/content/msgMail3PaneWindow.js
@@ -583,18 +583,17 @@ function IsCurrentLoadedFolder(folder)
   {
     var folderResource = msgfolder.QueryInterface(Components.interfaces.nsIRDFResource);
     if(folderResource)
     {
       var folderURI = folderResource.Value;
       var currentLoadedFolder = GetThreadPaneFolder();
       if (currentLoadedFolder.flags & Components.interfaces.nsMsgFolderFlags.Virtual)
       {
-        var msgDatabase = currentLoadedFolder.getMsgDatabase(msgWindow);
-        var dbFolderInfo = msgDatabase.dBFolderInfo;
+        var dbFolderInfo = currentLoadedFolder.msgDatabase.dBFolderInfo;
         var srchFolderUri = dbFolderInfo.getCharProperty("searchFolderUri");
         var re = new RegExp("^" + folderURI + "$|^" + folderURI + "\||\|" + folderURI + "$|\|" + folderURI +"\|");
         var retval = (currentLoadedFolder.URI.match(re));
         return retval;
 
       }
       var currentURI = currentLoadedFolder.URI;
       return(currentURI == folderURI);
--- a/mailnews/base/resources/content/searchBar.js
+++ b/mailnews/base/resources/content/searchBar.js
@@ -86,21 +86,21 @@ var gSearchNotificationListener =
         gProgressMeter.setAttribute("mode", "normal");
         gSearchInProgress = false;
 
         // ### TODO need to find out if there's quick search within a virtual folder.
         if (gCurrentVirtualFolderUri &&
          (!gSearchInput || gSearchInput.value == "" || gSearchInput.showingSearchCriteria))
         {
           var vFolder = GetMsgFolderFromUri(gCurrentVirtualFolderUri, false);
-          var dbFolderInfo = vFolder.getMsgDatabase(msgWindow).dBFolderInfo;
+          var dbFolderInfo = vFolder.msgDatabase.dBFolderInfo;
           dbFolderInfo.numUnreadMessages = gNumUnreadMessages;
           dbFolderInfo.numMessages = gNumTotalMessages;
           vFolder.updateSummaryTotals(true); // force update from db.
-          var msgdb = vFolder.getMsgDatabase(msgWindow);
+          var msgdb = vFolder.msgDatabase;
           msgdb.Commit(MSG_DB_LARGE_COMMIT);
           // now that we have finished loading a virtual folder,
           // scroll to the correct message if there is at least one.
           if (vFolder.getTotalMessages(false) > 0)
             ScrollToMessageAfterFolderLoad(vFolder);
         }
     },
 
@@ -330,17 +330,17 @@ function createSearchTermsWithList(aTerm
   var searchTerms = gSearchSession.searchTerms;
   var searchTermsArray = searchTerms.QueryInterface(Components.interfaces.nsISupportsArray);
   searchTermsArray.Clear();
 
   var i;
   var selectedFolder = GetThreadPaneFolder();
   if (gXFVirtualFolderTerms)
   {
-    var msgDatabase = selectedFolder.getMsgDatabase(msgWindow);
+    var msgDatabase = selectedFolder.msgDatabase;
     if (msgDatabase)
     {
       var dbFolderInfo = msgDatabase.dBFolderInfo;
       var srchFolderUri = dbFolderInfo.getCharProperty("searchFolderUri");
       viewDebug("createSearchTermsWithList xf vf scope = " + srchFolderUri + "\n");
       var srchFolderUriArray = srchFolderUri.split('|');
       for (i in srchFolderUriArray) 
       {
--- a/mailnews/base/resources/content/virtualFolderProperties.js
+++ b/mailnews/base/resources/content/virtualFolderProperties.js
@@ -129,18 +129,17 @@ function updateOnlineSearchState()
 function InitDialogWithVirtualFolder(aVirtualFolderURI)
 {
   // when editing an existing folder, hide the folder picker that stores the parent location of the folder
   document.getElementById("chooseFolderLocationRow").collapsed = true;
   var folderNameField = document.getElementById("name");
   folderNameField.disabled = true;
 
   var msgFolder = GetMsgFolderFromUri(aVirtualFolderURI);
-  var msgDatabase = msgFolder.getMsgDatabase(msgWindow);
-  var dbFolderInfo = msgDatabase.dBFolderInfo;
+  var dbFolderInfo = msgFolder.msgDatabase.dBFolderInfo;
 
   gSearchFolderURIs = dbFolderInfo.getCharProperty("searchFolderUri");
   var searchTermString = dbFolderInfo.getCharProperty("searchStr");
   document.getElementById('searchOnline').checked = dbFolderInfo.getBooleanProperty("searchOnline", false);
 
   // work around to get our search term string converted into a real array of search terms
   var filterService = Components.classes["@mozilla.org/messenger/services/filters;1"].getService(Components.interfaces.nsIMsgFilterService);
   var filterList = filterService.getTempFilterList(msgFolder);
@@ -181,17 +180,17 @@ function onOK()
 
   if (window.arguments[0].editExistingFolder)
   {
     // update the search terms
     saveSearchTerms(gSearchTermSession.searchTerms, gSearchTermSession);
     var searchTermString = getSearchTermString(gSearchTermSession.searchTerms);
 
     var msgFolder = window.arguments[0].folder;
-    var msgDatabase = msgFolder.getMsgDatabase(msgWindow);
+    var msgDatabase = msgFolder.msgDatabase;
     var dbFolderInfo = msgDatabase.dBFolderInfo;
 
     // set the view string as a property of the db folder info
     // set the original folder name as well.
     dbFolderInfo.setCharProperty("searchStr", searchTermString);
     dbFolderInfo.setCharProperty("searchFolderUri", gSearchFolderURIs);
     dbFolderInfo.setBooleanProperty("searchOnline", searchOnline);
     msgDatabase.Close(true);
--- a/mailnews/base/resources/content/widgetglue.js
+++ b/mailnews/base/resources/content/widgetglue.js
@@ -261,17 +261,17 @@ function MsgFolderProperties()
 
 function RebuildSummaryFile(msgFolder)
 {
   if (msgFolder.locked)
   {
     msgFolder.throwAlertMsg("operationFailedFolderBusy", msgWindow);
     return;
   }
-  var msgDB = msgFolder.getMsgDatabase(msgWindow);
+  var msgDB = msgFolder.msgDatabase;
   msgDB.summaryValid = false;
   try {
     msgFolder.closeAndBackupFolderDB("");
   }
   catch(e) {
     // In a failure, proceed anyway since we're dealing with problems
     msgFolder.ForceDBClosed();
   }
--- a/mailnews/base/search/resources/content/searchWidgets.xml
+++ b/mailnews/base/search/resources/content/searchWidgets.xml
@@ -579,18 +579,17 @@
       <constructor>
         <![CDATA[
             var accountManager = Components.classes["@mozilla.org/messenger/account-manager;1"].getService(Components.interfaces.nsIMsgAccountManager);
             var identity = accountManager.getFirstIdentityForServer(gFilterList.folder.server);
             var rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
             var resource = rdfService.GetResource(identity.stationeryFolder);
             var msgFolder = resource.QueryInterface(Components.interfaces.nsIMsgFolder);
             var msgWindow = GetFilterEditorMsgWindow();
-            var msgDatabase = msgFolder.getMsgDatabase(msgWindow);
-            var enumerator = msgDatabase.EnumerateMessages();
+            var enumerator = msgFolder.msgDatabase.EnumerateMessages();
             var templateListPopup = document.getAnonymousNodes(this)[0].menupopup;
 
             if ( enumerator )
             {
               while (enumerator.hasMoreElements())
               {
                 var header = enumerator.getNext();
                 if (header instanceof Components.interfaces.nsIMsgDBHdr)
--- a/mailnews/base/search/src/nsMsgLocalSearch.cpp
+++ b/mailnews/base/search/src/nsMsgLocalSearch.cpp
@@ -823,17 +823,17 @@ nsMsgSearchOfflineNews::~nsMsgSearchOffl
 nsresult nsMsgSearchOfflineNews::OpenSummaryFile ()
 {
   nsresult err = NS_OK;
   nsCOMPtr <nsIDBFolderInfo>  folderInfo;
   nsCOMPtr <nsIMsgFolder> scopeFolder;
   err = m_scope->GetFolder(getter_AddRefs(scopeFolder));
   // code here used to check if offline store existed, which breaks offline news.
   if (NS_SUCCEEDED(err) && scopeFolder)
-    err = scopeFolder->GetMsgDatabase(nsnull, getter_AddRefs(m_db));
+    err = scopeFolder->GetMsgDatabase(getter_AddRefs(m_db));
   return err;
 }
 
 nsresult nsMsgSearchOfflineNews::ValidateTerms ()
 {
   return nsMsgSearchOfflineMail::ValidateTerms ();
 }
 
--- a/mailnews/base/src/nsMessengerBootstrap.cpp
+++ b/mailnews/base/src/nsMessengerBootstrap.cpp
@@ -256,17 +256,17 @@ nsresult nsMessengerBootstrap::OpenMesse
   NS_ENSURE_SUCCESS(rv, rv);
   nsCOMPtr<nsIMsgFolder> containingFolder;
   containingFolder = do_QueryInterface(res, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
   rv = DiscoverFoldersIfNeeded(containingFolder);
   NS_ENSURE_SUCCESS(rv, rv);
   // once we have the folder uri, open the db and search for the message id.
   nsCOMPtr <nsIMsgDatabase> msgDB;
-  containingFolder->GetMsgDatabase(nsnull, getter_AddRefs(msgDB));
+  containingFolder->GetMsgDatabase(getter_AddRefs(msgDB));
   nsCOMPtr<nsIMsgDBHdr> msgHdr;
   if (msgDB)
     msgDB->GetMsgHdrForMessageID(messageId.get(), getter_AddRefs(msgHdr));
   if (msgHdr)
   {
     nsMsgKey msgKey;
     msgHdr->GetMessageKey(&msgKey);
     rv = OpenMessengerWindowWithUri("mail:messageWindow", folderUri.get(), msgKey);  
--- a/mailnews/base/src/nsMsgAccountManager.cpp
+++ b/mailnews/base/src/nsMsgAccountManager.cpp
@@ -2423,17 +2423,17 @@ VirtualFolderChangeListener::OnHdrProper
   const PRUint32 kRead = 0x2;
   const PRUint32 kNew = 0x4;
   NS_ENSURE_ARG_POINTER(aHdrChanged);
   NS_ENSURE_ARG_POINTER(aStatus);
 
   PRUint32 flags;
   PRBool match;
   nsCOMPtr<nsIMsgDatabase> msgDB;
-  nsresult rv = m_folderWatching->GetMsgDatabase(nsnull, getter_AddRefs(msgDB));
+  nsresult rv = m_folderWatching->GetMsgDatabase(getter_AddRefs(msgDB));
   NS_ENSURE_SUCCESS(rv, rv);
   // we don't want any early returns from this function, until we've
   // called ClearScopes on the search session.
   m_searchSession->AddScopeTerm(nsMsgSearchScope::offlineMail, m_folderWatching);
   rv = m_searchSession->MatchHdr(aHdrChanged, msgDB, &match);
   m_searchSession->ClearScopes();
   NS_ENSURE_SUCCESS(rv, rv);
   aHdrChanged->GetFlags(&flags);
@@ -2503,17 +2503,17 @@ VirtualFolderChangeListener::OnHdrProper
 
   return NS_OK;
 }
 
 NS_IMETHODIMP VirtualFolderChangeListener::OnHdrFlagsChanged(nsIMsgDBHdr *aHdrChanged, PRUint32 aOldFlags, PRUint32 aNewFlags, nsIDBChangeListener *aInstigator)
 {
   nsCOMPtr <nsIMsgDatabase> msgDB;
 
-  nsresult rv = m_folderWatching->GetMsgDatabase(nsnull, getter_AddRefs(msgDB));
+  nsresult rv = m_folderWatching->GetMsgDatabase(getter_AddRefs(msgDB));
   PRBool oldMatch = PR_FALSE, newMatch = PR_FALSE;
   // we don't want any early returns from this function, until we've
   // called ClearScopes 0n the search session.
   m_searchSession->AddScopeTerm(nsMsgSearchScope::offlineMail, m_folderWatching);
   rv = m_searchSession->MatchHdr(aHdrChanged, msgDB, &newMatch);
   if (NS_SUCCEEDED(rv) && m_searchOnMsgStatus)
   {
     // if status is a search criteria, check if the header matched before
@@ -2583,17 +2583,17 @@ NS_IMETHODIMP VirtualFolderChangeListene
   }
   return rv;
 }
 
 NS_IMETHODIMP VirtualFolderChangeListener::OnHdrDeleted(nsIMsgDBHdr *aHdrDeleted, nsMsgKey aParentKey, PRInt32 aFlags, nsIDBChangeListener *aInstigator)
 {
   nsCOMPtr <nsIMsgDatabase> msgDB;
 
-  nsresult rv = m_folderWatching->GetMsgDatabase(nsnull, getter_AddRefs(msgDB));
+  nsresult rv = m_folderWatching->GetMsgDatabase(getter_AddRefs(msgDB));
   NS_ENSURE_SUCCESS(rv, rv);
   PRBool match = PR_FALSE;
   m_searchSession->AddScopeTerm(nsMsgSearchScope::offlineMail, m_folderWatching);
   rv = m_searchSession->MatchHdr(aHdrDeleted, msgDB, &match);
   m_searchSession->ClearScopes();
   if (match)
   {
     nsCOMPtr <nsIMsgDatabase> virtDatabase;
@@ -2624,17 +2624,17 @@ NS_IMETHODIMP VirtualFolderChangeListene
   }
   return rv;
 }
 
 NS_IMETHODIMP VirtualFolderChangeListener::OnHdrAdded(nsIMsgDBHdr *aNewHdr, nsMsgKey aParentKey, PRInt32 aFlags, nsIDBChangeListener *aInstigator)
 {
   nsCOMPtr <nsIMsgDatabase> msgDB;
 
-  nsresult rv = m_folderWatching->GetMsgDatabase(nsnull, getter_AddRefs(msgDB));
+  nsresult rv = m_folderWatching->GetMsgDatabase(getter_AddRefs(msgDB));
   NS_ENSURE_SUCCESS(rv, rv);
   PRBool match = PR_FALSE;
   m_searchSession->AddScopeTerm(nsMsgSearchScope::offlineMail, m_folderWatching);
   rv = m_searchSession->MatchHdr(aNewHdr, msgDB, &match);
   m_searchSession->ClearScopes();
   if (match)
   {
     nsCOMPtr <nsIMsgDatabase> virtDatabase;
@@ -2771,17 +2771,18 @@ NS_IMETHODIMP nsMsgAccountManager::LoadV
               if (parentFolder)
               {
                 nsAutoString currentFolderNameStr;
                 nsCAutoString currentFolderNameCStr;
                 MsgUnescapeString(nsCString(Substring(buffer, lastSlash + 1, buffer.Length())), 0, currentFolderNameCStr);
                 CopyUTF8toUTF16(currentFolderNameCStr, currentFolderNameStr);
                 nsCOMPtr <nsIMsgFolder> childFolder;
                 nsCOMPtr <nsIMsgDatabase> db;
-                virtualFolder->GetMsgDatabase(nsnull, getter_AddRefs(db)); // force db to get created.
+                // force db to get created.
+                virtualFolder->GetMsgDatabase(getter_AddRefs(db));
                 if (db)
                   rv = db->GetDBFolderInfo(getter_AddRefs(dbFolderInfo));
                 else
                   break;
 
                 parentFolder->AddSubfolder(currentFolderNameStr, getter_AddRefs(childFolder));
                 virtualFolder->SetFlag(nsMsgFolderFlags::Virtual);
                 if (childFolder)
--- a/mailnews/base/src/nsMsgDBView.cpp
+++ b/mailnews/base/src/nsMsgDBView.cpp
@@ -3665,17 +3665,17 @@ nsMsgDBView::GetCollationKey(nsIMsgDBHdr
 nsresult
 nsMsgDBView::GetLocationCollationKey(nsIMsgDBHdr *msgHdr, PRUint8 **result, PRUint32 *len)
 {
   nsCOMPtr <nsIMsgFolder> folder;
 
   nsresult rv = msgHdr->GetFolder(getter_AddRefs(folder));
   NS_ENSURE_SUCCESS(rv,rv);
   nsCOMPtr <nsIMsgDatabase> dbToUse;
-  rv = folder->GetMsgDatabase(nsnull, getter_AddRefs(dbToUse));
+  rv = folder->GetMsgDatabase(getter_AddRefs(dbToUse));
   NS_ENSURE_SUCCESS(rv,rv);
 
   nsString locationString;
   rv = folder->GetPrettiestName(locationString);
   NS_ENSURE_SUCCESS(rv,rv);
 
   return dbToUse->CreateCollationKey(locationString, result, len);
 }
@@ -4496,17 +4496,17 @@ nsMsgDBView::GetIndexForThread(nsIMsgDBH
   //to either GetCollationKey or GetLongField
   nsIMsgCustomColumnHandler* colHandler = GetCurColumnHandlerFromDBInfo();
 
   viewSortInfo comparisonContext;
   comparisonContext.view = this;
   comparisonContext.isSecondarySort = PR_FALSE;
   comparisonContext.ascendingSort = (m_sortOrder == nsMsgViewSortOrder::ascending);
   nsCOMPtr <nsIMsgDatabase> hdrDB;
-  EntryInfo1.folder->GetMsgDatabase(nsnull, getter_AddRefs(hdrDB));
+  EntryInfo1.folder->GetMsgDatabase(getter_AddRefs(hdrDB));
   comparisonContext.db = hdrDB.get();
   switch (fieldType)
   {
     case kCollationKey:
       rv = GetCollationKey(msgHdr, m_sortType, &EntryInfo1.key, &EntryInfo1.dword, colHandler);
       NS_ASSERTION(NS_SUCCEEDED(rv),"failed to create collation key");
       break;
     case kU32:
@@ -5016,17 +5016,17 @@ nsMsgDBView::GetThreadRootIndex(nsIMsgDB
   //to either GetCollationKey or GetLongField
   nsIMsgCustomColumnHandler* colHandler = GetCurColumnHandlerFromDBInfo();
 
   viewSortInfo comparisonContext;
   comparisonContext.view = this;
   comparisonContext.isSecondarySort = PR_FALSE;
   comparisonContext.ascendingSort = (m_sortOrder == nsMsgViewSortOrder::ascending);
   nsCOMPtr<nsIMsgDatabase> hdrDB;
-  EntryInfo1.folder->GetMsgDatabase(nsnull, getter_AddRefs(hdrDB));
+  EntryInfo1.folder->GetMsgDatabase(getter_AddRefs(hdrDB));
   comparisonContext.db = hdrDB.get();
   switch (fieldType)
   {
     case kCollationKey:
       rv = GetCollationKey(msgHdr, m_sortType, &EntryInfo1.key, &EntryInfo1.dword, colHandler);
       NS_ASSERTION(NS_SUCCEEDED(rv),"failed to create collation key");
       break;
     case kU32:
@@ -5140,17 +5140,17 @@ void nsMsgDBView::InitEntryInfoForIndex(
   msgHdr->GetMessageKey(&EntryInfo.id);
   msgHdr->GetFolder(&EntryInfo.folder);
   EntryInfo.folder->Release();
   //check if a custom column handler exists. If it does then grab it and pass it in
   //to either GetCollationKey or GetLongField
   nsIMsgCustomColumnHandler* colHandler = GetCurColumnHandlerFromDBInfo();
 
   nsCOMPtr<nsIMsgDatabase> hdrDB;
-  EntryInfo.folder->GetMsgDatabase(nsnull, getter_AddRefs(hdrDB));
+  EntryInfo.folder->GetMsgDatabase(getter_AddRefs(hdrDB));
   switch (fieldType)
   {
     case kCollationKey:
       PR_FREEIF(EntryInfo.key);
       rv = GetCollationKey(msgHdr, m_sortType, &EntryInfo.key, &EntryInfo.dword, colHandler);
       NS_ASSERTION(NS_SUCCEEDED(rv),"failed to create collation key");
       break;
     case kU32:
--- a/mailnews/base/src/nsMsgFolderCompactor.cpp
+++ b/mailnews/base/src/nsMsgFolderCompactor.cpp
@@ -231,17 +231,17 @@ nsFolderCompactState::Compact(nsIMsgFold
            return CompactNextFolder();
          else
            return NS_OK;
        }
      }
    }
    else
    {
-     rv=folder->GetMsgDatabase(nsnull, getter_AddRefs(db));
+     rv = folder->GetMsgDatabase(getter_AddRefs(db));
      NS_ENSURE_SUCCESS(rv, rv);
    }
    rv = folder->GetFilePath(getter_AddRefs(path));
    NS_ENSURE_SUCCESS(rv, rv);
 
    rv = folder->GetBaseMessageURI(baseMessageURI);
    NS_ENSURE_SUCCESS(rv, rv);
     
@@ -712,17 +712,17 @@ nsFolderCompactState::OnDataAvailable(ns
           m_fileStream->Write(statusLine, strlen(statusLine), &bytesWritten);
           m_addedHeaderSize += bytesWritten;
         }
         else
         {
           NS_ASSERTION(PR_FALSE, "not an envelope");
           // try to mark the db as invalid so it will be reparsed.
           nsCOMPtr <nsIMsgDatabase> srcDB;
-          m_folder->GetMsgDatabase(nsnull, getter_AddRefs(srcDB));
+          m_folder->GetMsgDatabase(getter_AddRefs(srcDB));
           if (srcDB)
           {
             srcDB->SetSummaryValid(PR_FALSE);
             srcDB->ForceClosed();
           }
         }
       }
 #define EXTRA_KEYWORD_HDR "                                                                                 "MSG_LINEBREAK
--- a/mailnews/base/src/nsMsgSearchDBView.cpp
+++ b/mailnews/base/src/nsMsgSearchDBView.cpp
@@ -336,18 +336,17 @@ nsresult nsMsgSearchDBView::GetMsgHdrFor
 {
   nsresult rv = NS_MSG_INVALID_DBVIEW_INDEX;
   if (index == nsMsgViewIndex_None || index > (PRUint32) m_folders.Count())
     return rv;
   nsIMsgFolder *folder = m_folders[index];
   if (folder)
   {
     nsCOMPtr <nsIMsgDatabase> db;
-    nsCOMPtr<nsIMsgWindow> msgWindow(do_QueryReferent(mMsgWindowWeak));
-    rv = folder->GetMsgDatabase(msgWindow, getter_AddRefs(db));
+    rv = folder->GetMsgDatabase(getter_AddRefs(db));
     NS_ENSURE_SUCCESS(rv, rv);
     if (db)
       rv = db->GetMsgHdrForKey(m_keys[index], msgHdr);
   }
   return rv;
 }
 
 NS_IMETHODIMP nsMsgSearchDBView::GetFolderForViewIndex(nsMsgViewIndex index, nsIMsgFolder **aFolder)
@@ -359,17 +358,17 @@ NS_IMETHODIMP nsMsgSearchDBView::GetFold
   return NS_OK;
 }
 
 nsresult nsMsgSearchDBView::GetDBForViewIndex(nsMsgViewIndex index, nsIMsgDatabase **db)
 {
   nsCOMPtr <nsIMsgFolder> aFolder;
   nsresult rv = GetFolderForViewIndex(index, getter_AddRefs(aFolder));
   NS_ENSURE_SUCCESS(rv, rv);
-  return aFolder->GetMsgDatabase(nsnull, db);
+  return aFolder->GetMsgDatabase(db);
 }
 
 nsresult nsMsgSearchDBView::AddHdrFromFolder(nsIMsgDBHdr *msgHdr, nsIMsgFolder *folder)
 {
   if (m_viewFlags & nsMsgViewFlagsType::kGroupBySort)
     return nsMsgGroupView::OnNewHeader(msgHdr, nsMsgKey_None, PR_TRUE);
   nsMsgKey msgKey;
   PRUint32 msgFlags;
@@ -1240,17 +1239,17 @@ nsresult nsMsgSearchDBView::GetThreadCon
   else if (m_viewFlags & nsMsgViewFlagsType::kThreadedDisplay)
     return GetXFThreadFromMsgHdr(msgHdr, pThread);
 
   // if not threaded, use the real thread. 
   nsCOMPtr<nsIMsgFolder> folder;
   nsresult rv = msgHdr->GetFolder(getter_AddRefs(folder));
   NS_ENSURE_SUCCESS(rv, rv);
   nsCOMPtr<nsIMsgDatabase> msgDB;
-  rv = folder->GetMsgDatabase(nsnull, getter_AddRefs(msgDB));
+  rv = folder->GetMsgDatabase(getter_AddRefs(msgDB));
   NS_ENSURE_SUCCESS(rv, rv);
   return msgDB->GetThreadContainingMsgHdr(msgHdr, pThread);
 }
 
 nsresult 
 nsMsgSearchDBView::ListIdsInThread(nsIMsgThread *threadHdr, 
                                    nsMsgViewIndex startOfThreadViewIndex, 
                                    PRUint32 *pNumListed)
--- a/mailnews/base/src/nsMsgXFViewThread.cpp
+++ b/mailnews/base/src/nsMsgXFViewThread.cpp
@@ -293,17 +293,17 @@ nsresult nsMsgXFViewThread::AddHdr(nsIMs
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgXFViewThread::GetChildAt(PRInt32 aIndex, nsIMsgDBHdr **aResult)
 {
   if (aIndex >= (PRInt32) m_keys.Length())
     return NS_MSG_MESSAGE_NOT_FOUND;
   nsCOMPtr<nsIMsgDatabase> db;
-  nsresult rv = m_folders[aIndex]->GetMsgDatabase(nsnull, getter_AddRefs(db));
+  nsresult rv = m_folders[aIndex]->GetMsgDatabase(getter_AddRefs(db));
   NS_ENSURE_SUCCESS(rv, rv);
   return db->GetMsgHdrForKey(m_keys[aIndex], aResult);
 }
 
 NS_IMETHODIMP nsMsgXFViewThread::GetChildHdrAt(PRInt32 aIndex, nsIMsgDBHdr **aResult)
 {
   return GetChildAt(aIndex, aResult);
 }
@@ -487,17 +487,17 @@ NS_IMETHODIMP nsMsgXFViewThread::GetFirs
     rv = GetChildHdrAt(childIndex, getter_AddRefs(child));
     if (NS_SUCCEEDED(rv) && child)
     {
       nsMsgKey msgKey;
       child->GetMessageKey(&msgKey);
       
       PRBool isRead;
       nsCOMPtr<nsIMsgDatabase> db;
-      nsresult rv = m_folders[childIndex]->GetMsgDatabase(nsnull, getter_AddRefs(db));
+      nsresult rv = m_folders[childIndex]->GetMsgDatabase(getter_AddRefs(db));
       if (NS_SUCCEEDED(rv))
         rv = db->IsRead(msgKey, &isRead);
       if (NS_SUCCEEDED(rv) && !isRead)
       {
         NS_ADDREF(*aResult = child);
         break;
       }
     }
--- a/mailnews/base/src/nsMsgXFVirtualFolderDBView.cpp
+++ b/mailnews/base/src/nsMsgXFVirtualFolderDBView.cpp
@@ -215,17 +215,17 @@ nsresult nsMsgXFVirtualFolderDBView::Ins
   // as NoteChange() will call RowCountChanged() which will call our GetRowCount()
   NoteChange(insertIndex, 1, nsMsgViewNotificationCode::insertOrDelete);
   return NS_OK;
 }
 
 void nsMsgXFVirtualFolderDBView::UpdateCacheAndViewForFolder(nsIMsgFolder *folder, nsMsgKey *newHits, PRUint32 numNewHits)
 {
   nsCOMPtr <nsIMsgDatabase> db;
-  nsresult rv = folder->GetMsgDatabase(nsnull, getter_AddRefs(db));
+  nsresult rv = folder->GetMsgDatabase(getter_AddRefs(db));
   if (NS_SUCCEEDED(rv) && db)
   {
     nsCString searchUri;
     m_viewFolder->GetURI(searchUri);
     PRUint32 numBadHits;
     nsMsgKey *badHits;
     rv = db->RefreshCache(searchUri.get(), numNewHits, newHits,
                      &numBadHits, &badHits);
@@ -415,17 +415,17 @@ nsMsgXFVirtualFolderDBView::OnNewSearch(
     nsCOMPtr<nsIMsgFolder> searchFolder;
     searchSession->GetNthSearchScope(i, &scopeId, getter_AddRefs(searchFolder));
     if (searchFolder)
     {
       nsCOMPtr<nsISimpleEnumerator> cachedHits;
       nsCOMPtr<nsIMsgDatabase> searchDB;
       nsCString searchUri;
       m_viewFolder->GetURI(searchUri);
-      nsresult rv = searchFolder->GetMsgDatabase(nsnull, getter_AddRefs(searchDB));
+      nsresult rv = searchFolder->GetMsgDatabase(getter_AddRefs(searchDB));
       if (NS_SUCCEEDED(rv) && searchDB)
       {
         if (msgDBService)
           msgDBService->RegisterPendingListener(searchFolder, this);
 
         m_foldersSearchingOver.AppendObject(searchFolder);
         searchDB->GetCachedHits(searchUri.get(), getter_AddRefs(cachedHits));
         PRBool hasMore;
--- a/mailnews/base/test/unit/test_bug428427.js
+++ b/mailnews/base/test/unit/test_bug428427.js
@@ -153,17 +153,17 @@ var searchListener =
     //print("Search hit, isRead is " + dbHdr.isRead);
     numTotalMessages++;
     if (!dbHdr.isRead)
       numUnreadMessages++;
   },
   onSearchDone: function(status)
   { 
     print("Finished search hitCount = " + numTotalMessages);
-    var db = virtualFolder.getMsgDatabase(null);
+    var db = virtualFolder.msgDatabase;
     var dbFolderInfo = db.dBFolderInfo;
     dbFolderInfo.numMessages = numTotalMessages;
     dbFolderInfo.numUnreadMessages = numUnreadMessages;
     virtualFolder.updateSummaryTotals(true);
     print("virtual folder unread is " + virtualFolder.getNumUnread(false));
     testVirtualFolder();
   }
 };
@@ -201,17 +201,17 @@ function testVirtualFolder()
 
 // helper functions
 
 // adapted from commandglue.js
 function CreateVirtualFolder(newName, parentFolder, searchFolderURIs, searchTerm, searchOnline)
 {
   var newFolder = parentFolder.addSubfolder(newName);
   newFolder.setFlag(Ci.nsMsgFolderFlags.Virtual);
-  var vfdb = newFolder.getMsgDatabase(null);
+  var vfdb = newFolder.msgDatabase;
   var searchTerms = [];
   var searchTermString = getSearchTermString(searchTerm);
   
   var dbFolderInfo = vfdb.dBFolderInfo;
   // set the view string as a property of the db folder info
   // set the original folder name as well.
   dbFolderInfo.setCharProperty("searchStr", searchTermString);
   dbFolderInfo.setCharProperty("searchFolderUri", searchFolderURIs);
--- a/mailnews/base/test/unit/test_folderCompact.js
+++ b/mailnews/base/test/unit/test_folderCompact.js
@@ -88,17 +88,17 @@ function deleteMessages(srcFolder, items
     array.appendElement(item, false);
   });
   
   srcFolder.deleteMessages(array, null, false, true, copyListener, true);
 }
 
 function calculateFolderSize(folder)
 {
-  let msgDB = folder.getMsgDatabase(null);
+  let msgDB = folder.msgDatabase;
   let enumerator = msgDB.EnumerateMessages();
   let totalSize = 0;
   if (enumerator)
   {
     while (enumerator.hasMoreElements())
     {
       var header = enumerator.getNext();
       if (header instanceof Components.interfaces.nsIMsgDBHdr)
@@ -123,17 +123,17 @@ const gTestArray =
   // Moving/copying messages
   function testCopyMessages1() { copyMessages([gMsgHdrs[0].hdr], false, gLocalInboxFolder, gLocalFolder2); },
   function testCopyMessages2() { copyMessages([gMsgHdrs[1].hdr, gMsgHdrs[2].hdr], false, gLocalInboxFolder, gLocalFolder2); },
   function testMoveMessages1() { copyMessages([gMsgHdrs[0].hdr, gMsgHdrs[1].hdr], true, gLocalInboxFolder, gLocalFolder3); },
 
   // Deleting messages
   function testDeleteMessages1() { // delete to trash
     // Let's take a moment to re-initialize stuff that got moved
-    var folder3DB = gLocalFolder3.getMsgDatabase(null);
+    var folder3DB = gLocalFolder3.msgDatabase;
     gMsgHdrs[0].hdr = folder3DB.getMsgHdrForMessageID(gMsgHdrs[0].ID);
 
     // Now delete the message
     deleteMessages(gLocalFolder3, [gMsgHdrs[0].hdr], false, false);
   },
   function compactFolder()
   {
     gExpectedFolderSize = calculateFolderSize(gLocalFolder3);
--- a/mailnews/base/test/unit/test_nsIMsgFolderListenerLocal.js
+++ b/mailnews/base/test/unit/test_nsIMsgFolderListenerLocal.js
@@ -152,41 +152,42 @@ const gTestArray =
 
   // Moving/copying messages
   function testCopyMessages1() { copyMessages([gMsgHdrs[0].hdr], false, gLocalInboxFolder, gLocalFolder2); },
   function testCopyMessages2() { copyMessages([gMsgHdrs[1].hdr, gMsgHdrs[2].hdr], false, gLocalInboxFolder, gLocalFolder2); },
   function testMoveMessages1() { copyMessages([gMsgHdrs[0].hdr, gMsgHdrs[1].hdr], true, gLocalInboxFolder, gLocalFolder3); },
   function testMoveMessages2() { copyMessages([gMsgHdrs[2].hdr], true, gLocalInboxFolder, gLocalTrashFolder); },
   function testMoveMessages3() {
     // This is to test whether the notification is correct for moving from trash
-    gMsgHdrs[2].hdr = gLocalTrashFolder.getMsgDatabase(null).getMsgHdrForMessageID(gMsgHdrs[2].ID);
+    gMsgHdrs[2].hdr = gLocalTrashFolder.msgDatabase
+                                       .getMsgHdrForMessageID(gMsgHdrs[2].ID);
     copyMessages([gMsgHdrs[2].hdr], true, gLocalTrashFolder, gLocalFolder3);
   },
 
   // Moving/copying folders
   function testCopyFolder1() { copyFolders([gLocalFolder3], false, gLocalFolder2); },
   function testMoveFolder1() { copyFolders([gLocalFolder3], true, gLocalInboxFolder); },
   function testMoveFolder2() { copyFolders([gLocalFolder2], true, gLocalInboxFolder); },
 
   // Deleting messages
   function testDeleteMessages1() { // delete to trash
     // Let's take a moment to re-initialize stuff that got moved
     gLocalFolder2 = gLocalInboxFolder.getChildNamed("folder2");
     gLocalFolder3 = gLocalFolder2.getChildNamed("folder3");
-    var folder3DB = gLocalFolder3.getMsgDatabase(null);
+    var folder3DB = gLocalFolder3.msgDatabase;
     for (var i = 0; i < gMsgHdrs.length; i++)
       gMsgHdrs[i].hdr = folder3DB.getMsgHdrForMessageID(gMsgHdrs[i].ID);
 
     // Now delete the message
     deleteMessages(gLocalFolder3, [gMsgHdrs[0].hdr, gMsgHdrs[1].hdr], false, false);
   },
   // shift delete
   function testDeleteMessages2() { deleteMessages(gLocalFolder3, [gMsgHdrs[2].hdr], true, false); },
   function testDeleteMessages3() { // normal delete from trash
-    var trashDB = gLocalTrashFolder.getMsgDatabase(null);
+    var trashDB = gLocalTrashFolder.msgDatabase;
     for (var i = 0; i < gMsgHdrs.length; i++)
       gMsgHdrs[i].hdr = trashDB.getMsgHdrForMessageID(gMsgHdrs[i].ID);
     deleteMessages(gLocalTrashFolder, [gMsgHdrs[0].hdr], false, false);
   },
   // shift delete from trash
   function testDeleteMessages4() { deleteMessages(gLocalTrashFolder, [gMsgHdrs[1].hdr], true, false); },
 
   // Renaming folders
--- a/mailnews/base/util/nsMsgDBFolder.cpp
+++ b/mailnews/base/util/nsMsgDBFolder.cpp
@@ -876,18 +876,17 @@ nsresult nsMsgDBFolder::CreateFileForDB(
   proposedDBName.SetLength(proposedDBName.Length() - NS_LITERAL_CSTRING(SUMMARY_SUFFIX).Length());
   dbPath->SetNativeLeafName(proposedDBName);
 
   dbPath.swap(*dbFile);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsMsgDBFolder::GetMsgDatabase(nsIMsgWindow *aMsgWindow,
-                              nsIMsgDatabase** aMsgDatabase)
+nsMsgDBFolder::GetMsgDatabase(nsIMsgDatabase** aMsgDatabase)
 {
   NS_ENSURE_ARG_POINTER(aMsgDatabase);
   GetDatabase();
   if (!mDatabase)
     return NS_ERROR_FAILURE;
   NS_ADDREF(*aMsgDatabase = mDatabase);
   return NS_OK;
 }
@@ -1879,17 +1878,17 @@ nsMsgDBFolder::GetDBTransferInfo(nsIDBFo
 }
 
 NS_IMETHODIMP
 nsMsgDBFolder::SetDBTransferInfo(nsIDBFolderInfo *aTransferInfo)
 {
   NS_ENSURE_ARG(aTransferInfo);
   nsCOMPtr <nsIDBFolderInfo> dbFolderInfo;
   nsCOMPtr <nsIMsgDatabase> db;
-  GetMsgDatabase(nsnull, getter_AddRefs(db));
+  GetMsgDatabase(getter_AddRefs(db));
   if (db)
   {
     db->GetDBFolderInfo(getter_AddRefs(dbFolderInfo));
     if(dbFolderInfo)
       dbFolderInfo->InitFromTransferInfo(aTransferInfo);
     db->SetSummaryValid(PR_TRUE);
   }
   return NS_OK;
@@ -2484,17 +2483,17 @@ NS_IMETHODIMP nsMsgDBFolder::GetParentMs
 {
   NS_ENSURE_ARG_POINTER(aParentMsgFolder);
   nsCOMPtr<nsIMsgFolder> parent = do_QueryReferent(mParent);
   parent.swap(*aParentMsgFolder);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsMsgDBFolder::GetMessages(nsIMsgWindow *aMsgWindow, nsISimpleEnumerator* *result)
+nsMsgDBFolder::GetMessages(nsISimpleEnumerator **result)
 {
   // XXX should this return an empty enumeration?
   return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 nsMsgDBFolder::UpdateFolder(nsIMsgWindow *)
 {
@@ -4543,17 +4542,17 @@ NS_IMETHODIMP nsMsgDBFolder::EnableNotif
   {
     mNotifyCountChanges = enable;
     // start and stop db batching here. This is under the theory
     // that any time we want to enable and disable notifications,
     // we're probably doing something that should be batched.
     nsCOMPtr <nsIMsgDatabase> database;
 
     if (dbBatching)  //only if we do dbBatching we need to get db
-      GetMsgDatabase(nsnull, getter_AddRefs(database));
+      GetMsgDatabase(getter_AddRefs(database));
 
     if (enable)
     {
       if (database)
         database->EndBatch();
       UpdateSummaryTotals(PR_TRUE);
     }
     else if (database)
@@ -4562,17 +4561,17 @@ NS_IMETHODIMP nsMsgDBFolder::EnableNotif
   }
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP nsMsgDBFolder::GetMessageHeader(nsMsgKey msgKey, nsIMsgDBHdr **aMsgHdr)
 {
   NS_ENSURE_ARG_POINTER(aMsgHdr);
   nsCOMPtr <nsIMsgDatabase> database;
-  nsresult rv = GetMsgDatabase(nsnull, getter_AddRefs(database));
+  nsresult rv = GetMsgDatabase(getter_AddRefs(database));
   NS_ENSURE_SUCCESS(rv, rv);
   return (database) ? database->GetMsgHdrForKey(msgKey, aMsgHdr) : NS_ERROR_FAILURE;
 }
 
 // this gets the deep sub-folders too, e.g., the children of the children
 NS_IMETHODIMP nsMsgDBFolder::ListDescendents(nsISupportsArray *descendents)
 {
   NS_ENSURE_ARG(descendents);
--- a/mailnews/base/util/nsMsgTxn.cpp
+++ b/mailnews/base/util/nsMsgTxn.cpp
@@ -316,17 +316,17 @@ nsMsgTxn::SetTransactionType(PRUint32 tx
 /*none of the callers pass null aFolder, 
   we always initialize aResult (before we pass in) for the case where the key is not in the db*/
 nsresult 
 nsMsgTxn::CheckForToggleDelete(nsIMsgFolder *aFolder, const nsMsgKey &aMsgKey, PRBool *aResult)
 {
   NS_ENSURE_ARG(aResult);
   nsCOMPtr<nsIMsgDBHdr> message;
   nsCOMPtr<nsIMsgDatabase> db;
-  nsresult rv = aFolder->GetMsgDatabase(nsnull,getter_AddRefs(db));
+  nsresult rv = aFolder->GetMsgDatabase(getter_AddRefs(db));
   if (db)
   {
     PRBool containsKey;
     rv = db->ContainsKey(aMsgKey, &containsKey);
     if (NS_FAILED(rv) || !containsKey)   // the message has been deleted from db, so we cannot do toggle here
       return NS_OK;
     rv = db->GetMsgHdrForKey(aMsgKey, getter_AddRefs(message));
     PRUint32 flags;
--- a/mailnews/compose/src/nsMsgCompose.cpp
+++ b/mailnews/compose/src/nsMsgCompose.cpp
@@ -1808,17 +1808,17 @@ nsresult nsMsgCompose::CreateMessage(con
         msgHdr->GetNumReferences(&numRef);
         if (numRef) {
           // If there are references, look for the first message in the thread
           // firstly, get the database via the folder
           nsCOMPtr<nsIMsgFolder> folder;
           msgHdr->GetFolder(getter_AddRefs(folder));
           if (folder) {
             nsCOMPtr<nsIMsgDatabase> db;
-            folder->GetMsgDatabase(nsnull, getter_AddRefs(db));
+            folder->GetMsgDatabase(getter_AddRefs(db));
 
             if (db) {
               nsCAutoString reference;
               msgHdr->GetStringReference(0, reference);
 
               nsCOMPtr<nsIMsgDBHdr> refHdr;
               db->GetMsgHdrForMessageID(reference.get(), getter_AddRefs(refHdr));
 
@@ -3049,17 +3049,17 @@ NS_IMETHODIMP nsMsgCompose::RememberQueu
           nsCOMPtr <nsIRDFResource> resource;
           rv = rdfService->GetResource(m_folderName, getter_AddRefs(resource));
           NS_ENSURE_SUCCESS(rv, rv);
 
           nsCOMPtr <nsIMsgFolder> msgFolder(do_QueryInterface(resource));
           if (msgFolder)
           {
             nsCOMPtr <nsIMsgDatabase> msgDB;
-            msgFolder->GetMsgDatabase(nsnull, getter_AddRefs(msgDB));
+            msgFolder->GetMsgDatabase(getter_AddRefs(msgDB));
             if (msgDB)
             {
               msgDB->CreateNewHdr(msgKey, getter_AddRefs(msgHdr));
               if (msgHdr)
               {
                 nsCString messageId;
                 mMsgSend->GetMessageId(messageId);
                 msgHdr->SetMessageId(messageId.get());
--- a/mailnews/compose/src/nsMsgComposeService.cpp
+++ b/mailnews/compose/src/nsMsgComposeService.cpp
@@ -1159,17 +1159,17 @@ NS_IMETHODIMP nsMsgComposeService::Reply
   nsCString templateMsgHdrUri;
   const char * query = PL_strstr(templateUri, "?messageId=");
   if (!query)
     return NS_ERROR_FAILURE;
 
   nsCAutoString folderUri(Substring(templateUri, query)); 
   nsresult rv = GetExistingFolder(folderUri, getter_AddRefs(templateFolder));
   NS_ENSURE_SUCCESS(rv, rv);
-  rv = templateFolder->GetMsgDatabase(aMsgWindow, getter_AddRefs(templateDB));
+  rv = templateFolder->GetMsgDatabase(getter_AddRefs(templateDB));
   NS_ENSURE_SUCCESS(rv, rv);
 
   const char *subject = PL_strstr(templateUri, "&subject=");
   if (subject)
   {
     const char *subjectEnd = subject + strlen(subject);
     nsCAutoString messageId(Substring(query + 11, subject));
     nsCAutoString subjectString(Substring(subject + 9, subjectEnd));
--- a/mailnews/compose/src/nsMsgSendLater.cpp
+++ b/mailnews/compose/src/nsMsgSendLater.cpp
@@ -664,17 +664,17 @@ nsMsgSendLater::SendUnsentMessages(nsIMs
   nsresult rv = GetUnsentMessagesFolder(aIdentity,
                                         getter_AddRefs(mMessageFolder));
   NS_ENSURE_SUCCESS(rv, rv);
 
   m_window = aWindow;
 
   // ### fix me - if we need to reparse the folder, this will be asynchronous
   nsCOMPtr<nsISimpleEnumerator> enumerator;
-  rv = mMessageFolder->GetMessages(m_window, getter_AddRefs(enumerator));
+  rv = mMessageFolder->GetMessages(getter_AddRefs(enumerator));
   NS_ENSURE_SUCCESS(rv, rv);
 
   // copy all the elements in the enumerator into our isupports array....
 
   nsCOMPtr<nsISupports>   currentItem;
   PRBool hasMoreElements = PR_FALSE;
   while (NS_SUCCEEDED(enumerator->HasMoreElements(&hasMoreElements)) && hasMoreElements)
   {
--- a/mailnews/db/gloda/modules/datamodel.js
+++ b/mailnews/db/gloda/modules/datamodel.js
@@ -346,17 +346,17 @@ GlodaFolder.prototype = {
     //  recently than the acceptably old threshold.
     if (this._activeHeaderRetrievalLastStamp > acceptablyOld)
       return false;
     
     if (this._xpcomFolder) {
       // This is the key action we take; the nsIMsgFolder will continue to
       //  exist, but we want it to forget about its database so that it can
       //  be closed and its memory can be reclaimed.
-      this._xpcomFolder.setMsgDatabase(null);
+      this._xpcomFolder.msgDatabase = null;
       this._xpcomFolder = null;
       // since the last retrieval time tracks whether we have marked live or
       //  not, this needs to be reset to 0 too.
       this._activeHeaderRetrievalLastStamp = 0;
     }
     
     return true;
   },
--- a/mailnews/db/gloda/modules/indexer.js
+++ b/mailnews/db/gloda/modules/indexer.js
@@ -867,17 +867,17 @@ var GlodaIndexer = {
         this._pendingFolderEntry = this._indexingFolder;
         this._pendingFolderWantsIterator = aNeedIterator;
         return this.kWorkAsync;
       }
       // we get an nsIMsgDatabase out of this (unsurprisingly) which
       //  explicitly inherits from nsIDBChangeAnnouncer, which has the
       //  AddListener call we want.
       if (this._indexingDatabase == null)
-        this._indexingDatabase = this._indexingFolder.getMsgDatabase(null);
+        this._indexingDatabase = this._indexingFolder.msgDatabase;
       if (aNeedIterator)
         this._indexerGetIterator();
       this._indexingDatabase.AddListener(this._databaseAnnouncerListener);
     }
     catch (ex) {
       this._log.error("Problem entering folder: " +
                       (this._indexingFolder ?
                          this._indexingFolder.prettiestName : "unknown") + 
@@ -900,17 +900,17 @@ var GlodaIndexer = {
   /**
    * If the folder was still parsing/updating when we tried to enter, then this
    *  handler will get called by the listener who got the FolderLoaded message.
    * All we need to do is get the database reference, register a listener on
    *  the db, and retrieve an iterator if desired.
    */
   _indexerCompletePendingFolderEntry:
       function gloda_indexer_indexerCompletePendingFolderEntry() {
-    this._indexingDatabase = this._indexingFolder.getMsgDatabase(null);
+    this._indexingDatabase = this._indexingFolder.msgDatabase;
     if (this._pendingFolderWantsIterator)
       this._indexerGetIterator();
     this._indexingDatabase.AddListener(this._databaseAnnouncerListener);
     this._log.debug("...Folder Loaded!");
 
     // the load is no longer pending; we certainly don't want more notifications 
     this._pendingFolderEntry = null;
     // indexerEnterFolder returned kWorkAsync, which means we need to notify
@@ -1820,17 +1820,17 @@ var GlodaIndexer = {
 
             for (let iMsgHdr = 0; iMsgHdr < aSrcMsgHdrs.length; iMsgHdr++) {
               let msgHdr = aSrcMsgHdrs.queryElementAt(iMsgHdr, Ci.nsIMsgDBHdr);
               // (note: collissions on message-id headers are possible and sad)
               srcMsgIdToHdr[msgHdr.messageId] = msgHdr;
             }
             let glodaIds = [];
             let newMessageKeys = [];
-            for each (let destMsgHdr in fixIterator(aDestFolder.getMessages(null),
+            for each (let destMsgHdr in fixIterator(aDestFolder.messages,
                                                     Ci.nsIMsgDBHdr)) {
               let destMsgId = destMsgHdr.messageId;
               let matchingSrcHdr = srcMsgIdToHdr[destMsgId];
               if (matchingSrcHdr) {
                 try {
                   let glodaId = matchingSrcHdr.getUint32Property(
                     this.indexer.GLODA_MESSAGE_ID_PROPERTY); 
                   glodaIds.push(glodaId);
--- a/mailnews/extensions/mailviews/resources/content/msgViewPickerOverlay.js
+++ b/mailnews/extensions/mailviews/resources/content/msgViewPickerOverlay.js
@@ -174,17 +174,17 @@ function UpdateViewPicker(aValue, aLabel
     viewPicker.setAttribute("label", aLabel);
   }
 }
 
 function GetFolderInfo(aFolder)
 {
   if (aFolder)
   {
-    var db = aFolder.getMsgDatabase(msgWindow);
+    var db = aFolder.msgDatabase;
     if (db)
       return db.dBFolderInfo;
   }
   return null;
 }
 
 
 function GetMailViewForFolder(aFolder)
--- a/mailnews/extensions/newsblog/content/feed-subscriptions.js
+++ b/mailnews/extensions/newsblog/content/feed-subscriptions.js
@@ -378,17 +378,18 @@ var gFeedSubscriptionsWindow = {
     return folderObject;
   },
 
   getFeedsInFolder: function (aFolder)
   {
     var feeds = new Array();
     try
     {
-      var msgdb = aFolder.QueryInterface(Components.interfaces.nsIMsgFolder).getMsgDatabase(null);
+      var msgdb = aFolder.QueryInterface(Components.interfaces.nsIMsgFolder)
+                         .msgDatabase;
       var folderInfo = msgdb.dBFolderInfo;
       var feedurls = folderInfo.getCharProperty("feedUrl");
       var feedUrlArray = feedurls.split("|");
       for (url in feedUrlArray)
       {
         if (!feedUrlArray[url])
           continue;
         var feedResource  = rdf.GetResource(feedUrlArray[url]);
@@ -592,17 +593,17 @@ var gFeedSubscriptionsWindow = {
     // view layer. Start by removing the child from its parent folder object
     this.mView.removeItemAtIndex(seln.currentIndex);
 
     // If we don't have any more subscriptions pointing into
     // this folder, then I think we should offer to delete it...
     // Cheat and look at the feed url property to see if anyone else is still using the feed...
     // you could also accomplish this by looking at some properties in the data source...
 
-//    var msgdb = currentFolder.QueryInterface(Components.interfaces.nsIMsgFolder).getMsgDatabase(null);
+//    var msgdb = currentFolder.QueryInterface(Components.interfaces.nsIMsgFolder).msgDatabase;
 //   var folderInfo = msgdb.dBFolderInfo;
 //    var oldFeedUrl = folderInfo.getCharProperty("feedUrl");
 
 //    if (!oldFeedUrl) // no more feeds pointing to the folder?
 //    {
 //      try {
 //        var openerResource = this.mRSSServer.rootMsgFolder.QueryInterface(Components.interfaces.nsIRDFResource);
 //        var folderResource = currentFolder.QueryInterface(Components.interfaces.nsIRDFResource);
--- a/mailnews/extensions/newsblog/content/utils.js
+++ b/mailnews/extensions/newsblog/content/utils.js
@@ -128,17 +128,18 @@ function addFeed(url, title, destFolder)
 }
 
 // updates the "feedUrl" property in the message database for the folder in question.
 
 var kFeedUrlDelimiter = '|'; // the delimiter used to delimit feed urls in the msg folder database "feedUrl" property
 
 function updateFolderFeedUrl(aFolder, aFeedUrl, aRemoveUrl)
 {
-  var msgdb = aFolder.QueryInterface(Components.interfaces.nsIMsgFolder).getMsgDatabase(null);
+  var msgdb = aFolder.QueryInterface(Components.interfaces.nsIMsgFolder)
+                     .msgDatabase;
   var folderInfo = msgdb.dBFolderInfo;
   var oldFeedUrl = folderInfo.getCharProperty("feedUrl");
 
   if (aRemoveUrl)
   {
     // remove our feed url string from the list of feed urls
     var newFeedUrl = oldFeedUrl.replace(kFeedUrlDelimiter + aFeedUrl, "");
     folderInfo.setCharProperty("feedUrl", newFeedUrl);
--- a/mailnews/extensions/newsblog/js/newsblog.js
+++ b/mailnews/extensions/newsblog/js/newsblog.js
@@ -67,17 +67,17 @@ var nsNewsBlogFeedDownloader =
           concatenatedUris += "|";
         concatenatedUris += uri;
       }
       if (concatenatedUris.length > 0)
       {
         aUrl = concatenatedUris;
         try
         {
-          var msgdb = aFolder.getMsgDatabase(null);
+          var msgdb = aFolder.msgDatabase;
           var folderInfo = msgdb.dBFolderInfo;
           folderInfo.setCharProperty("feedUrl", concatenatedUris);
         }
         catch (ex) {dump(ex);}
       }
     }
     // aUrl may be a delimited list of feeds for a particular folder. We need to kick off a download
     // for each feed.
@@ -194,17 +194,18 @@ var nsNewsBlogFeedDownloader =
   },
 
   updateSubscriptionsDS: function(aFolder, aUnsubscribe)
   {
     if (!gExternalScriptsLoaded)
       loadScripts();
 
     // an rss folder was just renamed...we need to update our feed data source
-    var msgdb = aFolder.QueryInterface(Components.interfaces.nsIMsgFolder).getMsgDatabase(null);
+    var msgdb = aFolder.QueryInterface(Components.interfaces.nsIMsgFolder)
+                       .msgDatabase;
     var folderInfo = msgdb.dBFolderInfo;
     var feedurls = folderInfo.getCharProperty("feedUrl");
     var feedUrlArray = feedurls.split("|");
 
     var rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
     var ds = getSubscriptionsDS(aFolder.server);
 
     for (url in feedUrlArray)
@@ -417,17 +418,17 @@ var progressNotifier = {
       updateFolderFeedUrl(feed.folder, feed.url, false);        
       addFeed(feed.url, feed.name, feed.folder); // add feed just adds the feed to the subscription UI and flushes the datasource
       
       // Nice touch: select the folder that now contains the newly subscribed feed...this is particularly nice 
       // if we just finished subscribing to a feed URL that the operating system gave us.
       this.mMsgWindow.windowCommands.selectFolder(feed.folder.URI);
     } 
     else if (feed.folder)
-      feed.folder.setMsgDatabase(null);
+      feed.folder.msgDatabase = null;
 
     if (this.mStatusFeedback)
     {
       var newsBlogBundle = GetNewsBlogStringBundle();
       if (aErrorCode == kNewsBlogNoNewItems)
         this.mStatusFeedback.showStatusString(newsBlogBundle.GetStringFromName("newsblog-noNewArticlesForFeed"));
       else if (aErrorCode == kNewsBlogInvalidFeed)
         this.mStatusFeedback.showStatusString(newsBlogBundle.formatStringFromName("newsblog-invalidFeed",
--- a/mailnews/imap/src/nsAutoSyncState.cpp
+++ b/mailnews/imap/src/nsAutoSyncState.cpp
@@ -133,17 +133,17 @@ nsresult nsAutoSyncState::PlaceIntoDownl
 {
   nsresult rv;
   if (!aMsgKeyList.IsEmpty())
   {
     nsCOMPtr <nsIMsgFolder> folder = do_QueryReferent(mOwnerFolder, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
         
     nsCOMPtr<nsIMsgDatabase> database;
-    rv = folder->GetMsgDatabase(nsnull, getter_AddRefs(database));
+    rv = folder->GetMsgDatabase(getter_AddRefs(database));
     if (!database)
       return NS_ERROR_FAILURE;
     
     nsCOMPtr<nsIAutoSyncManager> autoSyncMgr = do_GetService(NS_AUTOSYNCMANAGER_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv,rv);
     
     nsCOMPtr<nsIAutoSyncMsgStrategy> msgStrategy;
     autoSyncMgr->GetMsgStrategy(getter_AddRefs(msgStrategy));
@@ -196,17 +196,17 @@ nsresult nsAutoSyncState::PlaceIntoDownl
 
 nsresult nsAutoSyncState::SortQueueBasedOnStrategy(nsTArray<nsMsgKey> &aQueue)
 {
   nsresult rv;
   nsCOMPtr <nsIMsgFolder> folder = do_QueryReferent(mOwnerFolder, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
   
   nsCOMPtr<nsIMsgDatabase> database;
-  rv = folder->GetMsgDatabase(nsnull, getter_AddRefs(database));
+  rv = folder->GetMsgDatabase(getter_AddRefs(database));
   if (!database)
     return NS_ERROR_FAILURE;
   
   nsCOMPtr<nsIAutoSyncManager> autoSyncMgr = do_GetService(NS_AUTOSYNCMANAGER_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
         
   nsCOMPtr<nsIAutoSyncMsgStrategy> msgStrategy;
   rv = autoSyncMgr->GetMsgStrategy(getter_AddRefs(msgStrategy));
@@ -227,17 +227,17 @@ NS_IMETHODIMP nsAutoSyncState::GetNextGr
   
   *aActualGroupSize = 0;
   
   nsresult rv;
   nsCOMPtr <nsIMsgFolder> folder = do_QueryReferent(mOwnerFolder, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
   
   nsCOMPtr<nsIMsgDatabase> database;
-  folder->GetMsgDatabase(nsnull, getter_AddRefs(database));
+  folder->GetMsgDatabase(getter_AddRefs(database));
       
   nsCOMPtr<nsIMutableArray> group = do_CreateInstance(NS_ARRAY_CONTRACTID);
   if (database)
   {
     if (!mDownloadQ.IsEmpty())
     {
       // sort the download queue if new items are added since the last time
       if (mIsDownloadQChanged)
@@ -336,17 +336,17 @@ NS_IMETHODIMP nsAutoSyncState::ProcessEx
 {
   NS_ENSURE_ARG_POINTER(aLeftToProcess);
   
   nsresult rv;
   nsCOMPtr <nsIMsgFolder> folder = do_QueryReferent(mOwnerFolder, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
   
   nsCOMPtr<nsIMsgDatabase> database;
-  rv = folder->GetMsgDatabase(nsnull, getter_AddRefs(database));
+  rv = folder->GetMsgDatabase(getter_AddRefs(database));
   if (!database)
     return NS_ERROR_FAILURE;
   
   // create a queue to process existing headers for the first time
   if (mExistingHeadersQ.IsEmpty())
   {
     rv = database->ListAllKeys(mExistingHeadersQ);
     NS_ENSURE_SUCCESS(rv, rv);
@@ -634,17 +634,17 @@ NS_IMPL_ISUPPORTS2(nsAutoSyncState, nsIA
 
 #ifdef DEBUG_me
 void nsAutoSyncState::DebugPrintQWithSize(nsTArray<nsMsgKey>& q, PRUint32 toOffset)
 {
   nsCOMPtr <nsIMsgFolder> ownerFolder = do_QueryReferent(mOwnerFolder);
   if (ownerFolder)
   {
     nsCOMPtr<nsIMsgDatabase> database;
-    ownerFolder->GetMsgDatabase(nsnull, getter_AddRefs(database));
+    ownerFolder->GetMsgDatabase(getter_AddRefs(database));
     
     PRUint32 x = q.Length();
     while (x > toOffset && database) 
     {
       x--;
       nsCOMPtr<nsIMsgDBHdr> h;
       database->GetMsgHdrForKey(q[x], getter_AddRefs(h));
       PRUint32 s;
@@ -656,17 +656,17 @@ void nsAutoSyncState::DebugPrintQWithSiz
 }
 
 void nsAutoSyncState::DebugPrintQWithSize(nsIMutableArray *q, PRUint32 toOffset)
 {
   nsCOMPtr <nsIMsgFolder> ownerFolder = do_QueryReferent(mOwnerFolder);
   if (ownerFolder)
   {
     nsCOMPtr<nsIMsgDatabase> database;
-    ownerFolder->GetMsgDatabase(nsnull, getter_AddRefs(database));
+    ownerFolder->GetMsgDatabase(getter_AddRefs(database));
 
     PRUint32 x;
     q->GetLength(&x);
     while (x > toOffset && database) 
     {
       x--;
       nsCOMPtr<nsIMsgDBHdr> h;
       q->QueryElementAt(x, NS_GET_IID(nsIMsgDBHdr),
--- a/mailnews/imap/src/nsImapMailFolder.cpp
+++ b/mailnews/imap/src/nsImapMailFolder.cpp
@@ -813,17 +813,17 @@ NS_IMETHODIMP nsImapMailFolder::UpdateFo
   else if (NS_SUCCEEDED(rv))  // tell the front end that the folder is loaded if we're not going to
   {                           // actually run a url.
     if (!m_updatingFolder)    // if we're already running an update url, we'll let that one send the folder loaded
       NotifyFolderEvent(mFolderLoadedAtom);
   }
   return rv;
 }
 
-NS_IMETHODIMP nsImapMailFolder::GetMessages(nsIMsgWindow *aMsgWindow, nsISimpleEnumerator* *result)
+NS_IMETHODIMP nsImapMailFolder::GetMessages(nsISimpleEnumerator* *result)
 {
   NS_ENSURE_ARG_POINTER(result);
   if (!mDatabase)
     GetDatabase();
   if (mDatabase)
     return mDatabase->EnumerateMessages(result);
   return NS_ERROR_UNEXPECTED;
 }
@@ -1293,17 +1293,17 @@ NS_IMETHODIMP nsImapMailFolder::EmptyTra
           return NS_ERROR_FAILURE;  // we will not be performing an empty trash....
       } // if we fetched an imap server
     } // if emptying trash on exit which is done through the account manager.
 
     nsCOMPtr<nsIMsgDatabase> trashDB;
     if (WeAreOffline())
     {
       nsCOMPtr <nsIMsgDatabase> trashDB;
-      rv = trashFolder->GetMsgDatabase(nsnull, getter_AddRefs(trashDB));
+      rv = trashFolder->GetMsgDatabase(getter_AddRefs(trashDB));
       if (trashDB)
       {
         nsMsgKey fakeKey;
         trashDB->GetNextFakeOfflineMsgKey(&fakeKey);
 
         nsCOMPtr <nsIMsgOfflineImapOperation> op;
         rv = trashDB->GetOfflineOpForKey(fakeKey, PR_TRUE, getter_AddRefs(op));
         trashFolder->SetFlag(nsMsgFolderFlags::OfflineEvents);
@@ -4576,17 +4576,17 @@ nsImapMailFolder::OnStopRunningUrl(nsIUR
         {
           nsCOMPtr<nsIMsgFolder> srcFolder = do_QueryInterface(m_copyState->m_srcSupport, &rv);
           if (m_copyState->m_isMove && !m_copyState->m_isCrossServerOp)
           {
             if (NS_SUCCEEDED(aExitCode))
             {
               nsCOMPtr<nsIMsgDatabase> srcDB;
               if (srcFolder)
-                  rv = srcFolder->GetMsgDatabase(msgWindow, getter_AddRefs(srcDB));
+                  rv = srcFolder->GetMsgDatabase(getter_AddRefs(srcDB));
               if (NS_SUCCEEDED(rv) && srcDB)
               {
                 nsRefPtr<nsImapMoveCopyMsgTxn> msgTxn;
                 nsTArray<nsMsgKey> srcKeyArray;
                 if (m_copyState->m_allowUndo)
                 {
                   rv = m_copyState->m_undoMsgTxn->QueryInterface(NS_GET_IID(nsImapMoveCopyMsgTxn), getter_AddRefs(msgTxn));
                   if (msgTxn)
@@ -4654,17 +4654,17 @@ nsImapMailFolder::OnStopRunningUrl(nsIUR
         // deleting a message to start with, but it probably
         // won't do any harm.
           imapMessageFlagsType flags = 0;
           imapUrl->GetMsgFlags(&flags);
           //we need to subtract the delete flag in db only in case when we show deleted msgs
           if (flags & kImapMsgDeletedFlag && ShowDeletedMessages())
           {
             nsCOMPtr<nsIMsgDatabase> db;
-            rv = GetMsgDatabase(nsnull, getter_AddRefs(db));
+            rv = GetMsgDatabase(getter_AddRefs(db));
             if (NS_SUCCEEDED(rv) && db)
             {
               nsTArray<nsMsgKey> keyArray;
               char *keyString;
               imapUrl->CreateListOfMessageIdsString(&keyString);
               if (keyString)
               {
                 ParseUidString(keyString, keyArray);
@@ -4681,17 +4681,17 @@ nsImapMailFolder::OnStopRunningUrl(nsIUR
           imapMessageFlagsType flags = 0;
           imapUrl->GetMsgFlags(&flags);
           if (flags & kImapMsgDeletedFlag)
           {
             // we need to delete headers from db only when we don't show deleted msgs
             if (!ShowDeletedMessages())
             {
               nsCOMPtr<nsIMsgDatabase> db;
-              rv = GetMsgDatabase(nsnull, getter_AddRefs(db));
+              rv = GetMsgDatabase(getter_AddRefs(db));
               if (NS_SUCCEEDED(rv) && db)
               {
                 nsTArray<nsMsgKey> keyArray;
                 char *keyString = nsnull;
                 imapUrl->CreateListOfMessageIdsString(&keyString);
                 if (keyString)
                 {
                   ParseUidString(keyString, keyArray);
@@ -6865,17 +6865,17 @@ nsImapFolderCopyState::OnStopRunningUrl(
             {
               m_srcChildFolders->InsertElementAt(child, m_childIndex + childIndex + 1);
               m_destParents->InsertElementAt(newMsgFolder, m_childIndex + childIndex + 1);
             }
             ++childIndex;
           }
 
           nsCOMPtr<nsISimpleEnumerator> messages;
-          rv = m_srcFolder->GetMessages(m_msgWindow, getter_AddRefs(messages));
+          rv = m_srcFolder->GetMessages(getter_AddRefs(messages));
           nsCOMPtr<nsIMutableArray> msgArray(do_CreateInstance(NS_ARRAY_CONTRACTID, &rv));
           NS_ENSURE_TRUE(msgArray, rv);
           PRBool hasMoreElements;
           nsCOMPtr<nsISupports> aSupport;
 
           if (messages)
             messages->HasMoreElements(&hasMoreElements);
 
--- a/mailnews/imap/src/nsImapMailFolder.h
+++ b/mailnews/imap/src/nsImapMailFolder.h
@@ -229,17 +229,17 @@ public:
   nsImapMailFolder();
   virtual ~nsImapMailFolder();
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIMsgFolder methods:
   NS_IMETHOD GetSubFolders(nsISimpleEnumerator **aResult);
 
-  NS_IMETHOD GetMessages(nsIMsgWindow *aMsgWindow, nsISimpleEnumerator* *result);
+  NS_IMETHOD GetMessages(nsISimpleEnumerator* *result);
   NS_IMETHOD UpdateFolder(nsIMsgWindow *aWindow);
 
   NS_IMETHOD CreateSubfolder(const nsAString& folderName,nsIMsgWindow *msgWindow );
   NS_IMETHOD AddSubfolder(const nsAString& aName, nsIMsgFolder** aChild);
   NS_IMETHODIMP CreateStorageIfMissing(nsIUrlListener* urlListener);
 
   NS_IMETHOD Compact(nsIUrlListener *aListener, nsIMsgWindow *aMsgWindow);
   NS_IMETHOD CompactAll(nsIUrlListener *aListener, nsIMsgWindow *aMsgWindow,
--- a/mailnews/imap/src/nsImapService.cpp
+++ b/mailnews/imap/src/nsImapService.cpp
@@ -1993,17 +1993,17 @@ nsresult nsImapService::OfflineAppendFro
                                               nsIMsgFolder* aDstFolder,
                                               const nsACString &messageId,  // to be replaced
                                               PRBool inSelectedState, // needs to be in
                                               nsIUrlListener *aListener,
                                               nsIURI **aURL,
                                               nsISupports *aCopyState)
 {
   nsCOMPtr<nsIMsgDatabase> destDB;
-  nsresult rv = aDstFolder->GetMsgDatabase(nsnull, getter_AddRefs(destDB));
+  nsresult rv = aDstFolder->GetMsgDatabase(getter_AddRefs(destDB));
   // ### might need to send some notifications instead of just returning
 
   if (NS_SUCCEEDED(rv) && destDB)
   {
     nsMsgKey fakeKey;
     destDB->GetNextFakeOfflineMsgKey(&fakeKey);
     
     nsCOMPtr <nsIMsgOfflineImapOperation> op;
--- a/mailnews/imap/src/nsImapUndoTxn.cpp
+++ b/mailnews/imap/src/nsImapUndoTxn.cpp
@@ -74,17 +74,17 @@ nsImapMoveCopyMsgTxn::Init(nsIMsgFolder*
   nsCString protocolType(uri);
   protocolType.SetLength(protocolType.FindChar(':'));
   // ** jt -- only do this for mailbox protocol
   if (protocolType.LowerCaseEqualsLiteral("mailbox"))
   {
     m_srcIsPop3 = PR_TRUE;
     PRUint32 i, count = m_srcKeyArray.Length();
     nsCOMPtr<nsIMsgDatabase> srcDB;
-    rv = srcFolder->GetMsgDatabase(nsnull, getter_AddRefs(srcDB));
+    rv = srcFolder->GetMsgDatabase(getter_AddRefs(srcDB));
     if (NS_FAILED(rv)) return rv;
     nsCOMPtr<nsIMsgDBHdr> srcHdr;
     nsCOMPtr<nsIMsgDBHdr> copySrcHdr;
     nsMsgKey pseudoKey;
     
     for (i=0; i<count; i++)
     {
       rv = srcDB->GetMsgHdrForKey(m_srcKeyArray[i],
@@ -361,19 +361,19 @@ nsImapMoveCopyMsgTxn::UndoMailboxDelete(
         nsCOMPtr<nsIMsgFolder> srcFolder = do_QueryReferent(m_srcFolder, &rv);
         if (NS_FAILED(rv) || !srcFolder) return rv;
 
         nsCOMPtr<nsIMsgFolder> dstFolder = do_QueryReferent(m_dstFolder, &rv);
         if (NS_FAILED(rv) || !dstFolder) return rv;
 
         nsCOMPtr<nsIMsgDatabase> srcDB;
         nsCOMPtr<nsIMsgDatabase> dstDB;
-        rv = srcFolder->GetMsgDatabase(nsnull, getter_AddRefs(srcDB));
+        rv = srcFolder->GetMsgDatabase(getter_AddRefs(srcDB));
         if (NS_FAILED(rv)) return rv;
-        rv = dstFolder->GetMsgDatabase(nsnull, getter_AddRefs(dstDB));
+        rv = dstFolder->GetMsgDatabase(getter_AddRefs(dstDB));
         if (NS_FAILED(rv)) return rv;
         
         PRUint32 count = m_srcKeyArray.Length();
         PRUint32 i;
         nsCOMPtr<nsIMsgDBHdr> oldHdr;
         nsCOMPtr<nsIMsgDBHdr> newHdr;
         for (i=0; i<count; i++)
         {
@@ -406,17 +406,17 @@ nsresult
 nsImapMoveCopyMsgTxn::RedoMailboxDelete()
 {
     nsresult rv = NS_ERROR_FAILURE;
     if (m_srcIsPop3)
     {
         nsCOMPtr<nsIMsgDatabase> srcDB;
         nsCOMPtr<nsIMsgFolder> srcFolder = do_QueryReferent(m_srcFolder, &rv);
         if (NS_FAILED(rv) || !srcFolder) return rv;
-        rv = srcFolder->GetMsgDatabase(nsnull, getter_AddRefs(srcDB));
+        rv = srcFolder->GetMsgDatabase(getter_AddRefs(srcDB));
         if (NS_SUCCEEDED(rv))
         {
             srcDB->DeleteMessages(&m_srcKeyArray, nsnull);
             srcDB->SetSummaryValid(PR_TRUE);
         }
         return NS_OK; // always return NS_OK
     }
     else
--- a/mailnews/local/src/nsLocalMailFolder.cpp
+++ b/mailnews/local/src/nsLocalMailFolder.cpp
@@ -350,18 +350,17 @@ NS_IMETHODIMP nsMsgLocalMailFolder::Pars
   rv = mailboxService->ParseMailbox(aMsgWindow, pathFile, parser, this, nsnull);
   if (NS_SUCCEEDED(rv))
     m_parsingFolder = PR_TRUE;
   return rv;
 }
 
 // this won't force a reparse of the folder if the db is invalid.
 NS_IMETHODIMP
-nsMsgLocalMailFolder::GetMsgDatabase(nsIMsgWindow *aMsgWindow,
-                              nsIMsgDatabase** aMsgDatabase)
+nsMsgLocalMailFolder::GetMsgDatabase(nsIMsgDatabase** aMsgDatabase)
 {
   return GetDatabaseWOReparse(aMsgDatabase);
 }
 
 NS_IMETHODIMP
 nsMsgLocalMailFolder::GetSubFolders(nsISimpleEnumerator **aResult)
 {
   PRBool isServer;
@@ -634,17 +633,17 @@ nsMsgLocalMailFolder::UpdateFolder(nsIMs
   // Callers should rely on folder loaded event to ensure completion of loading. So we'll
   // return NS_OK even if parsing is still in progress
   if (rv == NS_ERROR_NOT_INITIALIZED)
     rv = NS_OK;
   return rv;
 }
 
 NS_IMETHODIMP
-nsMsgLocalMailFolder::GetMessages(nsIMsgWindow *aMsgWindow, nsISimpleEnumerator* *result)
+nsMsgLocalMailFolder::GetMessages(nsISimpleEnumerator **result)
 {
   nsCOMPtr <nsIMsgDatabase> msgDB;
   nsresult rv = GetDatabaseWOReparse(getter_AddRefs(msgDB));
   return NS_SUCCEEDED(rv) ? msgDB->EnumerateMessages(result) : rv;
 }
 
 NS_IMETHODIMP nsMsgLocalMailFolder::GetFolderURL(nsACString& aUrl)
 {
@@ -1799,17 +1798,17 @@ nsMsgLocalMailFolder::CopyFolderAcrossSe
   nsString folderName;
   srcFolder->GetName(folderName);
 
   nsCOMPtr<nsIMsgFolder> newMsgFolder;
   nsresult rv = CreateSubfolderInternal(folderName, msgWindow, getter_AddRefs(newMsgFolder));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsISimpleEnumerator> messages;
-  rv = srcFolder->GetMessages(msgWindow, getter_AddRefs(messages));
+  rv = srcFolder->GetMessages(getter_AddRefs(messages));
 
   nsCOMPtr<nsIMutableArray> msgArray(do_CreateInstance(NS_ARRAY_CONTRACTID));
 
   PRBool hasMoreElements;
   nsCOMPtr<nsISupports> aSupport;
 
   if (messages)
     messages->HasMoreElements(&hasMoreElements);
@@ -2539,17 +2538,17 @@ NS_IMETHODIMP nsMsgLocalMailFolder::EndC
             {
               PRUint32 folderFlags;
               srcFolder->GetFlags(&folderFlags);
               // check if the src folder is an imap inbox.
               if ((folderFlags & (nsMsgFolderFlags::Inbox|nsMsgFolderFlags::ImapBox))
                             == (nsMsgFolderFlags::Inbox|nsMsgFolderFlags::ImapBox))
               {
                 nsCOMPtr <nsIMsgDatabase> db;
-                srcFolder->GetMsgDatabase(nsnull, getter_AddRefs(db));
+                srcFolder->GetMsgDatabase(getter_AddRefs(db));
                 if (db)
                 {
                   nsMsgKey srcKey;
                   PRBool containsKey;
                   mCopyState->m_message->GetMessageKey(&srcKey);
                   db->ContainsKey(srcKey, &containsKey);
                   // if the db doesn't have the key, it must be a filtered imap
                   // message, getting moved to a local folder.
@@ -2767,17 +2766,17 @@ NS_IMETHODIMP nsMsgLocalMailFolder::EndM
     mCopyState->m_parseMsgState->FinishHeader();
 
     rv = mCopyState->m_parseMsgState->GetNewMsgHdr(getter_AddRefs(newHdr));
     if (NS_SUCCEEDED(rv) && newHdr)
     {
       nsCOMPtr<nsIMsgFolder> srcFolder = do_QueryInterface(mCopyState->m_srcSupport, &rv);
       NS_ENSURE_SUCCESS(rv, rv);
       nsCOMPtr<nsIMsgDatabase> srcDB;
-      srcFolder->GetMsgDatabase(nsnull, getter_AddRefs(srcDB));
+      srcFolder->GetMsgDatabase(getter_AddRefs(srcDB));
       if (srcDB)
       {
         nsCOMPtr <nsIMsgDBHdr> srcMsgHdr;
         srcDB->GetMsgHdrForKey(key, getter_AddRefs(srcMsgHdr));
         if (srcMsgHdr)
           CopyPropertiesToMsgHdr(newHdr, srcMsgHdr);
       }
       rv = GetDatabaseWOReparse(getter_AddRefs(msgDb));
--- a/mailnews/local/src/nsLocalMailFolder.h
+++ b/mailnews/local/src/nsLocalMailFolder.h
@@ -131,21 +131,20 @@ public:
   NS_IMETHOD Init(const char *aURI);
 
   // nsIUrlListener methods
   NS_IMETHOD OnStartRunningUrl(nsIURI * aUrl);
   NS_IMETHOD OnStopRunningUrl(nsIURI * aUrl, nsresult aExitCode);
 
   // nsIMsgFolder methods:
   NS_IMETHOD GetSubFolders(nsISimpleEnumerator* *aResult);
-  NS_IMETHOD GetMsgDatabase(nsIMsgWindow *aMsgWindow,
-                              nsIMsgDatabase** aMsgDatabase);
+  NS_IMETHOD GetMsgDatabase(nsIMsgDatabase **aMsgDatabase);
 
   NS_IMETHOD OnAnnouncerGoingAway(nsIDBChangeAnnouncer *instigator);
-  NS_IMETHOD GetMessages(nsIMsgWindow *aMsgWindow, nsISimpleEnumerator* *result);
+  NS_IMETHOD GetMessages(nsISimpleEnumerator **result);
   NS_IMETHOD UpdateFolder(nsIMsgWindow *aWindow);
 
   NS_IMETHOD CreateSubfolder(const nsAString& folderName ,nsIMsgWindow *msgWindow);
   NS_IMETHOD AddSubfolder(const nsAString& folderName, nsIMsgFolder** newFolder);
 
   NS_IMETHOD Compact(nsIUrlListener *aListener, nsIMsgWindow *aMsgWindow);
   NS_IMETHOD CompactAll(nsIUrlListener *aListener, nsIMsgWindow *aMsgWindow, PRBool aCompactOfflineAlso);
   NS_IMETHOD EmptyTrash(nsIMsgWindow *msgWindow, nsIUrlListener *aListener);
--- a/mailnews/local/src/nsLocalUndoTxn.cpp
+++ b/mailnews/local/src/nsLocalUndoTxn.cpp
@@ -200,17 +200,17 @@ nsLocalMoveCopyMsgTxn::UndoTransaction()
     
     nsCOMPtr<nsIMsgMailSession> mailSession = 
       do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv); 
     NS_ENSURE_SUCCESS(rv,rv);
     
     rv = mailSession->AddFolderListener(mUndoFolderListener, nsIFolderListener::event);
     NS_ENSURE_SUCCESS(rv,rv);
     
-    rv = dstFolder->GetMsgDatabase(nsnull, getter_AddRefs(dstDB));
+    rv = dstFolder->GetMsgDatabase(getter_AddRefs(dstDB));
     NS_ENSURE_SUCCESS(rv,rv);
   }
   else
     rv = UndoTransactionInternal();
   return rv;
 }
 
 nsresult 
@@ -234,20 +234,20 @@ nsLocalMoveCopyMsgTxn::UndoTransactionIn
   nsCOMPtr<nsIMsgDatabase> srcDB;
   nsCOMPtr<nsIMsgDatabase> dstDB;
   nsCOMPtr<nsIMsgFolder> srcFolder = do_QueryReferent(m_srcFolder, &rv);
   NS_ENSURE_SUCCESS(rv,rv);
   
   nsCOMPtr<nsIMsgFolder> dstFolder = do_QueryReferent(m_dstFolder, &rv);
   NS_ENSURE_SUCCESS(rv,rv);
   
-  rv = srcFolder->GetMsgDatabase(nsnull, getter_AddRefs(srcDB));
+  rv = srcFolder->GetMsgDatabase(getter_AddRefs(srcDB));
   if(NS_FAILED(rv)) return rv;
 
-  rv = dstFolder->GetMsgDatabase(nsnull, getter_AddRefs(dstDB));
+  rv = dstFolder->GetMsgDatabase(getter_AddRefs(dstDB));
   if (NS_FAILED(rv)) return rv;
 
   PRUint32 count = m_srcKeyArray.Length();
   PRUint32 i;
   nsCOMPtr<nsIMsgDBHdr> oldHdr;
   nsCOMPtr<nsIMsgDBHdr> newHdr;
 
   // protect against a bogus undo txn without any source keys
@@ -308,19 +308,19 @@ nsLocalMoveCopyMsgTxn::RedoTransaction()
   nsCOMPtr<nsIMsgDatabase> dstDB;
 
   nsCOMPtr<nsIMsgFolder> srcFolder = do_QueryReferent(m_srcFolder, &rv);
   NS_ENSURE_SUCCESS(rv,rv);
 
   nsCOMPtr<nsIMsgFolder> dstFolder = do_QueryReferent(m_dstFolder, &rv);
   NS_ENSURE_SUCCESS(rv,rv);
   
-  rv = srcFolder->GetMsgDatabase(nsnull, getter_AddRefs(srcDB));
+  rv = srcFolder->GetMsgDatabase(getter_AddRefs(srcDB));
   if(NS_FAILED(rv)) return rv;
-  rv = dstFolder->GetMsgDatabase(nsnull, getter_AddRefs(dstDB));
+  rv = dstFolder->GetMsgDatabase(getter_AddRefs(dstDB));
   if (NS_FAILED(rv)) return rv;
 
   PRUint32 count = m_srcKeyArray.Length();
   PRUint32 i;
   nsCOMPtr<nsIMsgDBHdr> oldHdr;
   nsCOMPtr<nsIMsgDBHdr> newHdr;
 
   nsCOMPtr<nsIMutableArray> srcMessages = do_CreateInstance(NS_ARRAY_CONTRACTID);
--- a/mailnews/local/src/nsMailboxService.cpp
+++ b/mailnews/local/src/nsMailboxService.cpp
@@ -140,17 +140,17 @@ nsresult nsMailboxService::CopyMessages(
   nsCOMPtr<nsIMailboxUrl> mailboxurl;
 
   nsMailboxAction actionToUse = nsIMailboxUrl::ActionMoveMessage;
   if (!moveMessage)
      actionToUse = nsIMailboxUrl::ActionCopyMessage;
 
   nsCOMPtr <nsIMsgDBHdr> msgHdr;
   nsCOMPtr <nsIMsgDatabase> db;
-  srcFolder->GetMsgDatabase(aMsgWindow, getter_AddRefs(db));
+  srcFolder->GetMsgDatabase(getter_AddRefs(db));
   if (db)
   {
     db->GetMsgHdrForKey(msgKeys[0], getter_AddRefs(msgHdr));
     if (msgHdr)
     {
       nsCString uri;
       srcFolder->GetUriForMsg(msgHdr, uri);
       rv = PrepareMessageUrl(uri.get(), aUrlListener, actionToUse , getter_AddRefs(mailboxurl), aMsgWindow);
--- a/mailnews/local/src/nsMovemailIncomingServer.cpp
+++ b/mailnews/local/src/nsMovemailIncomingServer.cpp
@@ -98,17 +98,17 @@ nsMovemailIncomingServer::PerformBiff(ns
     if (downloadOnBiff)
     {
        nsCOMPtr <nsIMsgLocalMailFolder> localInbox = do_QueryInterface(inbox,
                                                                        &rv);
        if (localInbox && NS_SUCCEEDED(rv))
        {
            PRBool valid = PR_FALSE;
            nsCOMPtr <nsIMsgDatabase> db;
-           rv = inbox->GetMsgDatabase(aMsgWindow, getter_AddRefs(db));
+           rv = inbox->GetMsgDatabase(getter_AddRefs(db));
            if (NS_SUCCEEDED(rv) && db)
            {
                rv = db->GetSummaryValid(&valid);
            }
            if (NS_SUCCEEDED(rv) && valid)
            {
                rv = movemailService->GetNewMail(aMsgWindow, urlListener, inbox,
                                                 this, nsnull);
--- a/mailnews/local/src/nsPop3IncomingServer.cpp
+++ b/mailnews/local/src/nsPop3IncomingServer.cpp
@@ -280,17 +280,17 @@ nsresult nsPop3IncomingServer::GetInbox(
   {
     rootFolder->GetFolderWithFlags(nsMsgFolderFlags::Inbox, inbox);
   }
 
   nsCOMPtr<nsIMsgLocalMailFolder> localInbox = do_QueryInterface(*inbox, &rv);
   if (NS_SUCCEEDED(rv) && localInbox)
   {
     nsCOMPtr <nsIMsgDatabase> db;
-    rv = (*inbox)->GetMsgDatabase(msgWindow, getter_AddRefs(db));
+    rv = (*inbox)->GetMsgDatabase(getter_AddRefs(db));
     if (NS_FAILED(rv))
     {
       (*inbox)->SetMsgDatabase(nsnull);
       (void) localInbox->SetCheckForNewMessagesAfterParsing(PR_TRUE);
       // this will cause a reparse of the mail folder.
       localInbox->GetDatabaseWithReparse(nsnull, msgWindow, getter_AddRefs(db));
       rv = NS_MSG_ERROR_FOLDER_SUMMARY_OUT_OF_DATE;
     }
@@ -326,17 +326,17 @@ NS_IMETHODIMP nsPop3IncomingServer::Perf
   rv = GetDownloadOnBiff(&downloadOnBiff);
   if (downloadOnBiff)
   {
     nsCOMPtr <nsIMsgLocalMailFolder> localInbox = do_QueryInterface(inbox, &rv);
     if (localInbox && NS_SUCCEEDED(rv))
     {
       PRBool valid = PR_FALSE;
       nsCOMPtr <nsIMsgDatabase> db;
-      rv = inbox->GetMsgDatabase(aMsgWindow, getter_AddRefs(db));
+      rv = inbox->GetMsgDatabase(getter_AddRefs(db));
       if (NS_SUCCEEDED(rv) && db)
         rv = db->GetSummaryValid(&valid);
       if (NS_SUCCEEDED(rv) && valid)
         rv = pop3Service->GetNewMail(aMsgWindow, urlListener, inbox, this, nsnull);
       else
       {
         PRBool isLocked;
         inbox->GetLocked(&isLocked);
@@ -604,17 +604,17 @@ nsresult nsPop3GetMailChainer::GetNewMai
   NS_ENSURE_ARG_POINTER(folderToDownloadTo);
 
   m_serversToGetNewMailFor = servers;
   m_folderToDownloadTo = folderToDownloadTo;
   m_downloadingMsgWindow = msgWindow;
   m_listener = listener;
   nsCOMPtr <nsIMsgDatabase> destFolderDB;
 
-  nsresult rv = folderToDownloadTo->GetMsgDatabase(msgWindow, getter_AddRefs(destFolderDB));
+  nsresult rv = folderToDownloadTo->GetMsgDatabase(getter_AddRefs(destFolderDB));
   if (NS_FAILED(rv) || !destFolderDB)
   {
     nsCOMPtr <nsIMsgLocalMailFolder> localFolder = do_QueryInterface(folderToDownloadTo);
     if (localFolder)
     {
       localFolder->GetDatabaseWithReparse(this, msgWindow, getter_AddRefs(destFolderDB));
       return NS_OK;
     }
--- a/mailnews/local/src/nsRssIncomingServer.cpp
+++ b/mailnews/local/src/nsRssIncomingServer.cpp
@@ -185,17 +185,17 @@ NS_IMETHODIMP nsRssIncomingServer::GetNe
   if (rootFolder)
     return PerformBiff(aMsgWindow);
 
   PRBool valid = PR_FALSE;
   nsCOMPtr <nsIMsgDatabase> db;
   nsresult rv;
   nsCOMPtr <nsINewsBlogFeedDownloader> rssDownloader = do_GetService("@mozilla.org/newsblog-feed-downloader;1", &rv);
   NS_ENSURE_SUCCESS(rv, rv);
-  rv = aFolder->GetMsgDatabase(aMsgWindow, getter_AddRefs(db));
+  rv = aFolder->GetMsgDatabase(getter_AddRefs(db));
   if (NS_SUCCEEDED(rv) && db)
   {
     rv = db->GetSummaryValid(&valid);
     NS_ASSERTION(valid, "db is invalid");
     if (valid)
     {
       nsCOMPtr <nsIDBFolderInfo> folderInfo;
       rv = db->GetDBFolderInfo(getter_AddRefs(folderInfo));
--- a/mailnews/mapi/mapihook/src/msgMapiImp.cpp
+++ b/mailnews/mapi/mapihook/src/msgMapiImp.cpp
@@ -526,17 +526,17 @@ MsgMapiListContext::~MsgMapiListContext 
 
 
 nsresult MsgMapiListContext::OpenDatabase (nsIMsgFolder *folder)
 {
   nsresult dbErr = NS_ERROR_FAILURE;
   if (folder)
   {
     m_folder = folder;
-    dbErr = folder->GetMsgDatabase(nsnull, getter_AddRefs(m_db));
+    dbErr = folder->GetMsgDatabase(getter_AddRefs(m_db));
     if (m_db)
       dbErr = m_db->EnumerateMessages(getter_AddRefs(m_msgEnumerator));
   }
   return dbErr;
 }
 
 PRBool 
 MsgMapiListContext::IsIMAPHost(void)
--- a/mailnews/news/src/nsNNTPArticleList.cpp
+++ b/mailnews/news/src/nsNNTPArticleList.cpp
@@ -66,17 +66,17 @@ nsNNTPArticleList::Initialize(nsIMsgNews
 
     m_dbIndex = 0;
 
     m_newsFolder = newsFolder;
 
     nsCOMPtr <nsIMsgFolder> folder = do_QueryInterface(m_newsFolder, &rv);
     NS_ENSURE_SUCCESS(rv,rv);
 
-    rv = folder->GetMsgDatabase(nsnull /* msgWindow */, getter_AddRefs(m_newsDB));
+    rv = folder->GetMsgDatabase(getter_AddRefs(m_newsDB));
     NS_ENSURE_SUCCESS(rv,rv);
     if (!m_newsDB) return NS_ERROR_UNEXPECTED;
 
     rv = m_newsDB->ListAllKeys(m_idsInDB);
     NS_ENSURE_SUCCESS(rv,rv);
 
     return NS_OK;
 }
--- a/mailnews/news/src/nsNNTPNewsgroupList.cpp
+++ b/mailnews/news/src/nsNNTPNewsgroupList.cpp
@@ -291,17 +291,17 @@ nsNNTPNewsgroupList::GetRangeOfArtsToDow
   *first = 0;
   *last = 0;
 
   nsCOMPtr <nsIMsgFolder> folder = do_QueryInterface(m_newsFolder, &rv);
   NS_ENSURE_SUCCESS(rv,rv);
   m_msgWindow = aMsgWindow;
 
   if (!m_newsDB)
-    rv = folder->GetMsgDatabase(nsnull /* use m_msgWindow? */, getter_AddRefs(m_newsDB));
+    rv = folder->GetMsgDatabase(getter_AddRefs(m_newsDB));
 
   nsCOMPtr<nsINewsDatabase> db(do_QueryInterface(m_newsDB, &rv));
   NS_ENSURE_SUCCESS(rv,rv);
 
   rv = db->GetReadSet(&m_set);
   if (NS_FAILED(rv) || !m_set)
     return rv;
 
--- a/mailnews/news/src/nsNewsDownloader.cpp
+++ b/mailnews/news/src/nsNewsDownloader.cpp
@@ -555,17 +555,17 @@ nsresult nsMsgDownloadAllNewsgroups::Pro
   return m_currentFolder ? m_currentFolder->GetNewMessages(m_window, this) : NS_ERROR_NOT_INITIALIZED;
 }
 
 nsresult nsMsgDownloadAllNewsgroups::DownloadMsgsForCurrentGroup()
 {
   NS_ENSURE_TRUE(m_downloaderForGroup, NS_ERROR_OUT_OF_MEMORY);
   nsCOMPtr <nsIMsgDatabase> db;
   nsCOMPtr <nsIMsgDownloadSettings> downloadSettings;
-  m_currentFolder->GetMsgDatabase(m_window, getter_AddRefs(db));
+  m_currentFolder->GetMsgDatabase(getter_AddRefs(db));
   nsresult rv = m_currentFolder->GetDownloadSettings(getter_AddRefs(downloadSettings));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr <nsIMsgNewsFolder> newsFolder = do_QueryInterface(m_currentFolder);
   if (newsFolder)
     newsFolder->SetSaveArticleOffline(PR_TRUE);
 
   nsCOMPtr <nsIMsgSearchSession> searchSession = do_CreateInstance(NS_MSGSEARCHSESSION_CONTRACTID, &rv);
--- a/mailnews/news/src/nsNewsFolder.cpp
+++ b/mailnews/news/src/nsNewsFolder.cpp
@@ -414,17 +414,17 @@ nsMsgNewsFolder::GetCanCompact(PRBool *a
 {
   NS_ENSURE_ARG_POINTER(aResult);
   *aResult = PR_FALSE;
   // you can't compact a news server or a news group
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsMsgNewsFolder::GetMessages(nsIMsgWindow *aMsgWindow, nsISimpleEnumerator* *result)
+nsMsgNewsFolder::GetMessages(nsISimpleEnumerator **result)
 {
   nsresult rv = GetDatabase();
   *result = nsnull;
 
   if(NS_SUCCEEDED(rv))
     rv = mDatabase->EnumerateMessages(result);
 
   return rv;
--- a/mailnews/news/src/nsNewsFolder.h
+++ b/mailnews/news/src/nsNewsFolder.h
@@ -62,17 +62,17 @@ public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIMSGNEWSFOLDER
 
   // nsIUrlListener method
   NS_IMETHOD OnStopRunningUrl(nsIURI * aUrl, nsresult aExitCode);
   // nsIMsgFolder methods:
   NS_IMETHOD GetSubFolders(nsISimpleEnumerator **aResult);
 
-  NS_IMETHOD GetMessages(nsIMsgWindow *aMsgWindow, nsISimpleEnumerator* *result);
+  NS_IMETHOD GetMessages(nsISimpleEnumerator **result);
   NS_IMETHOD UpdateFolder(nsIMsgWindow *aWindow);
 
   NS_IMETHOD CreateSubfolder(const nsAString& folderName,nsIMsgWindow *msgWindow);
 
   NS_IMETHOD Delete ();
   NS_IMETHOD Rename (const nsAString& newName, nsIMsgWindow *msgWindow);
 
   NS_IMETHOD GetAbbreviatedName(nsAString& aAbbreviatedName);
--- a/mailnews/news/test/unit/head_server_setup.js
+++ b/mailnews/news/test/unit/head_server_setup.js
@@ -154,22 +154,22 @@ function create_post(baseURL, file) {
   var post = Cc["@mozilla.org/messenger/nntpnewsgrouppost;1"]
                .createInstance(Ci.nsINNTPNewsgroupPost);
   post.postMessageFile = do_get_file(file);
   url.messageToPost = post;
   return url;
 }
 
 function resetFolder(folder) {
-  var headerEnum = folder.getMessages(null);
+  var headerEnum = folder.messages;
   var headers = [];
   while (headerEnum.hasMoreElements())
     headers.push(headerEnum.getNext().QueryInterface(Ci.nsIMsgDBHdr));
 
-  var db = folder.getMsgDatabase(null);
+  var db = folder.msgDatabase;
   db.dBFolderInfo.knownArtsSet = "";
   for each (var header in headers) {
     db.DeleteHeader(header, null, true, false);
   }
 }
 
 function do_check_transaction(real, expected) {
   // real.them may have an extra QUIT on the end, where the stream is only
--- a/mailnews/news/test/unit/test_filter.js
+++ b/mailnews/news/test/unit/test_filter.js
@@ -98,17 +98,17 @@ function testAttrib(handler, localserver
   server.start(NNTP_PORT);
 
   // Get the folder and force filters to run
   var folder = localserver.rootFolder.getChildNamed("test.filter");
   folder.getNewMessages(null, {
     OnStopRunningUrl: function () { localserver.closeCachedConnections() }});
   server.performTest();
 
-  var headerEnum = folder.getMessages(null);
+  var headerEnum = folder.messages;
   var headers = [];
   while (headerEnum.hasMoreElements())
     headers.push(headerEnum.getNext().QueryInterface(Ci.nsIMsgDBHdr));
 
   try
   {
     do_check_eq(headers.length, 7);
     for each (var header in headers) {
@@ -126,24 +126,22 @@ function testAttrib(handler, localserver
   resetFolder(folder);
 }
 
 // These are the results for testing actual actions
 var actionResults = {
   "1@regular.invalid" : ["priority", 6],
   // "2@regular.invalid" should not be in database
   "3@regular.invalid" : function (header, folder) {
-    var db = folder.getMsgDatabase(null);
-    var flags = db.GetThreadContainingMsgHdr(header).flags;
+    var flags = folder.msgDatabase.GetThreadContainingMsgHdr(header).flags;
     // This is checking the thread's kill flag
     return (flags & 0x40000) == 0x40000;
   },
   "4@regular.invalid" : function (header, folder) {
-    var db = folder.getMsgDatabase(null);
-    var flags = db.GetThreadContainingMsgHdr(header).flags;
+    var flags = folder.msgDatabase.GetThreadContainingMsgHdr(header).flags;
     // This is checking the thread's watch flag
     return (flags & 0x100) == 0x100;
   },
   "5@regular.invalid" : ["isFlagged", true],
   "6.odd@regular.invalid" : ["isRead", false],
   "7@regular.invalid" : function (header, folder) {
     return header.getStringProperty("keywords") == "tag";
   }
@@ -153,17 +151,17 @@ function testAction(handler, localserver
   server.start(NNTP_PORT);
 
   // Get the folder and force filters to run
   var folder = localserver.rootFolder.getChildNamed("test.filter");
   folder.getNewMessages(null, {
     OnStopRunningUrl: function () { localserver.closeCachedConnections() }});
   server.performTest();
 
-  var headerEnum = folder.getMessages(null);
+  var headerEnum = folder.messages;
   var headers = [];
   while (headerEnum.hasMoreElements())
     headers.push(headerEnum.getNext().QueryInterface(Ci.nsIMsgDBHdr));
 
   try
   {
     do_check_eq(headers.length, 6);
     for each (var header in headers) {
--- a/suite/mailnews/mailWidgets.xml
+++ b/suite/mailnews/mailWidgets.xml
@@ -1878,18 +1878,17 @@
             // skip servers, Trash and Junk folders
             if (!aFolder || aFolder.isServer || aFolder.getFlag(kMsgPopupFolderFlagJunk) || aFolder.getFlag(kMsgPopupFolderFlagTrash))
               return false;
             var pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
             var showPreviewText = pref.getBoolPref("mail.biff.alert.show_preview");
             var folderArray = new Array;
             if (aFolder.flags  & Components.interfaces.nsMsgFolderFlags.Virtual)
             {
-              var msgDatabase = aFolder.getMsgDatabase(null);
-              var dbFolderInfo = msgDatabase.dBFolderInfo;
+              var dbFolderInfo = aFolder.msgDatabase.dBFolderInfo;
               var srchFolderUri = dbFolderInfo.getCharProperty("searchFolderUri");
               var srchFolderUriArray = srchFolderUri.split('|');
               var foldersAdded = 0;
               var RDF = Components.classes['@mozilla.org/rdf/rdf-service;1'].getService().QueryInterface(Components.interfaces.nsIRDFService);
               for (var i in srchFolderUriArray)
               {
                 var realFolder = RDF.GetResource(srchFolderUriArray[i]).QueryInterface(Components.interfaces.nsIMsgFolder);
                 if (!realFolder.isServer)
@@ -1898,38 +1897,38 @@
             }
             else
               folderArray[0] = aFolder;
             var foundNewMsg = false;
             for (var folderIndex = 0; folderIndex < folderArray.length; folderIndex++)
             {
               aFolder = folderArray[folderIndex];
               // now get the database
-              var msgDatabase = aFolder.getMsgDatabase(null);
-              aFolder.setMsgDatabase(null);
+              var msgDatabase = aFolder.msgDatabase;
+              aFolder.msgDatabase = null;
               var msgKeys = {};
               var numMsgKeys = {};
               msgDatabase.getNewList(numMsgKeys, msgKeys);
 
               if (!numMsgKeys.value)
                 continue;
 
               if (showPreviewText)
               {
                 // fetchMsgPreviewText forces the previewText property to get generated
                 // for each of the message keys.
                 try {
                   aOutAsync.value = aFolder.fetchMsgPreviewText(msgKeys.value, numMsgKeys.value, false, aUrlListener);
-                  aFolder.setMsgDatabase(null);
+                  aFolder.msgDatabase = null;
                 }
                 catch (ex)
                 {
                   // fetchMsgPreviewText throws an error when we call it on a news folder, we should just not show
                   // the tooltip if this method returns an error.
-                  aFolder.setMsgDatabase(null);
+                  aFolder.msgDatabase = null;
                   continue;
                 }
               }
               // if fetching the preview text is going to be an asynch operation and the caller
               // is set up to handle that fact, then don't bother filling in any of the fields since
               // we'll have to do this all over again when the fetch for the preview text completes.
               // We don't expect to get called with a urlListener if we're doing a virtual folder.
               if (aOutAsync.value && aUrlListener)