Bug 1268014 - downgrade message to plain text if it only contains our moz- classes. r=jorgk a=jorgk
authoraceman <acelists@atlas.sk>
Sat, 30 Apr 2016 13:26:29 +0200
changeset 27168 ebdf0edc4207c6984e90c2966b4c8ea0fce5324f
parent 27167 eef88ae6a20185eeb73d7f4b40ad47946312d152
child 27169 9d626f302fb6e27b80eb668919e7491ac35a19e8
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)
reviewersjorgk, jorgk
bugs1268014
Bug 1268014 - downgrade message to plain text if it only contains our moz- classes. r=jorgk a=jorgk
mail/test/mozmill/composition/format1-plain.eml
mailnews/compose/src/nsMsgCompose.cpp
--- a/mail/test/mozmill/composition/format1-plain.eml
+++ b/mail/test/mozmill/composition/format1-plain.eml
@@ -14,10 +14,13 @@ Content-Transfer-Encoding: 7bit
     Line 1<br>
 <p>
     Line 2
 </p>
     <pre>
 pre line 1
 pre line 2
     </pre>
+    <pre class="moz-signature" cols="72">-- 
+      Signature block
+    </pre>
   </body>
 </html>
--- a/mailnews/compose/src/nsMsgCompose.cpp
+++ b/mailnews/compose/src/nsMsgCompose.cpp
@@ -5176,23 +5176,24 @@ nsresult nsMsgCompose::TagConvertible(ns
     // style attribute on any element can change layout in any way, so that is not convertible.
     nsAutoString attribValue;
     if (NS_SUCCEEDED(node->GetAttribute(NS_LITERAL_STRING("style"), attribValue)) &&
         !attribValue.IsEmpty())
     {
       *_retval = nsIMsgCompConvertible::No;
       return NS_OK;
     }
-    // moz-txt classes are used internally by the editor, those can be discarded.
+
+    // moz-* classes are used internally by the editor and mail composition
+    // (like moz-cite or moz-signature). Those can be discarded.
     // But any other ones are unconvertible. Style can be attached to them or any
     // other context (e.g. in microformats).
     if (NS_SUCCEEDED(node->GetAttribute(NS_LITERAL_STRING("class"), attribValue)) &&
         !attribValue.IsEmpty() &&
-        !StringBeginsWith(attribValue, NS_LITERAL_STRING("moz-txt"), nsCaseInsensitiveStringComparator()) &&
-        !StringBeginsWith(attribValue, NS_LITERAL_STRING("moz-cite"), nsCaseInsensitiveStringComparator()))
+        !StringBeginsWith(attribValue, NS_LITERAL_STRING("moz-"), nsCaseInsensitiveStringComparator()))
     {
       *_retval = nsIMsgCompConvertible::No;
       return NS_OK;
     }
     // ID attributes can contain attached style/context or be target of links
     // so we should preserve them.
     if (NS_SUCCEEDED(node->GetAttribute(NS_LITERAL_STRING("id"), attribValue)) &&
         !attribValue.IsEmpty())