Bug 1487421 - add MozMill test for display of message in base64 with white-space in between. r=aceman a=jorgk
authorJorg K <jorgk@jorgk.com>
Tue, 04 Sep 2018 09:46:33 +0200
changeset 31865 5e80e7ab2613de789aef34507e54ac0842108f40
parent 31864 0b31df771530ea6a6a9cc52fad3aeece89f9a491
child 31866 e524897f5bde19a61c4708a31629c54e09dbf6ca
push id86
push usermozilla@jorgk.com
push dateSun, 14 Oct 2018 09:47:49 +0000
treeherdercomm-esr60@e524897f5bde [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaceman, jorgk
bugs1487421
Bug 1487421 - add MozMill test for display of message in base64 with white-space in between. r=aceman a=jorgk
mail/test/mozmill/composition/base64-with-whitespace.eml
mail/test/mozmill/composition/test-base64-display.js
new file mode 100644
--- /dev/null
+++ b/mail/test/mozmill/composition/base64-with-whitespace.eml
@@ -0,0 +1,46 @@
+Date: Tue, 31 Aug 2018 16:33:00 +0200
+From: From <from@example.com>
+To: To <to@example.com>
+Subject: Bug 1487421 - BASE64 MIME body and attachment with empty lines in between
+MIME-Version: 1.0
+Message-ID: <1dcZe4@example.com>
+Content-Type: multipart/mixed;
+ boundary="------------DA562B250842CC7332F16476"
+
+This is a multi-part message in MIME format.
+--------------DA562B250842CC7332F16476
+Content-Type: text/plain; charset=utf-8
+Content-Transfer-Encoding: base64
+
+YWJj
+
+ZG
+
+V
+
+mZ2hpamtsbW
+
+5vcHFyc3R1dnd4
+
+eXo=
+
+--------------DA562B250842CC7332F16476
+Content-Type: text/plain; charset=utf-8
+Content-Transfer-Encoding: base64
+Content-Disposition: attachment;
+ filename="test.txt"
+
+YWJj
+
+ZG
+
+V
+
+mZ2hpamtsbW
+
+5vcHFyc3R1dnd4
+
+eXo=
+
+--------------DA562B250842CC7332F16476--
+
new file mode 100644
--- /dev/null
+++ b/mail/test/mozmill/composition/test-base64-display.js
@@ -0,0 +1,35 @@
+/* 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 messages with "broken" base64 are correctly displayed.
+ */
+
+// mozmake SOLO_TEST=composition/test-base64-display.js mozmill-one
+
+var MODULE_NAME = "test-base64-display.js";
+
+var RELATIVE_ROOT = "../shared-modules";
+var MODULE_REQUIRES = ["folder-display-helpers", "window-helpers"];
+
+var os = {};
+ChromeUtils.import("chrome://mozmill/content/stdlib/os.js", os);
+
+function setupModule(module) {
+  for (let lib of MODULE_REQUIRES) {
+    collector.getModule(lib).installInto(module);
+  }
+}
+
+function test_base64_display() {
+  let file = os.getFileForPath(os.abspath("./base64-with-whitespace.eml",
+                               os.getFileForPath(__file__)));
+  let msgc = open_message_from_file(file);
+  let bodyText = msgc.e("messagepane").contentDocument
+                     .querySelector("body").textContent;
+  close_window(msgc);
+
+  assert_true(bodyText.includes("abcdefghijklmnopqrstuvwxyz"),
+              "Decoded base64 text not found in message.");
+}