Bug 1325745 - Port bug 1301640 to mailnews. Remove nsIDateTimeFormat.h etc. and adapt calls. rs=bustage-fix
authorJorg K <jorgk@jorgk.com>
Thu, 05 Jan 2017 00:10:00 +0100
changeset 20972 2231f130a183eae79746df4da367062d0ad04a9d
parent 20971 c4d7763403e9b7996f0d467526a360aa2ca3b683
child 20973 eab361faf708c751aa61a8245d9bea83733a8e6e
push id12720
push usermozilla@jorgk.com
push dateFri, 06 Jan 2017 16:52:24 +0000
treeherdercomm-central@2231f130a183 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbustage-fix
bugs1325745, 1301640
Bug 1325745 - Port bug 1301640 to mailnews. Remove nsIDateTimeFormat.h etc. and adapt calls. rs=bustage-fix
mailnews/base/search/src/nsMsgFilter.cpp
mailnews/base/search/src/nsMsgFilter.h
mailnews/base/src/nsMsgDBView.cpp
mailnews/base/src/nsMsgDBView.h
mailnews/base/src/nsSpamSettings.cpp
mailnews/base/src/nsSpamSettings.h
mailnews/compose/src/nsMsgCompose.cpp
mailnews/mailnews.js
mailnews/mime/emitters/nsMimeBaseEmitter.cpp
mailnews/mime/emitters/nsMimeBaseEmitter.h
--- a/mailnews/base/search/src/nsMsgFilter.cpp
+++ b/mailnews/base/search/src/nsMsgFilter.cpp
@@ -16,17 +16,16 @@
 #include "nsMsgSearchTerm.h"
 #include "nsIMsgAccountManager.h"
 #include "nsIMsgIncomingServer.h"
 #include "nsMsgSearchValue.h"
 #include "nsMsgI18N.h"
 #include "nsIMutableArray.h"
 #include "nsIOutputStream.h"
 #include "nsIStringBundle.h"
-#include "nsDateTimeFormatCID.h"
 #include "nsComponentManagerUtils.h"
 #include "nsServiceManagerUtils.h"
 #include "nsIMsgFilterService.h"
 #include "prmem.h"
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/Services.h"
 
 static const char *kImapPrefix = "//imap:";
@@ -527,28 +526,20 @@ nsMsgFilter::LogRuleHitGeneric(nsIMsgRul
     nsString dateValue;
 
     GetFilterName(filterName);
     aFilterAction->GetType(&actionType);
     (void)aMsgHdr->GetDate(&date);
     PRExplodedTime exploded;
     PR_ExplodeTime(date, PR_LocalTimeParameters, &exploded);
 
-    if (!mDateFormatter)
-    {
-      mDateFormatter = do_CreateInstance(NS_DATETIMEFORMAT_CONTRACTID, &rv);
-      NS_ENSURE_SUCCESS(rv, rv);
-      if (!mDateFormatter)
-      {
-        return NS_ERROR_FAILURE;
-      }
-    }
-    mDateFormatter->FormatPRExplodedTime(nullptr, kDateFormatShort,
-                                         kTimeFormatSeconds, &exploded,
-                                         dateValue);
+    mozilla::DateTimeFormat::FormatPRExplodedTime(kDateFormatShort,
+                                                  kTimeFormatSeconds,
+                                                  &exploded,
+                                                  dateValue);
 
     (void)aMsgHdr->GetMime2DecodedAuthor(authorValue);
     (void)aMsgHdr->GetMime2DecodedSubject(subjectValue);
 
     nsCString buffer;
 #ifdef MOZILLA_INTERNAL_API
     // this is big enough to hold a log entry.
     // do this so we avoid growing and copying as we append to the log.
@@ -652,19 +643,20 @@ nsMsgFilter::LogRuleHitGeneric(nsIMsgRul
       NS_ENSURE_SUCCESS(rv, rv);
 
       buffer += NS_ConvertUTF16toUTF8(actionValue);
     }
     buffer += "\n";
 
     // Prepare timestamp
     PR_ExplodeTime(PR_Now(), PR_LocalTimeParameters, &exploded);
-    mDateFormatter->FormatPRExplodedTime(nullptr, kDateFormatShort,
-                                         kTimeFormatSeconds, &exploded,
-                                         dateValue);
+    mozilla::DateTimeFormat::FormatPRExplodedTime(kDateFormatShort,
+                                                  kTimeFormatSeconds,
+                                                  &exploded,
+                                                  dateValue);
 
     nsCString timestampString(LOG_ENTRY_TIMESTAMP);
     MsgReplaceSubstring(timestampString, "$S", NS_ConvertUTF16toUTF8(dateValue).get());
 
     // XXX: Finally, here we have enough context and buffer
     // (string) to display the filtering error if we want: for
     // example, a sticky error message in status bar, etc.
 
--- a/mailnews/base/search/src/nsMsgFilter.h
+++ b/mailnews/base/search/src/nsMsgFilter.h
@@ -7,17 +7,17 @@
 #define _nsMsgFilter_H_
 
 #include "nscore.h"
 #include "nsISupports.h"
 #include "nsIMsgFilter.h"
 #include "nsIMsgSearchScopeTerm.h"
 #include "nsMsgSearchBoolExpression.h"
 #include "nsIMutableArray.h"
-#include "nsIDateTimeFormat.h"
+#include "DateTimeFormat.h"
 #include "nsIMsgFilterCustomAction.h"
 
 class nsMsgRuleAction : public nsIMsgRuleAction
 {
 public:
   NS_DECL_ISUPPORTS
 
   nsMsgRuleAction();
@@ -93,12 +93,11 @@ protected:
   bool m_temporary;
   bool m_unparseable;
   nsIMsgFilterList *m_filterList;  /* owning filter list */
   nsCOMPtr<nsIMutableArray> m_termList;       /* linked list of criteria terms */
   nsCOMPtr<nsIMsgSearchScopeTerm> m_scope;         /* default for mail rules is inbox, but news rules could
                                                   have a newsgroup - LDAP would be invalid */
   nsTArray<nsCOMPtr<nsIMsgRuleAction> > m_actionList;
   nsMsgSearchBoolExpression *m_expressionTree;
-  nsCOMPtr<nsIDateTimeFormat> mDateFormatter;
 };
 
 #endif
--- a/mailnews/base/src/nsMsgDBView.cpp
+++ b/mailnews/base/src/nsMsgDBView.cpp
@@ -16,17 +16,16 @@
 #include "MailNewsTypes2.h"
 #include "nsMsgUtils.h"
 #include "nsQuickSort.h"
 #include "nsIMsgImapMailFolder.h"
 #include "nsImapCore.h"
 #include "nsMsgFolderFlags.h"
 #include "nsIMsgLocalMailFolder.h"
 #include "nsIDOMElement.h"
-#include "nsDateTimeFormatCID.h"
 #include "nsMsgMimeCID.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 #include "nsIPrefLocalizedString.h"
 #include "nsIMsgSearchSession.h"
 #include "nsIMsgCopyService.h"
 #include "nsMsgBaseCID.h"
 #include "nsISpamSettings.h"
@@ -555,20 +554,16 @@ nsresult nsMsgDBView::FetchSubject(nsIMs
 // of the Date: date.
 nsresult nsMsgDBView::FetchDate(nsIMsgDBHdr * aHdr, nsAString &aDateString, bool rcvDate)
 {
   PRTime dateOfMsg;
   PRTime dateOfMsgLocal;
   uint32_t rcvDateSecs;
   nsresult rv;
 
-  if (!mDateFormatter)
-    mDateFormatter = do_CreateInstance(NS_DATETIMEFORMAT_CONTRACTID);
-
-  NS_ENSURE_TRUE(mDateFormatter, NS_ERROR_FAILURE);
   // Silently return Date: instead if Received: is unavailable
   if (rcvDate)
   {
     rv = aHdr->GetUint32Property("dateReceived", &rcvDateSecs);
     if (rcvDateSecs != 0)
       Seconds2PRTime(rcvDateSecs, &dateOfMsg);
   }
   if (!rcvDate || rcvDateSecs == 0)
@@ -614,21 +609,20 @@ nsresult nsMsgDBView::FetchDate(nsIMsgDB
     // was the message sent during the last week?
     if (dateOfMsgLocal >= mostRecentWeek)
     { // yes ....
       dateFormat = m_dateFormatThisWeek;
     }
   }
 
   if (NS_SUCCEEDED(rv))
-    rv = mDateFormatter->FormatPRTime(nullptr /* nsILocale* locale */,
-                                      dateFormat,
-                                      kTimeFormatNoSeconds,
-                                      dateOfMsg,
-                                      aDateString);
+    rv = mozilla::DateTimeFormat::FormatPRTime(dateFormat,
+                                               kTimeFormatNoSeconds,
+                                               dateOfMsg,
+                                               aDateString);
 
   return rv;
 }
 
 nsresult nsMsgDBView::FetchStatus(uint32_t aFlags, nsAString &aStatusString)
 {
   if (aFlags & nsMsgMessageFlags::Replied)
     aStatusString = kRepliedString;
@@ -7809,17 +7803,16 @@ nsresult nsMsgDBView::CopyDBView(nsMsgDB
   aNewMsgDBView->m_viewFlags = m_viewFlags;
   aNewMsgDBView->m_sortOrder = m_sortOrder;
   aNewMsgDBView->m_sortType = m_sortType;
   aNewMsgDBView->m_curCustomColumn = m_curCustomColumn;
   aNewMsgDBView->m_secondarySort = m_secondarySort;
   aNewMsgDBView->m_secondarySortOrder = m_secondarySortOrder;
   aNewMsgDBView->m_secondaryCustomColumn = m_secondaryCustomColumn;
   aNewMsgDBView->m_db = m_db;
-  aNewMsgDBView->mDateFormatter = mDateFormatter;
   if (m_db)
     aNewMsgDBView->m_db->AddListener(aNewMsgDBView);
   aNewMsgDBView->mIsNews = mIsNews;
   aNewMsgDBView->mIsRss = mIsRss;
   aNewMsgDBView->mIsXFVirtual = mIsXFVirtual;
   aNewMsgDBView->mShowSizeInLines = mShowSizeInLines;
   aNewMsgDBView->mDeleteModel = mDeleteModel;
   aNewMsgDBView->m_flags = m_flags;
--- a/mailnews/base/src/nsMsgDBView.h
+++ b/mailnews/base/src/nsMsgDBView.h
@@ -13,17 +13,17 @@
 #include "nsIMsgHdr.h"
 #include "MailNewsTypes.h"
 #include "nsIDBChangeListener.h"
 #include "nsITreeView.h"
 #include "nsITreeBoxObject.h"
 #include "nsITreeSelection.h"
 #include "nsIMsgFolder.h"
 #include "nsIMsgThread.h"
-#include "nsIDateTimeFormat.h"
+#include "DateTimeFormat.h"
 #include "nsIDOMElement.h"
 #include "nsIAtom.h"
 #include "nsIImapIncomingServer.h"
 #include "nsIWeakReference.h"
 #include "nsIMsgFilterPlugin.h"
 #include "nsIStringBundle.h"
 #include "nsMsgTagService.h"
 #include "nsCOMArray.h"
@@ -420,17 +420,16 @@ protected:
   nsMsgViewSortOrderValue m_sortOrder;
   nsString m_curCustomColumn;
   nsMsgViewSortTypeValue m_secondarySort;
   nsMsgViewSortOrderValue m_secondarySortOrder;
   nsString m_secondaryCustomColumn;
   nsMsgViewFlagsTypeValue m_viewFlags;
 
   // I18N date formatter service which we'll want to cache locally.
-  nsCOMPtr<nsIDateTimeFormat> mDateFormatter;
   nsCOMPtr<nsIMsgTagService> mTagService;
   nsWeakPtr mMessengerWeak;
   nsWeakPtr mMsgWindowWeak;
   nsCOMPtr<nsIMsgDBViewCommandUpdater> mCommandUpdater; // we push command update notifications to the UI from this.
   nsCOMPtr<nsIStringBundle> mMessengerStringBundle;  
 
   // used for the preference labels
   nsString mLabelPrefDescriptions[PREF_LABELS_MAX];
--- a/mailnews/base/src/nsSpamSettings.cpp
+++ b/mailnews/base/src/nsSpamSettings.cpp
@@ -15,17 +15,16 @@
 #include "nsImapCore.h"
 #include "nsIImapIncomingServer.h"
 #include "nsIRDFService.h"
 #include "nsIRDFResource.h"
 #include "nsAppDirectoryServiceDefs.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 #include "nsIStringBundle.h"
-#include "nsDateTimeFormatCID.h"
 #include "mozilla/Services.h"
 #include "mozilla/mailnews/MimeHeaderParser.h"
 #include "nsIArray.h"
 #include "nsArrayUtils.h"
 #include "nsMailDirServiceDefs.h"
 #include "nsDirectoryServiceUtils.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsISimpleEnumerator.h"
@@ -645,28 +644,20 @@ NS_IMETHODIMP nsSpamSettings::LogJunkHit
   nsString authorValue;
   nsString subjectValue;
   nsString dateValue;
 
   (void)aMsgHdr->GetDate(&date);
   PRExplodedTime exploded;
   PR_ExplodeTime(date, PR_LocalTimeParameters, &exploded);
 
-  if (!mDateFormatter)
-  {
-    mDateFormatter = do_CreateInstance(NS_DATETIMEFORMAT_CONTRACTID, &rv);
-    NS_ENSURE_SUCCESS(rv, rv);
-    if (!mDateFormatter)
-    {
-      return NS_ERROR_FAILURE;
-    }
-  }
-  mDateFormatter->FormatPRExplodedTime(nullptr, kDateFormatShort,
-                                      kTimeFormatSeconds, &exploded,
-                                      dateValue);
+  mozilla::DateTimeFormat::FormatPRExplodedTime(kDateFormatShort,
+                                                kTimeFormatSeconds,
+                                                &exploded,
+                                                dateValue);
 
   (void)aMsgHdr->GetMime2DecodedAuthor(authorValue);
   (void)aMsgHdr->GetMime2DecodedSubject(subjectValue);
 
   nsCString buffer;
   // this is big enough to hold a log entry.
   // do this so we avoid growing and copying as we append to the log.
 #ifdef MOZILLA_INTERNAL_API
@@ -727,28 +718,20 @@ NS_IMETHODIMP nsSpamSettings::LogJunkStr
 
   if (!loggingEnabled)
     return NS_OK;
 
   nsString dateValue;
   PRExplodedTime exploded;
   PR_ExplodeTime(PR_Now(), PR_LocalTimeParameters, &exploded);
 
-  if (!mDateFormatter)
-  {
-    mDateFormatter = do_CreateInstance(NS_DATETIMEFORMAT_CONTRACTID, &rv);
-    NS_ENSURE_SUCCESS(rv, rv);
-    if (!mDateFormatter)
-    {
-      return NS_ERROR_FAILURE;
-    }
-  }
-  mDateFormatter->FormatPRExplodedTime(nullptr, kDateFormatShort,
-                                       kTimeFormatSeconds, &exploded,
-                                       dateValue);
+  mozilla::DateTimeFormat::FormatPRExplodedTime(kDateFormatShort,
+                                                kTimeFormatSeconds,
+                                                &exploded,
+                                                dateValue);
 
   nsCString timestampString(LOG_ENTRY_TIMESTAMP);
   MsgReplaceSubstring(timestampString, "$S", NS_ConvertUTF16toUTF8(dateValue).get());
 
   nsCOMPtr <nsIOutputStream> logStream;
   rv = GetLogStream(getter_AddRefs(logStream));
   NS_ENSURE_SUCCESS(rv,rv);
 
--- a/mailnews/base/src/nsSpamSettings.h
+++ b/mailnews/base/src/nsSpamSettings.h
@@ -7,17 +7,17 @@
 #define nsSpamSettings_h__
 
 #include "nsCOMPtr.h"
 #include "nsISpamSettings.h"
 #include "nsStringGlue.h"
 #include "nsIOutputStream.h"
 #include "nsIMsgIncomingServer.h"
 #include "nsIUrlListener.h"
-#include "nsIDateTimeFormat.h"
+#include "DateTimeFormat.h"
 #include "nsCOMArray.h"
 #include "nsIAbDirectory.h"
 #include "nsTArray.h"
 
 class nsSpamSettings : public nsISpamSettings, public nsIUrlListener
 {
 public:
   nsSpamSettings();
@@ -45,18 +45,16 @@ private:
   nsCString mActionTargetFolder;
   nsCString mWhiteListAbURI;
   nsCString mCurrentJunkFolderURI; // used to detect changes to the spam folder in ::initialize
 
   nsCString mServerFilterName;
   nsCOMPtr<nsIFile> mServerFilterFile;
   int32_t  mServerFilterTrustFlags;
 
-  nsCOMPtr<nsIDateTimeFormat> mDateFormatter;
-
   // array of address directories to use in junk whitelisting
   nsCOMArray<nsIAbDirectory> mWhiteListDirArray;
   // mail domains to use in junk whitelisting
   nsCString mTrustedMailDomains;
   // should we inhibit whitelisting address of identity?
   bool mInhibitWhiteListingIdentityUser;
   // should we inhibit whitelisting domain of identity?
   bool mInhibitWhiteListingIdentityDomain;
--- a/mailnews/compose/src/nsMsgCompose.cpp
+++ b/mailnews/compose/src/nsMsgCompose.cpp
@@ -42,18 +42,17 @@
 #include "nsIMIMEService.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsIDocShellTreeOwner.h"
 #include "nsIWindowMediator.h"
 #include "nsIURL.h"
 #include "nsIMsgMailSession.h"
 #include "nsMsgBaseCID.h"
 #include "nsMsgMimeCID.h"
-#include "nsDateTimeFormatCID.h"
-#include "nsIDateTimeFormat.h"
+#include "DateTimeFormat.h"
 #include "nsILocaleService.h"
 #include "nsILocale.h"
 #include "nsIMsgComposeService.h"
 #include "nsIMsgComposeProgressParams.h"
 #include "nsMsgUtils.h"
 #include "nsIMsgImapMailFolder.h"
 #include "nsImapCore.h"
 #include "nsUnicharUtils.h"
@@ -86,32 +85,28 @@
 #include "nsIProtocolHandler.h"
 #include "nsContentUtils.h"
 #include "nsIFileURL.h"
 
 using namespace mozilla;
 using namespace mozilla::mailnews;
 
 static nsresult GetReplyHeaderInfo(int32_t* reply_header_type,
-                                   nsString& reply_header_locale,
                                    nsString& reply_header_authorwrote,
                                    nsString& reply_header_ondateauthorwrote,
                                    nsString& reply_header_authorwroteondate,
                                    nsString& reply_header_originalmessage)
 {
   nsresult rv;
   *reply_header_type = 0;
   nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
   NS_ENSURE_SUCCESS(rv, rv);
 
   // If fetching any of the preferences fails,
   // we return early with header_type = 0 meaning "no header".
-  rv = NS_GetUnicharPreferenceWithDefault(prefBranch, "mailnews.reply_header_locale", EmptyString(), reply_header_locale);
-  NS_ENSURE_SUCCESS(rv, rv);
-
   rv = NS_GetLocalizedUnicharPreference(prefBranch, "mailnews.reply_header_authorwrotesingle",
                                         reply_header_authorwrote);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = NS_GetLocalizedUnicharPreference(prefBranch, "mailnews.reply_header_ondateauthorwrote",
                                         reply_header_ondateauthorwrote);
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -2328,23 +2323,21 @@ QuotingOutputStreamListener::QuotingOutp
   mHtmlToQuote = htmlToQuote;
   mQuote = msgQuote;
   mCharsetFixed = charsetFixed;
 
   if (!mHeadersOnly || !mHtmlToQuote.IsEmpty())
   {
     // Get header type, locale and strings from pref.
     int32_t replyHeaderType;
-    nsAutoString replyHeaderLocale;
     nsString replyHeaderAuthorWrote;
     nsString replyHeaderOnDateAuthorWrote;
     nsString replyHeaderAuthorWroteOnDate;
     nsString replyHeaderOriginalmessage;
     GetReplyHeaderInfo(&replyHeaderType,
-                       replyHeaderLocale,
                        replyHeaderAuthorWrote,
                        replyHeaderOnDateAuthorWrote,
                        replyHeaderAuthorWroteOnDate,
                        replyHeaderOriginalmessage);
 
     // For the built message body...
     if (originalMsgHdr && !quoteHeaders)
     {
@@ -2396,53 +2389,38 @@ QuotingOutputStreamListener::QuotingOutp
       }
 
       if (citingHeader)
       {
         int32_t placeholderIndex = kNotFound;
 
         if (headerDate)
         {
-          nsCOMPtr<nsIDateTimeFormat> dateFormatter = do_CreateInstance(NS_DATETIMEFORMAT_CONTRACTID, &rv);
+          PRTime originalMsgDate;
+          rv = originalMsgHdr->GetDate(&originalMsgDate);
           if (NS_SUCCEEDED(rv))
           {
-            PRTime originalMsgDate;
-            rv = originalMsgHdr->GetDate(&originalMsgDate);
-            if (NS_SUCCEEDED(rv))
+            nsAutoString citeDatePart;
+            if ((placeholderIndex = mCitePrefix.Find("#2")) != kNotFound)
             {
-              nsCOMPtr<nsILocale> locale;
-              nsCOMPtr<nsILocaleService> localeService(do_GetService(NS_LOCALESERVICE_CONTRACTID));
-
-              // Format date using "mailnews.reply_header_locale", if empty then use application default locale.
-              if (!replyHeaderLocale.IsEmpty())
-                rv = localeService->NewLocale(replyHeaderLocale, getter_AddRefs(locale));
+              rv = mozilla::DateTimeFormat::FormatPRTime(kDateFormatShort,
+                                                         kTimeFormatNone,
+                                                         originalMsgDate,
+                                                         citeDatePart);
               if (NS_SUCCEEDED(rv))
-              {
-                nsAutoString citeDatePart;
-                if ((placeholderIndex = mCitePrefix.Find("#2")) != kNotFound)
-                {
-                  rv = dateFormatter->FormatPRTime(locale,
-                                                   kDateFormatShort,
-                                                   kTimeFormatNone,
-                                                   originalMsgDate,
-                                                   citeDatePart);
-                  if (NS_SUCCEEDED(rv))
-                    mCitePrefix.Replace(placeholderIndex, 2, citeDatePart);
-                }
-                if ((placeholderIndex = mCitePrefix.Find("#3")) != kNotFound)
-                {
-                  rv = dateFormatter->FormatPRTime(locale,
-                                                   kDateFormatNone,
-                                                   kTimeFormatNoSeconds,
-                                                   originalMsgDate,
-                                                   citeDatePart);
-                  if (NS_SUCCEEDED(rv))
-                    mCitePrefix.Replace(placeholderIndex, 2, citeDatePart);
-                }
-              }
+                mCitePrefix.Replace(placeholderIndex, 2, citeDatePart);
+            }
+            if ((placeholderIndex = mCitePrefix.Find("#3")) != kNotFound)
+            {
+              rv = mozilla::DateTimeFormat::FormatPRTime(kDateFormatNone,
+                                                         kTimeFormatNoSeconds,
+                                                         originalMsgDate,
+                                                         citeDatePart);
+              if (NS_SUCCEEDED(rv))
+                mCitePrefix.Replace(placeholderIndex, 2, citeDatePart);
             }
           }
         }
 
         if ((placeholderIndex = mCitePrefix.Find("#1")) != kNotFound)
         {
           nsAutoCString author;
           rv = originalMsgHdr->GetAuthor(getter_Copies(author));
--- a/mailnews/mailnews.js
+++ b/mailnews/mailnews.js
@@ -226,18 +226,16 @@ pref("mail.dsn.ret_full_on", true);     
 pref("news.show_size_in_lines",             true);
 pref("news.update_unread_on_expand",        true);
 pref("news.get_messages_on_select",         true);
 
 pref("mailnews.wraplength",                 72);
 
 // 0=no header, 1="<author> wrote:", 2="On <date> <author> wrote:", 3="<author> wrote On <date>:", 4=user specified
 pref("mailnews.reply_header_type",          1);
-// locale which affects date format, set empty string to use application default locale
-pref("mailnews.reply_header_locale",        "");
 pref("mailnews.reply_header_authorwrotesingle", "chrome://messenger/locale/messengercompose/composeMsgs.properties");
 pref("mailnews.reply_header_ondateauthorwrote", "chrome://messenger/locale/messengercompose/composeMsgs.properties");
 pref("mailnews.reply_header_authorwroteondate", "chrome://messenger/locale/messengercompose/composeMsgs.properties");
 pref("mailnews.reply_header_originalmessage",   "chrome://messenger/locale/messengercompose/composeMsgs.properties");
 pref("mailnews.forward_header_originalmessage", "chrome://messenger/locale/messengercompose/composeMsgs.properties");
 
 pref("mailnews.reply_to_self_check_all_ident", false);
 
--- a/mailnews/mime/emitters/nsMimeBaseEmitter.cpp
+++ b/mailnews/mime/emitters/nsMimeBaseEmitter.cpp
@@ -20,17 +20,16 @@
 #include "nsIMimeStreamConverter.h"
 #include "nsIMimeConverter.h"
 #include "nsMsgMimeCID.h"
 #include "mozilla/Logging.h"
 #include "prprf.h"
 #include "nsIMimeHeaders.h"
 #include "nsIMsgWindow.h"
 #include "nsIMsgMailNewsUrl.h"
-#include "nsDateTimeFormatCID.h"
 #include "nsServiceManagerUtils.h"
 #include "nsComponentManagerUtils.h"
 #include "nsMsgUtils.h"
 #include "nsTextFormatter.h"
 #include "mozilla/Services.h"
 #include <algorithm>
 
 static PRLogModuleInfo * gMimeEmitterLogModule = nullptr;
@@ -658,21 +657,16 @@ nsMimeBaseEmitter::AddAllHeaders(const n
 
 nsresult
 nsMimeBaseEmitter::GenerateDateString(const char * dateString,
                                       nsACString &formattedDate,
                                       bool showDateForToday)
 {
   nsresult rv = NS_OK;
 
-  if (!mDateFormatter) {
-    mDateFormatter = do_CreateInstance(NS_DATETIMEFORMAT_CONTRACTID, &rv);
-    NS_ENSURE_SUCCESS(rv, rv);
-  }
-
   /**
    * See if the user wants to have the date displayed in the senders
    * timezone (including the timezone offset).
    * We also evaluate the pref original_date which was introduced
    * as makeshift in bug 118899.
    */
   bool displaySenderTimezone = false;
   bool displayOriginalDate = false;
@@ -725,21 +719,20 @@ nsMimeBaseEmitter::GenerateDateString(co
       explodedCurrentTime.tm_mday == explodedCompTime.tm_mday)
   {
     // same day...
     dateFormat = kDateFormatNone;
   }
 
   nsAutoString formattedDateString;
 
-  rv = mDateFormatter->FormatPRExplodedTime(nullptr /* nsILocale* locale */,
-                                            dateFormat,
-                                            kTimeFormatNoSeconds,
-                                            &explodedCompTime,
-                                            formattedDateString);
+  rv = mozilla::DateTimeFormat::FormatPRExplodedTime(dateFormat,
+                                                     kTimeFormatNoSeconds,
+                                                     &explodedCompTime,
+                                                     formattedDateString);
 
   if (NS_SUCCEEDED(rv))
   {
     if (displaySenderTimezone)
     {
       // offset of local time from UTC in minutes
       int32_t senderoffset = (explodedMsgTime.tm_params.tp_gmt_offset +
                               explodedMsgTime.tm_params.tp_dst_offset) / 60;
--- a/mailnews/mime/emitters/nsMimeBaseEmitter.h
+++ b/mailnews/mime/emitters/nsMimeBaseEmitter.h
@@ -17,17 +17,17 @@
 #include "nsIMimeMiscStatus.h"
 #include "nsIPipe.h"
 #include "nsIStringBundle.h"
 #include "nsCOMPtr.h"
 #include "nsTArray.h"
 #include "nsIMimeConverter.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
-#include "nsIDateTimeFormat.h"
+#include "DateTimeFormat.h"
 
 //
 // The base emitter will serve as the place to do all of the caching,
 // sorting, etc... of mail headers and bodies for this internally developed
 // emitter library. The other emitter classes in this file (nsMimeHTMLEmitter, etc.)
 // will only be concerned with doing output processing ONLY.
 //
 
@@ -132,16 +132,15 @@ protected:
   bool                mFirstHeaders;
 
   // For the format being used...
   int32_t             mFormat;
 
   // For I18N Conversion...
   nsCOMPtr<nsIMimeConverter> mUnicodeConverter;
   nsString            mCharset;
-  nsCOMPtr<nsIDateTimeFormat> mDateFormatter;
   nsresult GenerateDateString(const char * dateString, nsACString& formattedDate,
                               bool showDateForToday);
   // The caller is expected to free the result of GetLocalizedDateString
   char* GetLocalizedDateString(const char * dateString);
 };
 
 #endif /* _nsMimeBaseEmitter_h_ */