Bug 1784838 - Test for meta removal. r=benc

Differential Revision: https://phabricator.services.mozilla.com/D154962

--HG--
extra : rebase_source : dc0d59dcf9ae522f20b6e44b05c8dab548620739
extra : amend_source : 212cb0dec6a35cf38cea16248b036c65a1b1ac1f
This commit is contained in:
Magnus Melin 2023-01-01 20:34:19 +11:00
Родитель 7685af7753
Коммит 574fe814b9
2 изменённых файлов: 38 добавлений и 24 удалений

Просмотреть файл

@ -123,20 +123,10 @@ add_task(async function test_reply_to_base64_eml() {
// Open an .eml file.
let file = new FileUtils.File(getTestFilePath("data/base64-encoded-msg.eml"));
let msgc = await open_message_from_file(file);
let compWin = open_compose_with_reply(msgc);
let bodyText = get_compose_body(compWin).textContent;
const message = "You have decoded this text from base64.";
if (!bodyText.includes(message)) {
throw new Error(
"body text didn't contain the decoded text; message=" +
message +
", bodyText=" +
bodyText
);
}
const TXT = "You have decoded this text from base64.";
Assert.ok(bodyText.includes(TXT), "body should contain the decoded text");
close_compose_window(compWin);
close_window(msgc);
});
@ -148,24 +138,37 @@ add_task(async function test_forward_base64_eml() {
// Open an .eml file.
let file = new FileUtils.File(getTestFilePath("data/base64-encoded-msg.eml"));
let msgc = await open_message_from_file(file);
let compWin = open_compose_with_forward(msgc);
let bodyText = get_compose_body(compWin).textContent;
const message = "You have decoded this text from base64.";
if (!bodyText.includes(message)) {
throw new Error(
"body text didn't contain the decoded text; message=" +
message +
", bodyText=" +
bodyText
);
}
const TXT = "You have decoded this text from base64.";
Assert.ok(bodyText.includes(TXT), "body should contain the decoded text");
close_compose_window(compWin);
close_window(msgc);
});
/**
* Test that replying and forwarding an evil meta msg works.
*/
add_task(async function test_reply_fwd_to_evil_meta() {
// Open an .eml file.
let file = new FileUtils.File(getTestFilePath("data/evil-meta-msg.eml"));
let msgc = await open_message_from_file(file);
const TXT = "KABOOM!";
let reWin = open_compose_with_reply(msgc);
let reText = get_compose_body(reWin).textContent;
Assert.ok(reText.includes(TXT), "re body should contain the text");
close_compose_window(reWin);
let fwdWin = open_compose_with_forward(msgc);
let fwdText = get_compose_body(fwdWin).textContent;
Assert.ok(fwdText.includes(TXT), "fwd body should contain the text");
close_compose_window(fwdWin);
close_window(msgc);
});
/**
* Test that forwarding an opened .eml message works with catchAll enabled.
*/

Просмотреть файл

@ -0,0 +1,11 @@
From: Fuzz <fizz@example.org>
To: contact@example.org
Subject: test case 17
Date: Wed, 11 May 2024 14:31:59 +0000
Content-Type: text/html
<html>
<meta http-equiv="refresh" content="0;URL='http://localhost:8090'" />
<meta http-equiv="refresh" content="1;URL='http://localhost:8091'" />
<div id="demo">KABOOM!</demo>
<object onerror="alert(1); document.getElementById('demo').innerHTML=parent.JSON.stringify(Object.getOwnPropertyNames(parent));" data="notarealaddress" width="400" height="300"></object>