Bug 1146099 - Use jsmime decoder instead of M-C netwerk stuff. r=rkent a=jorgk
authorJorg K <mozilla@jorgk.com>
Wed, 13 Jul 2016 21:31:19 +0200
changeset 27304 d27fd60554341c443841286a115b7c0fe39e37f9
parent 27303 117e0210d6368738c19dab3ed0ca68edaf4be87e
child 27305 5a9f587d9da80f08a8a09c6d0ac70991d5f8a9da
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrkent, jorgk
bugs1146099
Bug 1146099 - Use jsmime decoder instead of M-C netwerk stuff. r=rkent a=jorgk
mailnews/mime/src/comi18n.cpp
mailnews/mime/test/unit/test_message_attachment.js
--- a/mailnews/mime/src/comi18n.cpp
+++ b/mailnews/mime/src/comi18n.cpp
@@ -3,39 +3,41 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "comi18n.h"
 #include "nsIStringCharsetDetector.h"
 #include "nsMsgUtils.h"
 #include "nsICharsetConverterManager.h"
 #include "nsIMIMEHeaderParam.h"
-#include "nsNetCID.h"
 #include "nsServiceManagerUtils.h"
 #include "nsComponentManagerUtils.h"
+#include "nsMsgMimeCID.h"
+#include "nsIMimeConverter.h"
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // BEGIN PUBLIC INTERFACE
 extern "C" {
 
 
 void MIME_DecodeMimeHeader(const char *header, const char *default_charset,
                            bool override_charset, bool eatContinuations,
                            nsACString &result)
 {
   nsresult rv;
-  nsCOMPtr <nsIMIMEHeaderParam> mimehdrpar = do_GetService(NS_MIMEHEADERPARAM_CONTRACTID, &rv);
-  if (NS_FAILED(rv))
-  {
+  nsCOMPtr <nsIMimeConverter> mimeConverter =
+    do_GetService(NS_MIME_CONVERTER_CONTRACTID, &rv);
+  if (NS_FAILED(rv)) {
     result.Truncate();
     return;
   }
-  mimehdrpar->DecodeRFC2047Header(header, default_charset, override_charset,
-                                  eatContinuations, result);
+  mimeConverter->DecodeMimeHeaderToUTF8(nsDependentCString(header),
+                                        default_charset, override_charset,
+                                        eatContinuations, result);
 }
 
 // UTF-8 utility functions.
 //detect charset soly based on aBuf. return in aCharset
 nsresult
 MIME_detect_charset(const char *aBuf, int32_t aLength, const char** aCharset)
 {
   nsresult res = NS_ERROR_UNEXPECTED;
--- a/mailnews/mime/test/unit/test_message_attachment.js
+++ b/mailnews/mime/test/unit/test_message_attachment.js
@@ -48,17 +48,17 @@ var messages = [
                     expectedFilename: '&lt;iframe src=&amp;quote;http://www.example.com&amp;quote&gt;&lt;/iframe&gt;.htm',
                     contentType: 'text/html;', },
                  ]},
   // no named email attachment with subject header
   { attachments: [{ body: '', expectedFilename: 'testSubject.eml' }],
     bodyPart: new SyntheticPartMultiMixed([
       new SyntheticPartLeaf('plain body text'),
       msgGen.makeMessage({
-        subject: '=?UTF-8?B?dGVzdFN1YmplY3Q?=', // This string is 'testSubject'.
+        subject: '=?UTF-8?B?dGVzdFN1YmplY3Q=?=', // This string is 'testSubject'.
         charset: 'UTF-8',
       }),
     ])},
 ];
 
 
 var gStreamListener = {
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIStreamListener]),