Bug 1268014 - downgrade message to plain text if it only contains our moz- classes. r=jorgk a=rkent THUNDERBIRD452b1_2016051723_RELBRANCH
authoraceman <acelists@atlas.sk>
Sat, 30 Apr 2016 13:26:29 +0200
branchTHUNDERBIRD452b1_2016051723_RELBRANCH
changeset 24613 15397c0df6eeebc9d366e27a236bc1396184e8be
parent 24612 1c1a6751370b50aa6c495bcf4e2545e6f27b4050
child 24614 d15084ee9caea3e9e2cb3ff55da668ae9a3cf495
push id1641
push userkent@caspia.com
push dateWed, 18 May 2016 07:34:32 +0000
treeherdercomm-beta@3d73a3597a7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorgk, rkent
bugs1268014
Bug 1268014 - downgrade message to plain text if it only contains our moz- classes. r=jorgk a=rkent
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
@@ -5256,23 +5256,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())