summaryrefslogtreecommitdiffstats
path: root/comm/mail/test/browser/composition/browser_base64Display.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /comm/mail/test/browser/composition/browser_base64Display.js
parentInitial commit. (diff)
downloadthunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz
thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'comm/mail/test/browser/composition/browser_base64Display.js')
-rw-r--r--comm/mail/test/browser/composition/browser_base64Display.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/comm/mail/test/browser/composition/browser_base64Display.js b/comm/mail/test/browser/composition/browser_base64Display.js
new file mode 100644
index 0000000000..8b2dc1edaf
--- /dev/null
+++ b/comm/mail/test/browser/composition/browser_base64Display.js
@@ -0,0 +1,48 @@
+/* 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.
+ */
+
+"use strict";
+
+var { get_about_message, open_message_from_file } = ChromeUtils.import(
+ "resource://testing-common/mozmill/FolderDisplayHelpers.jsm"
+);
+var { close_window } = ChromeUtils.import(
+ "resource://testing-common/mozmill/WindowHelpers.jsm"
+);
+
+add_task(async function test_base64_display() {
+ let file = new FileUtils.File(
+ getTestFilePath("data/base64-with-whitespace.eml")
+ );
+ let msgc = await open_message_from_file(file);
+ let aboutMessage = get_about_message(msgc.window);
+ let bodyText = aboutMessage.document
+ .getElementById("messagepane")
+ .contentDocument.querySelector("body").textContent;
+ close_window(msgc);
+
+ Assert.ok(
+ bodyText.includes("abcdefghijklmnopqrstuvwxyz"),
+ "Decode base64 body from message."
+ );
+});
+
+add_task(async function test_base64_display2() {
+ let file = new FileUtils.File(getTestFilePath("data/base64-bug1586890.eml"));
+ let msgc = await open_message_from_file(file);
+ let aboutMessage = get_about_message(msgc.window);
+ let bodyText = aboutMessage.document
+ .getElementById("messagepane")
+ .contentDocument.querySelector("body").textContent;
+ close_window(msgc);
+
+ Assert.ok(
+ bodyText.includes("abcdefghijklm"),
+ "Decode base64 body from UTF-16 message with broken charset."
+ );
+});