Bug 1342838 - MIME emitter needs to use asciispec for external link urls for IDN domains. r=jorgk a=jorgk DONTBUILD
authoralta88@gmail.com
Sat, 25 Feb 2017 08:41:44 -0700
changeset 27014 bc2a611452511e912ee56ecaf961134ea40ee249
parent 27013 1fb01df732dcb7d742f06dc10f05f96e27952e45
child 27015 e2570582f4b23958b3e4463b64766e7a679e0bfb
push id1875
push usermozilla@jorgk.com
push dateSat, 04 Mar 2017 00:10:50 +0000
treeherdercomm-beta@bc2a61145251 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorgk, jorgk
bugs1342838
Bug 1342838 - MIME emitter needs to use asciispec for external link urls for IDN domains. r=jorgk a=jorgk DONTBUILD
mailnews/mime/src/mimemoz2.cpp
--- a/mailnews/mime/src/mimemoz2.cpp
+++ b/mailnews/mime/src/mimemoz2.cpp
@@ -49,16 +49,17 @@
 #include "mimeeobj.h"
 // <for functions="HTML2Plaintext,HTMLSantinize">
 #include "nsXPCOM.h"
 #include "nsLayoutCID.h"
 #include "nsIComponentManager.h"
 #include "nsIParserUtils.h"
 // </for>
 #include "mozilla/Services.h"
+#include "mozilla/Unused.h"
 
 void                 ValidateRealName(nsMsgAttachmentData *aAttach, MimeHeaders *aHdrs);
 
 static MimeHeadersState MIME_HeaderType;
 static bool MIME_WrapLongLines;
 static bool MIME_VariableWidthPlaintext;
 
 mime_stream_data::mime_stream_data() : url_name(nullptr), orig_url_name(nullptr),
@@ -674,25 +675,28 @@ NotifyEmittersOfAttachmentList(MimeDispl
     {
       ++i;
       ++tmp;
       continue;
     }
 
     nsAutoCString spec;
     if (tmp->m_url) {
-      // In C++ code |Unused <<| is used instead of |(void)|.
-      (void) tmp->m_url->GetSpec(spec);
+      if (tmp->m_isExternalLinkAttachment)
+        mozilla::Unused << tmp->m_url->GetAsciiSpec(spec);
+      else
+        mozilla::Unused << tmp->m_url->GetSpec(spec);
     }
 
     nsAutoCString sizeStr;
     if (tmp->m_isExternalLinkAttachment)
       sizeStr.Append(tmp->m_sizeExternalStr);
     else
       sizeStr.AppendInt(tmp->m_size);
+
     nsAutoCString downloadedStr;
     downloadedStr.AppendInt(tmp->m_isDownloaded);
 
     mimeEmitterStartAttachment(opt, tmp->m_realName.get(), tmp->m_realType.get(),
                                spec.get(), tmp->m_isExternalAttachment);
     mimeEmitterAddAttachmentField(opt, HEADER_X_MOZILLA_PART_URL, spec.get());
     mimeEmitterAddAttachmentField(opt, HEADER_X_MOZILLA_PART_SIZE, sizeStr.get());
     mimeEmitterAddAttachmentField(opt, HEADER_X_MOZILLA_PART_DOWNLOADED, downloadedStr.get());