# HG changeset patch # Date 1369303906 -7200 # Parent 339e6c0fc10b3e4d3f487c0e34f389b35ab2d760 # User Szabolcs Hubai Bug 594646 - Tests for UTF-8 mojibake diff --git a/mail/test/mozmill/message-reader/bug594646_newline_charset_8bit.eml b/mail/test/mozmill/message-reader/bug594646_newline_charset_8bit.eml new file mode 100644 --- /dev/null +++ b/mail/test/mozmill/message-reader/bug594646_newline_charset_8bit.eml @@ -0,0 +1,23 @@ +X-Identity-Key: id1 +X-Account-Key: account2 +Date: Tue, 18 Dec 2012 13:42:01 +0100 +X-Mozilla-Draft-Info: internal/draft; vcard=0; receipt=0; DSN=0; uuencode=0 +User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:19.0) Gecko/20121217 Thunderbird/19.0a2 +MIME-Version: 1.0 +Subject: html test +X-Enigmail-Version: 1.5a1pre +Content-Type: text/html; charset=ISO-8859-2 +Content-Transfer-Encoding: 8bit + + + + + + + árvíztűrő tükörfúrógép
+ ÁRVÍZTŰRŐ TÜKÖRFÚRÓGÉP
+
+
+ + diff --git a/mail/test/mozmill/message-reader/bug594646_newline_charset_b64.eml b/mail/test/mozmill/message-reader/bug594646_newline_charset_b64.eml new file mode 100644 --- /dev/null +++ b/mail/test/mozmill/message-reader/bug594646_newline_charset_b64.eml @@ -0,0 +1,16 @@ +X-Identity-Key: id1 +X-Account-Key: account2 +Date: Tue, 18 Dec 2012 13:42:01 +0100 +X-Mozilla-Draft-Info: internal/draft; vcard=0; receipt=0; DSN=0; uuencode=0 +User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:19.0) Gecko/20121217 Thunderbird/19.0a2 +MIME-Version: 1.0 +Subject: html test +X-Enigmail-Version: 1.5a1pre +Content-Type: text/html; charset=ISO-8859-2 +Content-Transfer-Encoding: base64 + +PGh0bWw+CiAgPGhlYWQ+CiAgICA8bWV0YSBodHRwLWVxdWl2PSJjb250ZW50LXR5cGUiIGNvbnRl +bnQ9InRleHQvaHRtbDsKICAgICAgY2hhcnNldD1JU08tODg1OS0yIj4KICA8L2hlYWQ+CiAgPGJv +ZHkgYmdjb2xvcj0iI0ZGRkZGRiIgdGV4dD0iIzAwMDAwMCI+CiAgICA8dHQ+4XJ27Xp0+3L1IHT8 +a/ZyZvpy82fpcDxicj4KICAgICAgwVJWzVpU21LVIFTcS9ZSRtpS00fJUDxicj4KICAgICAgPGJy +PgogICAgPC90dD4KICA8L2JvZHk+CjwvaHRtbD4K diff --git a/mail/test/mozmill/message-reader/bug594646_newline_charset_qp.eml b/mail/test/mozmill/message-reader/bug594646_newline_charset_qp.eml new file mode 100644 --- /dev/null +++ b/mail/test/mozmill/message-reader/bug594646_newline_charset_qp.eml @@ -0,0 +1,23 @@ +X-Identity-Key: id1 +X-Account-Key: account2 +Date: Tue, 18 Dec 2012 13:42:01 +0100 +X-Mozilla-Draft-Info: internal/draft; vcard=0; receipt=0; DSN=0; uuencode=0 +User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:19.0) Gecko/20121217 Thunderbird/19.0a2 +MIME-Version: 1.0 +Subject: html test +X-Enigmail-Version: 1.5a1pre +Content-Type: text/html; charset=ISO-8859-2 +Content-Transfer-Encoding: quoted-printable + + + + + + + =E1rv=EDzt=FBr=F5 t=FCk=F6rf=FAr=F3g=E9p
+ =C1RV=CDZT=DBR=D5 T=DCK=D6RF=DAR=D3G=C9P
+
+
+ + diff --git a/mail/test/mozmill/message-reader/bug594646_newline_httpequiv_8bit.eml b/mail/test/mozmill/message-reader/bug594646_newline_httpequiv_8bit.eml new file mode 100644 --- /dev/null +++ b/mail/test/mozmill/message-reader/bug594646_newline_httpequiv_8bit.eml @@ -0,0 +1,23 @@ +X-Identity-Key: id1 +X-Account-Key: account2 +Date: Tue, 18 Dec 2012 13:42:01 +0100 +X-Mozilla-Draft-Info: internal/draft; vcard=0; receipt=0; DSN=0; uuencode=0 +User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:19.0) Gecko/20121217 Thunderbird/19.0a2 +MIME-Version: 1.0 +Subject: html test +X-Enigmail-Version: 1.5a1pre +Content-Type: text/html; charset=ISO-8859-2 +Content-Transfer-Encoding: 8bit + + + + + + + árvíztűrő tükörfúrógép
+ ÁRVÍZTŰRŐ TÜKÖRFÚRÓGÉP
+
+
+ + diff --git a/mail/test/mozmill/message-reader/bug594646_newline_httpequiv_b64.eml b/mail/test/mozmill/message-reader/bug594646_newline_httpequiv_b64.eml new file mode 100644 --- /dev/null +++ b/mail/test/mozmill/message-reader/bug594646_newline_httpequiv_b64.eml @@ -0,0 +1,16 @@ +X-Identity-Key: id1 +X-Account-Key: account2 +Date: Tue, 18 Dec 2012 13:42:01 +0100 +X-Mozilla-Draft-Info: internal/draft; vcard=0; receipt=0; DSN=0; uuencode=0 +User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:19.0) Gecko/20121217 Thunderbird/19.0a2 +MIME-Version: 1.0 +Subject: html test +X-Enigmail-Version: 1.5a1pre +Content-Type: text/html; charset=ISO-8859-2 +Content-Transfer-Encoding: base64 + +PGh0bWw+CiAgPGhlYWQ+CiAgICA8bWV0YSBjb250ZW50PSJ0ZXh0L2h0bWw7IGNoYXJzZXQ9SVNP +LTg4NTktMiIKICAgICAgaHR0cC1lcXVpdj0iY29udGVudC10eXBlIj4KICA8L2hlYWQ+CiAgPGJv +ZHkgYmdjb2xvcj0iI0ZGRkZGRiIgdGV4dD0iIzAwMDAwMCI+CiAgICA8dHQ+4XJ27Xp0+3L1IHT8 +a/ZyZvpy82fpcDxicj4KICAgICAgwVJWzVpU21LVIFTcS9ZSRtpS00fJUDxicj4KICAgICAgPGJy +PgogICAgPC90dD4KICA8L2JvZHk+CjwvaHRtbD4K diff --git a/mail/test/mozmill/message-reader/bug594646_newline_httpequiv_qp.eml b/mail/test/mozmill/message-reader/bug594646_newline_httpequiv_qp.eml new file mode 100644 --- /dev/null +++ b/mail/test/mozmill/message-reader/bug594646_newline_httpequiv_qp.eml @@ -0,0 +1,23 @@ +X-Identity-Key: id1 +X-Account-Key: account2 +Date: Tue, 18 Dec 2012 13:42:01 +0100 +X-Mozilla-Draft-Info: internal/draft; vcard=0; receipt=0; DSN=0; uuencode=0 +User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:19.0) Gecko/20121217 Thunderbird/19.0a2 +MIME-Version: 1.0 +Subject: html test +X-Enigmail-Version: 1.5a1pre +Content-Type: text/html; charset=ISO-8859-2 +Content-Transfer-Encoding: quoted-printable + + + + + + + =E1rv=EDzt=FBr=F5 t=FCk=F6rf=FAr=F3g=E9p
+ =C1RV=CDZT=DBR=D5 T=DCK=D6RF=DAR=D3G=C9P
+
+
+ + diff --git a/mail/test/mozmill/message-reader/bug594646_reference.eml b/mail/test/mozmill/message-reader/bug594646_reference.eml new file mode 100644 --- /dev/null +++ b/mail/test/mozmill/message-reader/bug594646_reference.eml @@ -0,0 +1,22 @@ +X-Identity-Key: id1 +X-Account-Key: account2 +Date: Tue, 18 Dec 2012 13:42:01 +0100 +X-Mozilla-Draft-Info: internal/draft; vcard=0; receipt=0; DSN=0; uuencode=0 +User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:19.0) Gecko/20121217 Thunderbird/19.0a2 +MIME-Version: 1.0 +Subject: html test +X-Enigmail-Version: 1.5a1pre +Content-Type: text/html; charset=ISO-8859-2 +Content-Transfer-Encoding: quoted-printable + + + + + + + =E1rv=EDzt=FBr=F5 t=FCk=F6rf=FAr=F3g=E9p
+ =C1RV=CDZT=DBR=D5 T=DCK=D6RF=DAR=D3G=C9P
+
+
+ + diff --git a/mail/test/mozmill/message-reader/bug594646_reversed_order_8bit.eml b/mail/test/mozmill/message-reader/bug594646_reversed_order_8bit.eml new file mode 100644 --- /dev/null +++ b/mail/test/mozmill/message-reader/bug594646_reversed_order_8bit.eml @@ -0,0 +1,22 @@ +X-Identity-Key: id1 +X-Account-Key: account2 +Date: Tue, 18 Dec 2012 13:42:01 +0100 +X-Mozilla-Draft-Info: internal/draft; vcard=0; receipt=0; DSN=0; uuencode=0 +User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:19.0) Gecko/20121217 Thunderbird/19.0a2 +MIME-Version: 1.0 +Subject: html test +X-Enigmail-Version: 1.5a1pre +Content-Type: text/html; charset=ISO-8859-2 +Content-Transfer-Encoding: 8bit + + + + + + + árvíztűrő tükörfúrógép
+ ÁRVÍZTŰRŐ TÜKÖRFÚRÓGÉP
+
+
+ + diff --git a/mail/test/mozmill/message-reader/bug594646_reversed_order_b64.eml b/mail/test/mozmill/message-reader/bug594646_reversed_order_b64.eml new file mode 100644 --- /dev/null +++ b/mail/test/mozmill/message-reader/bug594646_reversed_order_b64.eml @@ -0,0 +1,16 @@ +X-Identity-Key: id1 +X-Account-Key: account2 +Date: Tue, 18 Dec 2012 13:42:01 +0100 +X-Mozilla-Draft-Info: internal/draft; vcard=0; receipt=0; DSN=0; uuencode=0 +User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:19.0) Gecko/20121217 Thunderbird/19.0a2 +MIME-Version: 1.0 +Subject: html test +X-Enigmail-Version: 1.5a1pre +Content-Type: text/html; charset=ISO-8859-2 +Content-Transfer-Encoding: base64 + +PGh0bWw+CiAgPGhlYWQ+CiAgICA8bWV0YSBjb250ZW50PSJ0ZXh0L2h0bWw7IGNoYXJzZXQ9SVNP +LTg4NTktMiIgaHR0cC1lcXVpdj0iY29udGVudC10eXBlIj4KICA8L2hlYWQ+CiAgPGJvZHkgYmdj +b2xvcj0iI0ZGRkZGRiIgdGV4dD0iIzAwMDAwMCI+CiAgICA8dHQ+4XJ27Xp0+3L1IHT8a/ZyZvpy +82fpcDxicj4KICAgICAgwVJWzVpU21LVIFTcS9ZSRtpS00fJUDxicj4KICAgICAgPGJyPgogICAg +PC90dD4KICA8L2JvZHk+CjwvaHRtbD4K diff --git a/mail/test/mozmill/message-reader/bug594646_reversed_order_qp.eml b/mail/test/mozmill/message-reader/bug594646_reversed_order_qp.eml new file mode 100644 --- /dev/null +++ b/mail/test/mozmill/message-reader/bug594646_reversed_order_qp.eml @@ -0,0 +1,22 @@ +X-Identity-Key: id1 +X-Account-Key: account2 +Date: Tue, 18 Dec 2012 13:42:01 +0100 +X-Mozilla-Draft-Info: internal/draft; vcard=0; receipt=0; DSN=0; uuencode=0 +User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:19.0) Gecko/20121217 Thunderbird/19.0a2 +MIME-Version: 1.0 +Subject: html test +X-Enigmail-Version: 1.5a1pre +Content-Type: text/html; charset=ISO-8859-2 +Content-Transfer-Encoding: quoted-printable + + + + + + + =E1rv=EDzt=FBr=F5 t=FCk=F6rf=FAr=F3g=E9p
+ =C1RV=CDZT=DBR=D5 T=DCK=D6RF=DAR=D3G=C9P
+
+
+ + diff --git a/mail/test/mozmill/message-reader/test-bug594646.js b/mail/test/mozmill/message-reader/test-bug594646.js new file mode 100644 --- /dev/null +++ b/mail/test/mozmill/message-reader/test-bug594646.js @@ -0,0 +1,89 @@ +/** + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +/** + * Tests that opening an .eml file the body of the message is correct, + * that it hasn't been UTF-8 mojibake'd. + */ + +const MODULE_NAME = "test-bug594646"; + +const RELATIVE_ROOT = "../shared-modules"; +const MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"]; + +let gReferenceTextContent; + +function setupModule(module) { + collector.getModule("folder-display-helpers").installInto(module); + collector.getModule("window-helpers").installInto(module); + gReferenceTextContent = extract_eml_body_textcontent("./bug594646_reference.eml"); +} + +function extract_eml_body_textcontent(eml) { + let file = os.getFileForPath(os.abspath(eml, os.getFileForPath(__file__))); + let msgc = open_message_from_file(file); + + // Be sure to view message body as Original HTML + msgc.window.MsgBodyAllowHTML(); + + let textContent = msgc.window + .msgWindow + .messageWindowDocShell + .contentViewer + .DOMDocument + .documentElement + .textContent; + + close_window(msgc); + return textContent; +} + +/** + * Checks that the text content is equal for the .eml files. + */ +function check_eml_textcontent(eml) { + let textContent = extract_eml_body_textcontent(eml); + assert_equals(gReferenceTextContent, textContent); +} + +/** + * This test excercises the bug for reversed http-equiv, content order: + * + * + * + */ +function test_original_html_characters_head_meta_content_charset_httpEq() { + check_eml_textcontent("./bug594646_reversed_order_8bit.eml"); + check_eml_textcontent("./bug594646_reversed_order_qp.eml"); + check_eml_textcontent("./bug594646_reversed_order_b64.eml"); +} + +/** + * This test excercises the bug for newline delimited charset: + * + * + * + */ +function test_original_html_characters_head_meta_httpEq_content_newline_charset() { + check_eml_textcontent("./bug594646_newline_charset_8bit.eml"); + check_eml_textcontent("./bug594646_newline_charset_qp.eml"); + check_eml_textcontent("./bug594646_newline_charset_b64.eml"); +} + +/** + * This test excercises the bug for newline delimited and reverse ordered http-equiv: + * + * + * + */ +function test_original_html_characters_head_meta_content_charset_newline_httpEq() { + check_eml_textcontent("./bug594646_newline_httpequiv_8bit.eml"); + check_eml_textcontent("./bug594646_newline_httpequiv_qp.eml"); + check_eml_textcontent("./bug594646_newline_httpequiv_b64.eml"); +} + diff --git a/mail/test/mozmill/mozmilltests.list b/mail/test/mozmill/mozmilltests.list --- a/mail/test/mozmill/mozmilltests.list +++ b/mail/test/mozmill/mozmilltests.list @@ -11,16 +11,17 @@ folder-display folder-pane folder-tree-modes folder-widget im instrumentation junk-commands keyboard message-header +message-reader message-window migration-to-rdf-ui-2 migration-to-rdf-ui-3 migration-to-rdf-ui-5 multiple-identities newmailaccount notification override-main-menu-collapse