Bug 1559190 - Port Bug 1559190 |Correctly fix Bug 1023285 and utf8 addressing header display for jsmime| to SeaMonkey. r=frg
authorIan Neal <iann_cvs@blueyonder.co.uk>
Thu, 13 Jun 2019 21:42:05 +0200
changeset 35859 bc36808a82ecf983c6bede5a61398109ee0e007f
parent 35858 4c8023a1601737c97066fcd6a35be835b3497e2c
child 35860 39836474eb698ff365f89544b0156419e4d71208
push id392
push userclokep@gmail.com
push dateMon, 02 Sep 2019 20:17:19 +0000
reviewersfrg
bugs1559190, 1023285
Bug 1559190 - Port Bug 1559190 |Correctly fix Bug 1023285 and utf8 addressing header display for jsmime| to SeaMonkey. r=frg imported patch 1559190.patch
suite/mailnews/content/msgHdrViewOverlay.js
--- a/suite/mailnews/content/msgHdrViewOverlay.js
+++ b/suite/mailnews/content/msgHdrViewOverlay.js
@@ -1083,42 +1083,36 @@ function OutputMessageIds(headerEntry, h
 
 function OutputEmailAddresses(headerEntry, emailAddresses)
 {
   if (!emailAddresses)
     return;
 
   if (msgHeaderParser)
   {
-    var addresses = {};
-    var fullNames = {};
-    var names = {};
-    var numAddresses =  0;
+    // The email addresses are still RFC2047 encoded but libmime has already
+    // converted from "raw UTF-8" to "wide" (UTF-16) characters.
+    var addresses = msgHeaderParser.parseEncodedHeaderW(emailAddresses);
 
-    numAddresses = msgHeaderParser.parseHeadersWithArray(emailAddresses, addresses, names, fullNames);
-    var index = 0;
-    while (index < numAddresses)
-    {
+    for (let addr of addresses) {
       // if we want to include short/long toggle views and we have a long view, always add it.
       // if we aren't including a short/long view OR if we are and we haven't parsed enough
       // addresses to reach the cutoff valve yet then add it to the default (short) div.
       var address = {};
-      address.emailAddress = addresses.value[index] || "";
-      address.fullAddress = fullNames.value[index] || "";
-      address.displayName = names.value[index] || "";
+      address.emailAddress = addr.email || "";
+      address.fullAddress = addr.toString() || "";
+      address.displayName = addr.name || "";
       if (headerEntry.useToggle)
         headerEntry.enclosingBox.addAddressView(address);
       else
         updateEmailAddressNode(headerEntry.enclosingBox.emailAddressNode, address);
 
       if (headerEntry.enclosingBox.getAttribute("id") == "expandedfromBox") {
         setFromBuddyIcon(addresses.value[index]);
       }
-
-      index++;
     }
 
     if (headerEntry.useToggle)
       headerEntry.enclosingBox.buildViews();
   } // if msgheader parser
 }
 
 function setFromBuddyIcon(email)