Bug 1463133 - Remove unnecessary MIME preludes. r=mkmelin a=jorgk
authorJorg K <jorgk@jorgk.com>
Wed, 23 May 2018 00:07:52 +0200
changeset 31524 e7dc4d839a03c0340d8fd7d163974c4831b9b03b
parent 31523 74d4c8c64c9cf3c9fc545652eecc562e3c8a5c64
child 31525 f195c00d27e2d46073995fb5af6f70c573a823b4
push id21
push usermozilla@hocat.ca
push dateFri, 13 Jul 2018 19:54:19 +0000
treeherdercomm-esr60@3c593339cb1d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin, jorgk
bugs1463133
Bug 1463133 - Remove unnecessary MIME preludes. r=mkmelin a=jorgk
mailnews/mime/src/mimeTextHTMLParsed.cpp
mailnews/mime/src/mimethsa.cpp
mailnews/mime/src/mimethtm.cpp
--- a/mailnews/mime/src/mimeTextHTMLParsed.cpp
+++ b/mailnews/mime/src/mimeTextHTMLParsed.cpp
@@ -56,40 +56,16 @@ static int
 MimeInlineTextHTMLParsed_parse_begin(MimeObject *obj)
 {
   MimeInlineTextHTMLParsed *me = (MimeInlineTextHTMLParsed *)obj;
   me->complete_buffer = new nsString();
   int status = ((MimeObjectClass*)&MIME_SUPERCLASS)->parse_begin(obj);
   if (status < 0)
     return status;
 
-  // Dump the charset we get from the mime headers into a HTML <meta http-equiv>.
-  char *content_type = obj->headers ?
-    MimeHeaders_get(obj->headers, HEADER_CONTENT_TYPE, false, false) : 0;
-  if (content_type)
-  {
-    char* charset = MimeHeaders_get_parameter(content_type,
-                                              HEADER_PARM_CHARSET,
-                                              NULL, NULL);
-    PR_Free(content_type);
-    if (charset)
-    {
-      nsAutoCString charsetline(
-        "\n<meta http-equiv=\"content-type\" content=\"text/html; charset=");
-      charsetline += charset;
-      charsetline += "\">\n";
-      int status = MimeObject_write(obj,
-                                    charsetline.get(),
-                                    charsetline.Length(),
-                                    true);
-      PR_Free(charset);
-      if (status < 0)
-        return status;
-    }
-  }
   return 0;
 }
 
 static int
 MimeInlineTextHTMLParsed_parse_eof(MimeObject *obj, bool abort_p)
 {
 
   if (obj->closed_p)
--- a/mailnews/mime/src/mimethsa.cpp
+++ b/mailnews/mime/src/mimethsa.cpp
@@ -63,40 +63,16 @@ static int
 MimeInlineTextHTMLSanitized_parse_begin(MimeObject *obj)
 {
   MimeInlineTextHTMLSanitized *me = (MimeInlineTextHTMLSanitized *)obj;
   me->complete_buffer = new nsString();
   int status = ((MimeObjectClass*)&MIME_SUPERCLASS)->parse_begin(obj);
   if (status < 0)
     return status;
 
-  // Dump the charset we get from the mime headers into a HTML <meta http-equiv>.
-  char *content_type = obj->headers ?
-    MimeHeaders_get(obj->headers, HEADER_CONTENT_TYPE, false, false) : 0;
-  if (content_type)
-  {
-    char* charset = MimeHeaders_get_parameter(content_type,
-                                              HEADER_PARM_CHARSET,
-                                              NULL, NULL);
-    PR_Free(content_type);
-    if (charset)
-    {
-      nsAutoCString charsetline(
-        "\n<meta http-equiv=\"content-type\" content=\"text/html; charset=");
-      charsetline += charset;
-      charsetline += "\">\n";
-      int status = MimeObject_write(obj,
-                                    charsetline.get(),
-                                    charsetline.Length(),
-                                    true);
-      PR_Free(charset);
-      if (status < 0)
-        return status;
-    }
-  }
   return 0;
 }
 
 static int
 MimeInlineTextHTMLSanitized_parse_eof(MimeObject *obj, bool abort_p)
 {
   if (obj->closed_p)
     return 0;
--- a/mailnews/mime/src/mimethtm.cpp
+++ b/mailnews/mime/src/mimethtm.cpp
@@ -38,37 +38,16 @@ MimeInlineTextHTML_parse_begin (MimeObje
   int status = ((MimeObjectClass*)&mimeLeafClass)->parse_begin(obj);
   if (status < 0) return status;
 
   if (!obj->output_p) return 0;
 
   status = MimeObject_write_separator(obj);
   if (status < 0) return status;
 
-  // Set a default font (otherwise unicode font will be used since the data is UTF-8).
-  if (nsMimeOutput::nsMimeMessageBodyDisplay == obj->options->format_out ||
-      nsMimeOutput::nsMimeMessagePrintOutput == obj->options->format_out)
-  {
-    char buf[256];            // local buffer for html tag
-    int32_t fontSize;         // default font size
-    int32_t fontSizePercentage;   // size percentage
-    nsAutoCString fontLang;       // langgroup of the font.
-    if (NS_SUCCEEDED(GetMailNewsFont(obj, false, &fontSize, &fontSizePercentage,fontLang)))
-    {
-      PR_snprintf(buf, 256, "<div class=\"moz-text-html\"  lang=\"%s\">",
-                  fontLang.get());
-      status = MimeObject_write(obj, buf, strlen(buf), true);
-    }
-    else
-    {
-      status = MimeObject_write(obj, "<div class=\"moz-text-html\">", 27, true);
-    }
-    if(status<0) return status;
-  }
-
   MimeInlineTextHTML  *textHTML = (MimeInlineTextHTML *) obj;
 
   textHTML->charset = nullptr;
 
   /* If this HTML part has a Content-Base header, and if we're displaying
    to the screen (that is, not writing this part "raw") then translate
    that Content-Base header into a <BASE> tag in the HTML.
   */
@@ -193,14 +172,10 @@ MimeInlineTextHTML_parse_eof (MimeObject
   if (obj->closed_p) return 0;
 
   PR_FREEIF(textHTML->charset);
 
   /* Run parent method first, to flush out any buffered data. */
   status = ((MimeObjectClass*)&MIME_SUPERCLASS)->parse_eof(obj, abort_p);
   if (status < 0) return status;
 
-  if (nsMimeOutput::nsMimeMessageBodyDisplay == obj->options->format_out ||
-      nsMimeOutput::nsMimeMessagePrintOutput == obj->options->format_out)
-    status = MimeObject_write(obj, "</div>", 6, false);
-
   return 0;
 }