Bug 599119 - Do not scan plugin directories unnecessarily while loading messages. r=Standard8, sr=bienvenu
authorSiddharth Agarwal <sid.bugzilla@gmail.com>
Wed, 29 Sep 2010 22:40:14 +0530
changeset 6447 e19b069946a4
parent 6446 656a8a39341c
child 6448 f0a1a469964a
push id4981
push usersid.bugzilla@gmail.com
push dateWed, 29 Sep 2010 17:11:19 +0000
treeherdercomm-central@e19b069946a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersStandard8, bienvenu
bugs599119
Bug 599119 - Do not scan plugin directories unnecessarily while loading messages. r=Standard8, sr=bienvenu Currently, whenever we load a message, we ask the docshell to load a URI with content type message/rfc822. The docshell first looks for a Gecko content viewer to deal with the content type. Since none currently exist, it reloads plugins -- twice! -- to find out whether a plugin can handle it. Only afterwards does it look for a stream converter (in our case libmime) to convert the content type into something it recognizes. This patch adds a document loader factory which simply plugs a stream converter into the chain. It also registers the factory to handle the message/rfc822 content type, so that the docshell's lookup succeeds immediately.
mailnews/base/build/nsMsgFactory.cpp
mailnews/base/public/nsMsgBaseCID.h
mailnews/base/src/MailNewsDLF.cpp
mailnews/base/src/MailNewsDLF.h
mailnews/base/src/Makefile.in
mailnews/build/nsMailModule.cpp
--- a/mailnews/base/build/nsMsgFactory.cpp
+++ b/mailnews/base/build/nsMsgFactory.cpp
@@ -148,16 +148,20 @@
 #include "nsMessengerUnixIntegration.h"
 #endif
 
 #include "nsCURILoader.h"
 #include "nsMessengerContentHandler.h"
 
 #include "nsStopwatch.h"
 
+#include "MailNewsDLF.h"
+
+using namespace mozilla::mailnews;
+
 // private factory declarations for each component we know how to produce
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsMessengerBootstrap)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgMailSession, Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsMessenger)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgAccountManager, Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgAccount)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgIdentity)
@@ -211,16 +215,17 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMe
 #if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_GTK2)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMessengerUnixIntegration, Init)
 #endif
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsMessengerContentHandler)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgContentPolicy, Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsMailDirProvider)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgShutdownService)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsStopwatch)
+NS_GENERIC_FACTORY_CONSTRUCTOR(MailNewsDLF)
 
 NS_DEFINE_NAMED_CID(NS_MESSENGERBOOTSTRAP_CID);
 NS_DEFINE_NAMED_CID(NS_MESSENGERWINDOWSERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_MSGMAILSESSION_CID);
 NS_DEFINE_NAMED_CID(NS_MESSENGER_CID);
 NS_DEFINE_NAMED_CID(NS_MSGACCOUNTMANAGER_CID);
 NS_DEFINE_NAMED_CID(NS_MSGACCOUNT_CID);
 NS_DEFINE_NAMED_CID(NS_MSGIDENTITY_CID);
@@ -274,16 +279,17 @@ NS_DEFINE_NAMED_CID(NS_MESSENGEROSXINTEG
 #if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_GTK2)
 NS_DEFINE_NAMED_CID(NS_MESSENGERUNIXINTEGRATION_CID);
 #endif
 NS_DEFINE_NAMED_CID(NS_MESSENGERCONTENTHANDLER_CID);
 NS_DEFINE_NAMED_CID(NS_MSGCONTENTPOLICY_CID);
 NS_DEFINE_NAMED_CID(NS_MSGSHUTDOWNSERVICE_CID);
 NS_DEFINE_NAMED_CID(MAILDIRPROVIDER_CID);
 NS_DEFINE_NAMED_CID(NS_STOPWATCH_CID);
+NS_DEFINE_NAMED_CID(NS_MAILNEWSDLF_CID);
 
 const mozilla::Module::CIDEntry kMailNewsBaseCIDs[] = {
   { &kNS_MESSENGERBOOTSTRAP_CID, false, NULL, nsMessengerBootstrapConstructor },
   { &kNS_MESSENGERWINDOWSERVICE_CID, false, NULL, nsMessengerBootstrapConstructor },
   { &kNS_MSGMAILSESSION_CID, false, NULL, nsMsgMailSessionConstructor },
   { &kNS_MESSENGER_CID, false, NULL, nsMessengerConstructor },
   { &kNS_MSGACCOUNTMANAGER_CID, false, NULL, nsMsgAccountManagerConstructor },
   { &kNS_MSGACCOUNT_CID, false, NULL, nsMsgAccountConstructor },
@@ -338,16 +344,17 @@ const mozilla::Module::CIDEntry kMailNew
 #if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_GTK2)
   { &kNS_MESSENGERUNIXINTEGRATION_CID, false, NULL, nsMessengerUnixIntegrationConstructor },
 #endif
   { &kNS_MESSENGERCONTENTHANDLER_CID, false, NULL, nsMessengerContentHandlerConstructor },
   { &kNS_MSGCONTENTPOLICY_CID, false, NULL, nsMsgContentPolicyConstructor },
   { &kNS_MSGSHUTDOWNSERVICE_CID, false, NULL, nsMsgShutdownServiceConstructor },
   { &kMAILDIRPROVIDER_CID, false, NULL, nsMailDirProviderConstructor },
   { &kNS_STOPWATCH_CID, false, NULL, nsStopwatchConstructor },
+  { &kNS_MAILNEWSDLF_CID, false, NULL, MailNewsDLFConstructor },
   {NULL}
 };
 
 const mozilla::Module::ContractIDEntry kMailNewsBaseContracts[] = {
   { NS_MESSENGERBOOTSTRAP_CONTRACTID, &kNS_MESSENGERBOOTSTRAP_CID },
   { NS_MESSENGERWINDOWSERVICE_CONTRACTID, &kNS_MESSENGERWINDOWSERVICE_CID },
   { NS_MSGMAILSESSION_CONTRACTID, &kNS_MSGMAILSESSION_CID },
   { NS_MESSENGER_CONTRACTID, &kNS_MESSENGER_CID },
@@ -404,22 +411,24 @@ const mozilla::Module::ContractIDEntry k
 #if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_GTK2)
   { NS_MESSENGEROSINTEGRATION_CONTRACTID, &kNS_MESSENGERUNIXINTEGRATION_CID },
 #endif
   { NS_MESSENGERCONTENTHANDLER_CONTRACTID, &kNS_MESSENGERCONTENTHANDLER_CID },
   { NS_MSGCONTENTPOLICY_CONTRACTID, &kNS_MSGCONTENTPOLICY_CID },
   { NS_MSGSHUTDOWNSERVICE_CONTRACTID, &kNS_MSGSHUTDOWNSERVICE_CID },
   { NS_MAILDIRPROVIDER_CONTRACTID, &kMAILDIRPROVIDER_CID },
   { NS_STOPWATCH_CONTRACTID, &kNS_STOPWATCH_CID },
+  { NS_MAILNEWSDLF_CONTRACTID, &kNS_MAILNEWSDLF_CID },
   { NULL }
 };
 
 static const mozilla::Module::CategoryEntry kMailNewsBaseCategories[] = {
     { XPCOM_DIRECTORY_PROVIDER_CATEGORY, "mail-directory-provider", NS_MAILDIRPROVIDER_CONTRACTID },
     { "content-policy", NS_MSGCONTENTPOLICY_CONTRACTID, NS_MSGCONTENTPOLICY_CONTRACTID },
+    MAILNEWSDLF_CATEGORIES
 #ifdef XP_MACOSX
     { "app-startup", NS_MESSENGEROSINTEGRATION_CONTRACTID, "service," NS_MESSENGEROSINTEGRATION_CONTRACTID },
 #endif
     { NULL }
 };
 
 static const mozilla::Module kMailNewsBaseModule = {
   mozilla::Module::kVersion,
--- a/mailnews/base/public/nsMsgBaseCID.h
+++ b/mailnews/base/public/nsMsgBaseCID.h
@@ -528,9 +528,20 @@
 
 //
 // msgAsyncPrompter (only contract id for utility purposes as the CID is defined
 // in js).
 //
 #define NS_MSGASYNCPROMPTER_CONTRACTID \
   "@mozilla.org/messenger/msgAsyncPrompter;1"
 
+//
+// MailNewsDLF
+//
+#define NS_MAILNEWSDLF_CID \
+{ /* DE0F34A9-A87F-4F4C-B978-6187DB187B90 */ \
+  0xde0f34a9, 0xa87f, 0x4f4c, \
+    { 0xb9, 0x78, 0x61, 0x87, 0xdb, 0x18, 0x7b, 0x90 }}
+
+#define NS_MAILNEWSDLF_CONTRACTID \
+  "@mozilla.org/mailnews/document-loader-factory;1"
+
 #endif // nsMessageBaseCID_h__
new file mode 100644
--- /dev/null
+++ b/mailnews/base/src/MailNewsDLF.cpp
@@ -0,0 +1,131 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Thunderbird MailNews Document Loader Factory.
+ *
+ * The Initial Developer of the Original Code is
+ * the Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Siddharth Agarwal <sid.bugzilla@gmail.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsCOMPtr.h"
+#include "MailNewsDLF.h"
+#include "nsIChannel.h"
+#include "plstr.h"
+#include "nsStringGlue.h"
+#include "nsICategoryManager.h"
+#include "nsIServiceManager.h"
+#include "nsIStreamConverterService.h"
+#include "nsNetCID.h"
+
+namespace mozilla {
+namespace mailnews {
+NS_IMPL_ISUPPORTS1(MailNewsDLF, nsIDocumentLoaderFactory)
+
+MailNewsDLF::MailNewsDLF()
+{
+}
+
+MailNewsDLF::~MailNewsDLF()
+{
+}
+
+NS_IMETHODIMP
+MailNewsDLF::CreateInstance(const char* aCommand,
+                            nsIChannel* aChannel,
+                            nsILoadGroup* aLoadGroup,
+                            const char* aContentType, 
+                            nsISupports* aContainer,
+                            nsISupports* aExtraInfo,
+                            nsIStreamListener** aDocListener,
+                            nsIContentViewer** aDocViewer)
+{
+  nsresult rv;
+
+  PRBool viewSource = (PL_strstr(aContentType,"view-source") != 0);
+
+  aChannel->SetContentType(NS_LITERAL_CSTRING(TEXT_HTML));
+
+  // Get the HTML category
+  nsCOMPtr<nsICategoryManager> catMan(
+    do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv));
+  NS_ENSURE_SUCCESS(rv, rv);
+
+  nsCAutoString contractID;
+  rv = catMan->GetCategoryEntry("Gecko-Content-Viewers", TEXT_HTML,
+                                getter_Copies(contractID));
+  NS_ENSURE_SUCCESS(rv, rv);
+
+  nsCOMPtr<nsIDocumentLoaderFactory> factory(do_GetService(contractID.get(),
+                                             &rv));
+  NS_ENSURE_SUCCESS(rv, rv);
+
+  nsCOMPtr<nsIStreamListener> listener;
+
+  if (viewSource) {
+    rv = factory->CreateInstance("view-source", aChannel, aLoadGroup,
+                                 TEXT_HTML "; x-view-type=view-source",
+                                 aContainer, aExtraInfo, getter_AddRefs(listener),
+                                 aDocViewer);
+  } else {
+    rv = factory->CreateInstance("view", aChannel, aLoadGroup, TEXT_HTML,
+                                 aContainer, aExtraInfo, getter_AddRefs(listener),
+                                 aDocViewer);
+  }
+  NS_ENSURE_SUCCESS(rv, rv);
+
+  nsCOMPtr<nsIStreamConverterService> scs(
+    do_GetService(NS_STREAMCONVERTERSERVICE_CONTRACTID, &rv));
+  NS_ENSURE_SUCCESS(rv, rv);
+
+  return scs->AsyncConvertData(MESSAGE_RFC822, TEXT_HTML, listener, aChannel,
+                               aDocListener);
+}
+
+NS_IMETHODIMP
+MailNewsDLF::CreateInstanceForDocument(nsISupports* aContainer,
+                                       nsIDocument* aDocument,
+                                       const char* aCommand,
+                                       nsIContentViewer** aDocViewer)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+MailNewsDLF::CreateBlankDocument(nsILoadGroup* aLoadGroup,
+                                 nsIPrincipal* aPrincipal,
+                                 nsIDocument** aDocument)
+{
+  return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+}
+}
new file mode 100644
--- /dev/null
+++ b/mailnews/base/src/MailNewsDLF.h
@@ -0,0 +1,69 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Thunderbird MailNews Document Loader Factory.
+ *
+ * The Initial Developer of the Original Code is
+ * the Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Siddharth Agarwal <sid.bugzilla@gmail.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef MailNewsDLF_h__
+#define MailNewsDLF_h__
+
+#include "nsIDocumentLoaderFactory.h"
+#include "nsMimeTypes.h"
+#include "nsMsgBaseCID.h"
+
+namespace mozilla {
+namespace mailnews {
+
+/*
+ * This factory is a thin wrapper around the text/html loader factory. All it
+ * does is convert message/rfc822 to text/html and delegate the rest of the
+ * work to the text/html factory.
+ */
+class MailNewsDLF : public nsIDocumentLoaderFactory
+{
+public:
+  MailNewsDLF();
+  virtual ~MailNewsDLF();
+
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSIDOCUMENTLOADERFACTORY
+};
+}
+}
+
+#define MAILNEWSDLF_CATEGORIES \
+  { "Gecko-Content-Viewers", MESSAGE_RFC822, NS_MAILNEWSDLF_CONTRACTID }, \
+
+#endif
--- a/mailnews/base/src/Makefile.in
+++ b/mailnews/base/src/Makefile.in
@@ -85,16 +85,17 @@ CPPSRCS		= \
 		nsMsgProgress.cpp \
 		nsMessengerContentHandler.cpp \
 		nsSpamSettings.cpp \
 		nsCidProtocolHandler.cpp \
 		nsMsgContentPolicy.cpp \
 		nsMsgTagService.cpp\
                 nsMsgFolderNotificationService.cpp\
 		nsMailDirProvider.cpp\
+		MailNewsDLF.cpp \
 		$(NULL)
 
 ifdef NS_PRINTING
 CPPSRCS += nsMsgPrintEngine.cpp
 endif
 
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 CMMSRCS = nsMessengerOSXIntegration.mm
--- a/mailnews/build/nsMailModule.cpp
+++ b/mailnews/build/nsMailModule.cpp
@@ -141,16 +141,17 @@
 #include "nsMessengerOSXIntegration.h"
 #endif
 #if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_GTK2)
 #include "nsMessengerUnixIntegration.h"
 #endif
 #include "nsCURILoader.h"
 #include "nsMessengerContentHandler.h"
 #include "nsStopwatch.h"
+#include "MailNewsDLF.h"
 
 ////////////////////////////////////////////////////////////////////////////////
 // addrbook includes
 ////////////////////////////////////////////////////////////////////////////////
 #include "nsAbBaseCID.h"
 #include "nsDirectoryDataSource.h"
 #include "nsAbBSDirectory.h"
 #include "nsAbMDBDirectory.h"
@@ -321,16 +322,18 @@
 // FTS3 Tokenizer
 ///////////////////////////////////////////////////////////////////////////////
 #include "nsFts3TokenizerCID.h"
 #include "nsFts3Tokenizer.h"
 
 ////////////////////////////////////////////////////////////////////////////////
 // mailnews base factories
 ////////////////////////////////////////////////////////////////////////////////
+using namespace mozilla::mailnews;
+
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsMessengerBootstrap)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgMailSession, Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsMessenger)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgAccountManager, Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgAccount)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsMsgIdentity)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgFolderDataSource, Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgUnreadFoldersDataSource, Init)
@@ -382,16 +385,17 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMe
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMessengerOSXIntegration, Init)
 #endif
 #if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_GTK2)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMessengerUnixIntegration, Init)
 #endif
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsMessengerContentHandler)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMsgContentPolicy, Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsStopwatch)
+NS_GENERIC_FACTORY_CONSTRUCTOR(MailNewsDLF)
 
 NS_DEFINE_NAMED_CID(NS_MESSENGERBOOTSTRAP_CID);
 NS_DEFINE_NAMED_CID(NS_MESSENGERWINDOWSERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_MSGMAILSESSION_CID);
 NS_DEFINE_NAMED_CID(NS_MESSENGER_CID);
 NS_DEFINE_NAMED_CID(NS_MSGACCOUNTMANAGER_CID);
 NS_DEFINE_NAMED_CID(NS_MSGACCOUNT_CID);
 NS_DEFINE_NAMED_CID(NS_MSGIDENTITY_CID);
@@ -445,16 +449,17 @@ NS_DEFINE_NAMED_CID(NS_MESSENGEROSXINTEG
 #if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_GTK2)
 NS_DEFINE_NAMED_CID(NS_MESSENGERUNIXINTEGRATION_CID);
 #endif
 NS_DEFINE_NAMED_CID(NS_MESSENGERCONTENTHANDLER_CID);
 NS_DEFINE_NAMED_CID(NS_MSGCONTENTPOLICY_CID);
 NS_DEFINE_NAMED_CID(NS_MSGSHUTDOWNSERVICE_CID);
 NS_DEFINE_NAMED_CID(MAILDIRPROVIDER_CID);
 NS_DEFINE_NAMED_CID(NS_STOPWATCH_CID);
+NS_DEFINE_NAMED_CID(NS_MAILNEWSDLF_CID);
 
 ////////////////////////////////////////////////////////////////////////////////
 // addrbook factories
 ////////////////////////////////////////////////////////////////////////////////
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsAbManager,Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbContentHandler)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsAbDirectoryDataSource,Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsAbDirProperty)
@@ -841,16 +846,17 @@ const mozilla::Module::CIDEntry kMailNew
 #if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_GTK2)
   { &kNS_MESSENGERUNIXINTEGRATION_CID, false, NULL, nsMessengerUnixIntegrationConstructor},
 #endif
   { &kNS_MESSENGERCONTENTHANDLER_CID, false, NULL, nsMessengerContentHandlerConstructor},
   { &kNS_MSGCONTENTPOLICY_CID, false, NULL, nsMsgContentPolicyConstructor},
   { &kNS_MSGSHUTDOWNSERVICE_CID, false, NULL, nsMsgShutdownServiceConstructor},
   { &kMAILDIRPROVIDER_CID, false, NULL, nsMailDirProviderConstructor},
   { &kNS_STOPWATCH_CID, false, NULL, nsStopwatchConstructor},
+  { &kNS_MAILNEWSDLF_CID, false, NULL, MailNewsDLFConstructor},
   // Address Book Entries
   { &kNS_ABMANAGER_CID, false, NULL, nsAbManagerConstructor },
   { &kNS_ABDIRECTORYDATASOURCE_CID, false, NULL, nsAbDirectoryDataSourceConstructor },
   { &kNS_ABDIRECTORY_CID, false, NULL, nsAbBSDirectoryConstructor },
   { &kNS_ABMDBDIRECTORY_CID, false, NULL, nsAbMDBDirectoryConstructor },
   { &kNS_ABMDBCARD_CID, false, NULL, nsAbMDBCardConstructor },
   { &kNS_ADDRDATABASE_CID, false, NULL, nsAddrDatabaseConstructor },
   { &kNS_ABCARDPROPERTY_CID, false, NULL, nsAbCardPropertyConstructor },
@@ -1035,16 +1041,17 @@ const mozilla::Module::ContractIDEntry k
 #if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_GTK2)
   { NS_MESSENGEROSINTEGRATION_CONTRACTID, &kNS_MESSENGERUNIXINTEGRATION_CID },
 #endif
   { NS_MESSENGERCONTENTHANDLER_CONTRACTID, &kNS_MESSENGERCONTENTHANDLER_CID },
   { NS_MSGCONTENTPOLICY_CONTRACTID, &kNS_MSGCONTENTPOLICY_CID },
   { NS_MSGSHUTDOWNSERVICE_CONTRACTID, &kNS_MSGSHUTDOWNSERVICE_CID },
   { NS_MAILDIRPROVIDER_CONTRACTID, &kMAILDIRPROVIDER_CID },
   { NS_STOPWATCH_CONTRACTID, &kNS_STOPWATCH_CID },
+  { NS_MAILNEWSDLF_CONTRACTID, &kNS_MAILNEWSDLF_CID },
   // Address Book Entries
   { NS_ABMANAGER_CONTRACTID, &kNS_ABMANAGER_CID },
   { NS_ABMANAGERSTARTUPHANDLER_CONTRACTID, &kNS_ABMANAGER_CID },
   { NS_ABDIRECTORYDATASOURCE_CONTRACTID, &kNS_ABDIRECTORYDATASOURCE_CID },
   { NS_ABDIRECTORY_CONTRACTID, &kNS_ABDIRECTORY_CID },
   { NS_ABMDBDIRECTORY_CONTRACTID, &kNS_ABMDBDIRECTORY_CID },
   { NS_ABMDBCARD_CONTRACTID, &kNS_ABMDBCARD_CID },
   { NS_ADDRDATABASE_CONTRACTID, &kNS_ADDRDATABASE_CID },
@@ -1196,16 +1203,17 @@ const mozilla::Module::ContractIDEntry k
   // Tokenizer Entries
   { NULL }
 };
 
 static const mozilla::Module::CategoryEntry kMailNewsCategories[] = {
   // MailNews Base Entries
   { XPCOM_DIRECTORY_PROVIDER_CATEGORY, "mail-directory-provider", NS_MAILDIRPROVIDER_CONTRACTID },
   { "content-policy", NS_MSGCONTENTPOLICY_CONTRACTID, NS_MSGCONTENTPOLICY_CONTRACTID },
+  MAILNEWSDLF_CATEGORIES
 #ifdef XP_MACOSX
   { "app-startup", NS_MESSENGEROSINTEGRATION_CONTRACTID, "service," NS_MESSENGEROSINTEGRATION_CONTRACTID}
 ,
 #endif
   // Address Book Entries
   { "command-line-handler", "m-addressbook", NS_ABMANAGERSTARTUPHANDLER_CONTRACTID },
   // Bayesian Filter Entries
   // Compose Entries