Bug 1455536 - Port bug 1453881: add_task() doesn't accept generators any more (mailnews part). rs=bustage-fix CLOSED TREE
--HG-- extra : amend_source : 132ef93fd78450ed9248ec6d39c95a422e303ad6
This commit is contained in:
Родитель
1742df497d
Коммит
492b02cf57
|
@ -39,14 +39,14 @@ var gTestArray =
|
|||
},
|
||||
|
||||
// the main test
|
||||
function* loadImapMessage()
|
||||
async function loadImapMessage()
|
||||
{
|
||||
IMAPPump.mailbox.addMessage(
|
||||
new imapMessage(specForFileName(gMessage),
|
||||
IMAPPump.mailbox.uidnext++, []));
|
||||
let promiseUrlListener = new PromiseTestUtils.PromiseUrlListener();
|
||||
IMAPPump.inbox.updateFolderWithListener(gDummyMsgWindow, promiseUrlListener);
|
||||
yield promiseUrlListener.promise;
|
||||
await promiseUrlListener.promise;
|
||||
|
||||
Assert.equal(1, IMAPPump.inbox.getTotalMessages(false));
|
||||
let msgHdr = mailTestUtils.firstMsgHdr(IMAPPump.inbox);
|
||||
|
|
|
@ -15,7 +15,7 @@ ChromeUtils.import("resource://testing-common/mailnews/IMAPpump.js");
|
|||
ChromeUtils.import("resource://testing-common/mailnews/imapd.js");
|
||||
ChromeUtils.import("resource://testing-common/mailnews/PromiseTestUtils.jsm");
|
||||
|
||||
function *setupFolder()
|
||||
async function setupFolder()
|
||||
{
|
||||
// add a single message to the imap inbox.
|
||||
let messages = [];
|
||||
|
@ -32,10 +32,10 @@ function *setupFolder()
|
|||
// update folder to download header.
|
||||
let listener = new PromiseTestUtils.PromiseUrlListener();
|
||||
IMAPPump.inbox.updateFolderWithListener(null, listener);
|
||||
yield listener.promise;
|
||||
await listener.promise;
|
||||
}
|
||||
|
||||
function *searchTest()
|
||||
async function searchTest()
|
||||
{
|
||||
// Get the IMAP inbox...
|
||||
var emptyLocal1 = localAccountUtils.rootFolder.createLocalSubfolder("empty 1");
|
||||
|
@ -51,11 +51,11 @@ function *searchTest()
|
|||
let listener = new PromiseTestUtils.PromiseSearchNotify(
|
||||
searchSession, searchListener);
|
||||
searchSession.search(null);
|
||||
yield listener.promise;
|
||||
await listener.promise;
|
||||
|
||||
// After the search completes, there still seem to be active URLs, so we
|
||||
// have to wait before we are done and clear.
|
||||
yield PromiseTestUtils.promiseDelay(1000);
|
||||
await PromiseTestUtils.promiseDelay(1000);
|
||||
}
|
||||
|
||||
// nsIMsgSearchNotify implementation
|
||||
|
|
|
@ -110,18 +110,18 @@ function checkAttachment(expectedCD, expectedCT) {
|
|||
Assert.equal(contentType, expectedCT);
|
||||
}
|
||||
|
||||
function* testInput0() {
|
||||
async function testInput0() {
|
||||
for (let folding in ParamFoldingPref) {
|
||||
Services.prefs.setIntPref("mail.strictly_mime.parm_folding", ParamFoldingPref[folding]);
|
||||
yield createMessage(input0);
|
||||
await createMessage(input0);
|
||||
checkAttachment(expectedCD0, expectedCTList0[folding]);
|
||||
}
|
||||
}
|
||||
|
||||
function* testInput1() {
|
||||
async function testInput1() {
|
||||
for (let folding in ParamFoldingPref) {
|
||||
Services.prefs.setIntPref("mail.strictly_mime.parm_folding", ParamFoldingPref[folding]);
|
||||
yield createMessage(input1);
|
||||
await createMessage(input1);
|
||||
checkAttachment(expectedCD1, expectedCTList1[folding]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ var kUsername = "test.smtp@fakeserver";
|
|||
var kPassword1 = "wrong";
|
||||
var kPassword2 = "smtptest";
|
||||
|
||||
add_task(function *() {
|
||||
add_task(async function () {
|
||||
registerAlertTestUtils();
|
||||
|
||||
function createHandler(d) {
|
||||
|
@ -51,7 +51,7 @@ add_task(function *() {
|
|||
server.setDebugLevel(fsDebugAll);
|
||||
|
||||
// Prepare files for passwords (generated by a script in bug 1018624).
|
||||
yield setupForPassword("signons-smtp.json");
|
||||
await setupForPassword("signons-smtp.json");
|
||||
|
||||
// Test file
|
||||
var testFile = do_get_file("data/message1.eml");
|
||||
|
|
|
@ -23,23 +23,23 @@ function getContentCharset(aContent) {
|
|||
return null;
|
||||
}
|
||||
|
||||
function *testUTF8() {
|
||||
yield createMessage(do_get_file("data/test-UTF-8.txt"));
|
||||
async function testUTF8() {
|
||||
await createMessage(do_get_file("data/test-UTF-8.txt"));
|
||||
checkAttachmentCharset("UTF-8");
|
||||
}
|
||||
|
||||
function *testUTF16BE() {
|
||||
yield createMessage(do_get_file("data/test-UTF-16BE.txt"));
|
||||
async function testUTF16BE() {
|
||||
await createMessage(do_get_file("data/test-UTF-16BE.txt"));
|
||||
checkAttachmentCharset("UTF-16BE");
|
||||
}
|
||||
|
||||
function *testUTF16LE() {
|
||||
yield createMessage(do_get_file("data/test-UTF-16LE.txt"));
|
||||
async function testUTF16LE() {
|
||||
await createMessage(do_get_file("data/test-UTF-16LE.txt"));
|
||||
checkAttachmentCharset("UTF-16LE");
|
||||
}
|
||||
|
||||
function *testShiftJIS() {
|
||||
yield createMessage(do_get_file("data/test-SHIFT_JIS.txt"));
|
||||
async function testShiftJIS() {
|
||||
await createMessage(do_get_file("data/test-SHIFT_JIS.txt"));
|
||||
checkAttachmentCharset(null); // do not detect SHIFT_JIS in this file anymore
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ let longMultibyteLineCJK = "안".repeat(400);
|
|||
// And some Japanese.
|
||||
let longMultibyteLineJapanese = "語".repeat(450);
|
||||
|
||||
function* testBodyWithLongLine() {
|
||||
async function testBodyWithLongLine() {
|
||||
let newline;
|
||||
// Windows uses CR+LF, the other platforms just LF.
|
||||
// Note: Services.appinfo.OS returns "XPCShell" in the test, so we
|
||||
|
@ -108,7 +108,7 @@ function* testBodyWithLongLine() {
|
|||
"<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">" +
|
||||
"</head><body>" + longMultibyteLine + "</body></html>";
|
||||
fields.body = htmlMessage;
|
||||
yield richCreateMessage(fields, [], identity);
|
||||
await richCreateMessage(fields, [], identity);
|
||||
checkDraftHeadersAndBody(
|
||||
{
|
||||
"Content-Type": "text/html; charset=UTF-8",
|
||||
|
@ -121,7 +121,7 @@ function* testBodyWithLongLine() {
|
|||
fields.body = htmlMessage;
|
||||
fields.forcePlainText = true;
|
||||
fields.useMultipartAlternative = false;
|
||||
yield richCreateMessage(fields, [], identity);
|
||||
await richCreateMessage(fields, [], identity);
|
||||
checkDraftHeadersAndBody(
|
||||
{
|
||||
"Content-Type": "text/plain; charset=UTF-8; format=flowed",
|
||||
|
@ -136,7 +136,7 @@ function* testBodyWithLongLine() {
|
|||
"<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">" +
|
||||
"</head><body>" + longMultibyteLineCJK + "</body></html>";
|
||||
fields.body = htmlMessage;
|
||||
yield richCreateMessage(fields, [], identity);
|
||||
await richCreateMessage(fields, [], identity);
|
||||
checkDraftHeadersAndBody(
|
||||
{
|
||||
"Content-Type": "text/html; charset=UTF-8",
|
||||
|
@ -149,7 +149,7 @@ function* testBodyWithLongLine() {
|
|||
fields.body = htmlMessage;
|
||||
fields.forcePlainText = true;
|
||||
fields.useMultipartAlternative = false;
|
||||
yield richCreateMessage(fields, [], identity);
|
||||
await richCreateMessage(fields, [], identity);
|
||||
checkDraftHeadersAndBody(
|
||||
{
|
||||
"Content-Type": "text/plain; charset=UTF-8; format=flowed",
|
||||
|
@ -166,7 +166,7 @@ function* testBodyWithLongLine() {
|
|||
"<meta http-equiv=\"content-type\" content=\"text/html; charset=ISO-2022-JP\">" +
|
||||
"</head><body>" + longMultibyteLineJapanese + "</body></html>";
|
||||
fields.body = htmlMessage;
|
||||
yield richCreateMessage(fields, [], identity);
|
||||
await richCreateMessage(fields, [], identity);
|
||||
checkDraftHeadersAndBody(
|
||||
{
|
||||
"Content-Type": "text/html; charset=ISO-2022-JP",
|
||||
|
@ -180,7 +180,7 @@ function* testBodyWithLongLine() {
|
|||
fields.body = htmlMessage;
|
||||
fields.forcePlainText = true;
|
||||
fields.useMultipartAlternative = false;
|
||||
yield richCreateMessage(fields, [], identity);
|
||||
await richCreateMessage(fields, [], identity);
|
||||
|
||||
// Expected body: The message without the tags and chopped up in
|
||||
// chunks of 36 characters with a space appended to each line.
|
||||
|
@ -205,7 +205,7 @@ function* testBodyWithLongLine() {
|
|||
fields.body = htmlMessage;
|
||||
Services.prefs.setBoolPref("mailnews.send_plaintext_flowed", false);
|
||||
|
||||
yield richCreateMessage(fields, [], identity);
|
||||
await richCreateMessage(fields, [], identity);
|
||||
checkDraftHeadersAndBody(
|
||||
{
|
||||
"Content-Type": "text/plain; charset=ISO-2022-JP",
|
||||
|
|
|
@ -77,7 +77,7 @@ function checkMessageHeaders(msgData, expectedHeaders, partNum = "") {
|
|||
Assert.ok(seen);
|
||||
}
|
||||
|
||||
function* testEnvelope() {
|
||||
async function testEnvelope() {
|
||||
let fields = new CompFields();
|
||||
let identity = getSmtpIdentity("from@tinderbox.invalid",
|
||||
getBasicSmtpServer());
|
||||
|
@ -90,7 +90,7 @@ function* testEnvelope() {
|
|||
fields.replyTo = "Charles <charles@tinderbox.invalid>";
|
||||
fields.organization = "World Salvation Committee";
|
||||
fields.subject = "This is an obscure reference";
|
||||
yield richCreateMessage(fields, [], identity);
|
||||
await richCreateMessage(fields, [], identity);
|
||||
checkDraftHeaders({
|
||||
// As of bug 87987, the identity does not override the from header.
|
||||
"From": "Nobody <nobody@tinderbox.invalid>",
|
||||
|
@ -104,7 +104,7 @@ function* testEnvelope() {
|
|||
});
|
||||
}
|
||||
|
||||
function* testI18NEnvelope() {
|
||||
async function testI18NEnvelope() {
|
||||
let fields = new CompFields();
|
||||
let identity = getSmtpIdentity("from@tinderbox.invalid",
|
||||
getBasicSmtpServer());
|
||||
|
@ -115,7 +115,7 @@ function* testI18NEnvelope() {
|
|||
fields.bcc = "Étienne <boris@tinderbox.invalid>";
|
||||
fields.replyTo = "Frédéric <charles@tinderbox.invalid>";
|
||||
fields.subject = "Ceci n'est pas un référence obscure";
|
||||
yield richCreateMessage(fields, [], identity);
|
||||
await richCreateMessage(fields, [], identity);
|
||||
checkDraftHeaders({
|
||||
"From": "=?UTF-8?B?44Kx44OE44Kh44Or44Kz44Ki44OI44Or?= <from@tinderbox.invalid>",
|
||||
"Organization": "=?UTF-8?Q?Comit=c3=a9_de_la_destruction_du_monde?=",
|
||||
|
@ -127,7 +127,7 @@ function* testI18NEnvelope() {
|
|||
});
|
||||
}
|
||||
|
||||
function* testIDNEnvelope() {
|
||||
async function testIDNEnvelope() {
|
||||
let fields = new CompFields();
|
||||
let domain = "ケツァルコアトル.invalid";
|
||||
// We match against rawHeaderText, so we need to encode the string as a binary
|
||||
|
@ -142,7 +142,7 @@ function* testIDNEnvelope() {
|
|||
fields.bcc = "Boris <boris@" + domain + ">";
|
||||
fields.replyTo = "Charles <charles@" + domain + ">";
|
||||
fields.subject = "This is an obscure reference";
|
||||
yield richCreateMessage(fields, [], identity);
|
||||
await richCreateMessage(fields, [], identity);
|
||||
checkDraftHeaders({
|
||||
// The identity sets the from field here.
|
||||
"From": "from@tinderbox.invalid",
|
||||
|
@ -154,11 +154,11 @@ function* testIDNEnvelope() {
|
|||
});
|
||||
}
|
||||
|
||||
function* testDraftInfo() {
|
||||
async function testDraftInfo() {
|
||||
let fields = new CompFields();
|
||||
let identity = getSmtpIdentity("from@tinderbox.invalid",
|
||||
getBasicSmtpServer());
|
||||
yield richCreateMessage(fields, [], identity);
|
||||
await richCreateMessage(fields, [], identity);
|
||||
checkDraftHeaders({
|
||||
"FCC": identity.fccFolder,
|
||||
"X-Identity-Key": identity.key,
|
||||
|
@ -167,42 +167,42 @@ function* testDraftInfo() {
|
|||
});
|
||||
|
||||
fields.attachVCard = true;
|
||||
yield richCreateMessage(fields, [], identity);
|
||||
await richCreateMessage(fields, [], identity);
|
||||
checkDraftHeaders({
|
||||
"X-Mozilla-Draft-Info": "internal/draft; " +
|
||||
"vcard=1; receipt=0; DSN=0; uuencode=0; attachmentreminder=0; deliveryformat=4",
|
||||
});
|
||||
|
||||
fields.returnReceipt = true;
|
||||
yield richCreateMessage(fields, [], identity);
|
||||
await richCreateMessage(fields, [], identity);
|
||||
checkDraftHeaders({
|
||||
"X-Mozilla-Draft-Info": "internal/draft; " +
|
||||
"vcard=1; receipt=1; DSN=0; uuencode=0; attachmentreminder=0; deliveryformat=4",
|
||||
});
|
||||
|
||||
fields.DSN = true;
|
||||
yield richCreateMessage(fields, [], identity);
|
||||
await richCreateMessage(fields, [], identity);
|
||||
checkDraftHeaders({
|
||||
"X-Mozilla-Draft-Info": "internal/draft; " +
|
||||
"vcard=1; receipt=1; DSN=1; uuencode=0; attachmentreminder=0; deliveryformat=4",
|
||||
});
|
||||
|
||||
fields.attachmentReminder = true;
|
||||
yield richCreateMessage(fields, [], identity);
|
||||
await richCreateMessage(fields, [], identity);
|
||||
checkDraftHeaders({
|
||||
"X-Mozilla-Draft-Info": "internal/draft; " +
|
||||
"vcard=1; receipt=1; DSN=1; uuencode=0; attachmentreminder=1; deliveryformat=4",
|
||||
});
|
||||
|
||||
fields.deliveryFormat = Ci.nsIMsgCompSendFormat.Both;
|
||||
yield richCreateMessage(fields, [], identity);
|
||||
await richCreateMessage(fields, [], identity);
|
||||
checkDraftHeaders({
|
||||
"X-Mozilla-Draft-Info": "internal/draft; " +
|
||||
"vcard=1; receipt=1; DSN=1; uuencode=0; attachmentreminder=1; deliveryformat=3",
|
||||
});
|
||||
}
|
||||
|
||||
function* testOtherHeaders() {
|
||||
async function testOtherHeaders() {
|
||||
let fields = new CompFields();
|
||||
let identity = getSmtpIdentity("from@tinderbox.invalid",
|
||||
getBasicSmtpServer());
|
||||
|
@ -210,7 +210,7 @@ function* testOtherHeaders() {
|
|||
fields.references = "<fake@tinderbox.invalid> <more@test.invalid>";
|
||||
fields.setHeader("X-Fake-Header", "124");
|
||||
let before = Date.now();
|
||||
let msgHdr = yield richCreateMessage(fields, [], identity);
|
||||
let msgHdr = await richCreateMessage(fields, [], identity);
|
||||
let after = Date.now();
|
||||
let msgData = mailTestUtils.loadMessageToString(msgHdr.folder, msgHdr);
|
||||
checkMessageHeaders(msgData, {
|
||||
|
@ -256,14 +256,14 @@ function* testOtherHeaders() {
|
|||
let expected = references.slice(47);
|
||||
expected.unshift(references[0]);
|
||||
fields.references = references.join(" ");
|
||||
yield richCreateMessage(fields, [], identity);
|
||||
await richCreateMessage(fields, [], identity);
|
||||
checkDraftHeaders({
|
||||
"References": expected.join(" "),
|
||||
"In-Reply-To": references[references.length - 1],
|
||||
});
|
||||
}
|
||||
|
||||
function* testNewsgroups() {
|
||||
async function testNewsgroups() {
|
||||
let fields = new CompFields();
|
||||
let nntpServer = localAccountUtils.create_incoming_server("nntp", 534,
|
||||
"", "");
|
||||
|
@ -273,7 +273,7 @@ function* testNewsgroups() {
|
|||
getBasicSmtpServer());
|
||||
fields.newsgroups = "mozilla.test, mozilla.test.multimedia";
|
||||
fields.followupTo = "mozilla.test";
|
||||
yield richCreateMessage(fields, [], identity);
|
||||
await richCreateMessage(fields, [], identity);
|
||||
checkDraftHeaders({
|
||||
// The identity should override the compose fields here.
|
||||
"Newsgroups": "mozilla.test,mozilla.test.multimedia",
|
||||
|
@ -282,7 +282,7 @@ function* testNewsgroups() {
|
|||
});
|
||||
}
|
||||
|
||||
function* testSendHeaders() {
|
||||
async function testSendHeaders() {
|
||||
let fields = new CompFields();
|
||||
let identity = getSmtpIdentity("from@tinderbox.invalid",
|
||||
getBasicSmtpServer());
|
||||
|
@ -294,7 +294,7 @@ function* testSendHeaders() {
|
|||
"replyto@test.invalid");
|
||||
fields.to = "list@test.invalid";
|
||||
fields.cc = "not-list@test.invalid";
|
||||
yield richCreateMessage(fields, [], identity);
|
||||
await richCreateMessage(fields, [], identity);
|
||||
checkDraftHeaders({
|
||||
"X-Custom-1": "A header value",
|
||||
"X-Custom-2": "=?UTF-8?Q?_Enchant=c3=a9?=",
|
||||
|
@ -305,7 +305,7 @@ function* testSendHeaders() {
|
|||
// Don't set the M-F-T header if there's no list.
|
||||
fields.to = "replyto@test.invalid";
|
||||
fields.cc = "";
|
||||
yield richCreateMessage(fields, [], identity);
|
||||
await richCreateMessage(fields, [], identity);
|
||||
checkDraftHeaders({
|
||||
"X-Custom-1": "A header value",
|
||||
"X-Custom-2": "=?UTF-8?Q?_Enchant=c3=a9?=",
|
||||
|
@ -314,14 +314,14 @@ function* testSendHeaders() {
|
|||
});
|
||||
}
|
||||
|
||||
function* testContentHeaders() {
|
||||
async function testContentHeaders() {
|
||||
// Disable RFC 2047 fallback
|
||||
Services.prefs.setIntPref("mail.strictly_mime.parm_folding", 2);
|
||||
let fields = new CompFields();
|
||||
fields.body = "A body";
|
||||
let identity = getSmtpIdentity("from@tinderbox.invalid",
|
||||
getBasicSmtpServer());
|
||||
yield richCreateMessage(fields, [], identity);
|
||||
await richCreateMessage(fields, [], identity);
|
||||
checkDraftHeaders({
|
||||
"Content-Type": "text/html; charset=UTF-8",
|
||||
"Content-Transfer-Encoding": "7bit"
|
||||
|
@ -329,7 +329,7 @@ function* testContentHeaders() {
|
|||
|
||||
// non-ASCII body should be 8-bit...
|
||||
fields.body = "Archæologist";
|
||||
yield richCreateMessage(fields, [], identity);
|
||||
await richCreateMessage(fields, [], identity);
|
||||
checkDraftHeaders({
|
||||
"Content-Type": "text/html; charset=UTF-8",
|
||||
"Content-Transfer-Encoding": "8bit"
|
||||
|
@ -338,7 +338,7 @@ function* testContentHeaders() {
|
|||
// What if we change the message charset?
|
||||
fields.characterSet = "ISO-8859-1";
|
||||
fields.body = "Archæologist";
|
||||
yield richCreateMessage(fields, [], identity);
|
||||
await richCreateMessage(fields, [], identity);
|
||||
checkDraftHeaders({
|
||||
"Content-Type": "text/html; charset=ISO-8859-1",
|
||||
"Content-Transfer-Encoding": "8bit"
|
||||
|
@ -355,7 +355,7 @@ function* testContentHeaders() {
|
|||
"Content-Transfer-Encoding": "base64",
|
||||
"Content-Disposition": "attachment; filename=\"attachment.txt\"",
|
||||
};
|
||||
yield richCreateMessage(fields, [plainAttachment], identity);
|
||||
await richCreateMessage(fields, [plainAttachment], identity);
|
||||
checkDraftHeaders({
|
||||
"Content-Type": "text/html; charset=ISO-8859-1",
|
||||
"Content-Transfer-Encoding": "7bit"
|
||||
|
@ -365,13 +365,13 @@ function* testContentHeaders() {
|
|||
plainAttachment.name = "oïl.txt";
|
||||
plainAttachmentHeaders["Content-Disposition"] =
|
||||
"attachment; filename*=ISO-8859-1''%6F%EF%6C%2E%74%78%74";
|
||||
yield richCreateMessage(fields, [plainAttachment], identity);
|
||||
await richCreateMessage(fields, [plainAttachment], identity);
|
||||
checkDraftHeaders(plainAttachmentHeaders, "2");
|
||||
|
||||
plainAttachment.name = "\ud83d\udca9.txt";
|
||||
plainAttachmentHeaders["Content-Disposition"] =
|
||||
"attachment; filename*=UTF-8''%F0%9F%92%A9%2E%74%78%74";
|
||||
yield richCreateMessage(fields, [plainAttachment], identity);
|
||||
await richCreateMessage(fields, [plainAttachment], identity);
|
||||
checkDraftHeaders(plainAttachmentHeaders, "2");
|
||||
|
||||
let httpAttachment = makeAttachment({
|
||||
|
@ -384,7 +384,7 @@ function* testContentHeaders() {
|
|||
"Content-Base": '"data:text/html,<html></html>"',
|
||||
"Content-Location": '"data:text/html,<html></html>"',
|
||||
};
|
||||
yield richCreateMessage(fields, [httpAttachment], identity);
|
||||
await richCreateMessage(fields, [httpAttachment], identity);
|
||||
checkDraftHeaders({
|
||||
"Content-Base": undefined,
|
||||
"Content-Location": undefined
|
||||
|
@ -405,14 +405,14 @@ function* testContentHeaders() {
|
|||
"provider=akey; " +
|
||||
"file=" + cloudAttachment.url + "; name=attachment.html",
|
||||
};
|
||||
yield richCreateMessage(fields, [cloudAttachment], identity);
|
||||
await richCreateMessage(fields, [cloudAttachment], identity);
|
||||
checkDraftHeaders(cloudAttachmentHeaders, "2");
|
||||
|
||||
// Some multipart/alternative tests.
|
||||
fields.body = "Some text";
|
||||
fields.forcePlainText = false;
|
||||
fields.useMultipartAlternative = true;
|
||||
yield richCreateMessage(fields, [], identity);
|
||||
await richCreateMessage(fields, [], identity);
|
||||
checkDraftHeaders({
|
||||
"Content-Type": "multipart/alternative; boundary=."
|
||||
});
|
||||
|
@ -430,7 +430,7 @@ function* testContentHeaders() {
|
|||
// + text/plain
|
||||
// + text/html
|
||||
// + text/plain attachment
|
||||
yield richCreateMessage(fields, [plainAttachment], identity);
|
||||
await richCreateMessage(fields, [plainAttachment], identity);
|
||||
checkDraftHeaders({
|
||||
"Content-Type": "multipart/mixed; boundary=."
|
||||
});
|
||||
|
@ -448,7 +448,7 @@ function* testContentHeaders() {
|
|||
checkDraftHeaders(plainAttachmentHeaders, "2");
|
||||
|
||||
// Three attachments, and a multipart/alternative. Oh the humanity!
|
||||
yield richCreateMessage(fields,
|
||||
await richCreateMessage(fields,
|
||||
[plainAttachment, httpAttachment, cloudAttachment], identity);
|
||||
checkDraftHeaders({
|
||||
"Content-Type": "multipart/mixed; boundary=."
|
||||
|
@ -471,21 +471,21 @@ function* testContentHeaders() {
|
|||
// Test a request for plain text with text/html.
|
||||
fields.forcePlainText = true;
|
||||
fields.useMultipartAlternative = false;
|
||||
yield richCreateMessage(fields, [], identity);
|
||||
await richCreateMessage(fields, [], identity);
|
||||
checkDraftHeaders({
|
||||
"Content-Type": "text/plain; charset=UTF-8; format=flowed",
|
||||
"Content-Transfer-Encoding": "7bit"
|
||||
});
|
||||
}
|
||||
|
||||
function* testSentMessage() {
|
||||
async function testSentMessage() {
|
||||
let server = setupServerDaemon();
|
||||
let daemon = server._daemon;
|
||||
server.start();
|
||||
try {
|
||||
let localserver = getBasicSmtpServer(server.port);
|
||||
let identity = getSmtpIdentity("test@tinderbox.invalid", localserver);
|
||||
yield sendMessage({
|
||||
await sendMessage({
|
||||
"to": "Nobody <nobody@tinderbox.invalid>",
|
||||
"cc": "Alex <alex@tinderbox.invalid>",
|
||||
"bcc": "Boris <boris@tinderbox.invalid>",
|
||||
|
@ -502,11 +502,11 @@ function* testSentMessage() {
|
|||
"X-Mozilla-Draft-Info": undefined,
|
||||
"Fcc": undefined
|
||||
});
|
||||
yield sendMessage({"bcc": "Somebody <test@tinderbox.invalid"}, identity);
|
||||
await sendMessage({"bcc": "Somebody <test@tinderbox.invalid"}, identity);
|
||||
checkMessageHeaders(daemon.post, {
|
||||
"To": "undisclosed-recipients: ;"
|
||||
});
|
||||
yield sendMessage({
|
||||
await sendMessage({
|
||||
"to": "Somebody <test@tinderbox.invalid>",
|
||||
"returnReceipt": true,
|
||||
"receiptHeaderType": Ci.nsIMsgMdnGenerator.eDntRrtType,
|
||||
|
@ -522,7 +522,7 @@ function* testSentMessage() {
|
|||
name: "attachment.html",
|
||||
contentLocation: "http://localhost.invalid/",
|
||||
});
|
||||
yield sendMessage({to: "test@tinderbox.invalid"}, identity, {},
|
||||
await sendMessage({to: "test@tinderbox.invalid"}, identity, {},
|
||||
[cloudAttachment]);
|
||||
checkMessageHeaders(daemon.post, {
|
||||
"Content-Type": "application/octet-stream",
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
* Test suite for checking correctly saved as draft with unread.
|
||||
*/
|
||||
|
||||
add_task(function* checkDraft() {
|
||||
yield createMessage();
|
||||
add_task(async function checkDraft() {
|
||||
await createMessage();
|
||||
Assert.equal(gDraftFolder.getTotalMessages(false), 1);
|
||||
Assert.equal(gDraftFolder.getNumUnread(false), 1);
|
||||
});
|
||||
|
|
|
@ -23,7 +23,7 @@ var observer = {
|
|||
}
|
||||
}
|
||||
|
||||
add_task(function* testObserver() {
|
||||
add_task(async function testObserver() {
|
||||
let fields = new CompFields();
|
||||
let identity = getSmtpIdentity("from@tinderbox.invalid",
|
||||
getBasicSmtpServer());
|
||||
|
@ -32,13 +32,13 @@ add_task(function* testObserver() {
|
|||
fields.cc = "Alex <alex@tinderbox.invalid>";
|
||||
fields.subject = "Let's test the observer";
|
||||
|
||||
yield richCreateMessage(fields, [], identity);
|
||||
await richCreateMessage(fields, [], identity);
|
||||
// observer data should have:
|
||||
// (no account), Ci.nsIMsgSend.nsMsgSaveAsDraft, identity.key
|
||||
Assert.equal(gData, ",4,id1");
|
||||
|
||||
// Now try with an account
|
||||
yield richCreateMessage(fields, [], identity, localAccountUtils.msgAccount);
|
||||
await richCreateMessage(fields, [], identity, localAccountUtils.msgAccount);
|
||||
// observer data should have:
|
||||
// (local account key), Ci.nsIMsgSend.nsMsgSaveAsDraft, identity.key
|
||||
Assert.equal(gData, "account1,4,id1");
|
||||
|
|
|
@ -17,7 +17,7 @@ var kUsername = "testsmtp";
|
|||
// file.
|
||||
var kPassword = "smtptest";
|
||||
|
||||
add_task(function *() {
|
||||
add_task(async function () {
|
||||
function createHandler(d) {
|
||||
var handler = new SMTP_RFC2821_handler(d);
|
||||
// Username needs to match the login information stored in the signons json
|
||||
|
@ -30,7 +30,7 @@ add_task(function *() {
|
|||
server = setupServerDaemon(createHandler);
|
||||
|
||||
// Prepare files for passwords (generated by a script in bug 1018624).
|
||||
yield setupForPassword("signons-mailnews1.8.json")
|
||||
await setupForPassword("signons-mailnews1.8.json")
|
||||
|
||||
// Test file
|
||||
var testFile = do_get_file("data/message1.eml");
|
||||
|
|
|
@ -13,9 +13,9 @@ var kProtocol = "smtp";
|
|||
var kHostname = "localhost";
|
||||
var kServerUrl = kProtocol + "://" + kHostname;
|
||||
|
||||
add_task(function *() {
|
||||
add_task(async function () {
|
||||
// Prepare files for passwords (generated by a script in bug 1018624).
|
||||
yield setupForPassword("signons-mailnews1.8-multiple.json")
|
||||
await setupForPassword("signons-mailnews1.8-multiple.json")
|
||||
|
||||
// Set up the basic accounts and folders.
|
||||
localAccountUtils.loadLocalMailAccount();
|
||||
|
|
|
@ -56,7 +56,7 @@ function confirmEx(aDialogTitle, aText, aButtonFlags, aButton0Title,
|
|||
}
|
||||
}
|
||||
|
||||
add_task(function *() {
|
||||
add_task(async function () {
|
||||
function createHandler(d) {
|
||||
var handler = new SMTP_RFC2821_handler(d);
|
||||
// Username needs to match the login information stored in the signons json
|
||||
|
@ -69,7 +69,7 @@ add_task(function *() {
|
|||
server = setupServerDaemon(createHandler);
|
||||
|
||||
// Prepare files for passwords (generated by a script in bug 1018624).
|
||||
yield setupForPassword("signons-mailnews1.8.json")
|
||||
await setupForPassword("signons-mailnews1.8.json")
|
||||
|
||||
registerAlertTestUtils();
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ function promptPasswordPS(aParent, aDialogTitle, aText, aPassword, aCheckMsg,
|
|||
return false;
|
||||
}
|
||||
|
||||
add_task(function *() {
|
||||
add_task(async function () {
|
||||
function createHandler(d) {
|
||||
var handler = new SMTP_RFC2821_handler(d);
|
||||
// Username needs to match the login information stored in the signons json
|
||||
|
@ -80,7 +80,7 @@ add_task(function *() {
|
|||
server = setupServerDaemon(createHandler);
|
||||
|
||||
// Prepare files for passwords (generated by a script in bug 1018624).
|
||||
yield setupForPassword("signons-mailnews1.8.json")
|
||||
await setupForPassword("signons-mailnews1.8.json")
|
||||
|
||||
registerAlertTestUtils();
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ function promptPasswordPS(aParent, aDialogTitle, aText, aPassword, aCheckMsg,
|
|||
return false;
|
||||
}
|
||||
|
||||
add_task(function *() {
|
||||
add_task(async function () {
|
||||
function createHandler(d) {
|
||||
var handler = new SMTP_RFC2821_handler(d);
|
||||
handler.dropOnAuthFailure = true;
|
||||
|
@ -79,7 +79,7 @@ add_task(function *() {
|
|||
server = setupServerDaemon(createHandler);
|
||||
|
||||
// Prepare files for passwords (generated by a script in bug 1018624).
|
||||
yield setupForPassword("signons-mailnews1.8.json")
|
||||
await setupForPassword("signons-mailnews1.8.json")
|
||||
|
||||
registerAlertTestUtils();
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ ChromeUtils.import("resource://testing-common/mailnews/PromiseTestUtils.jsm");
|
|||
const PORT = 25;
|
||||
var daemon, localserver, server;
|
||||
|
||||
add_task(function* setup() {
|
||||
add_task(async function setup() {
|
||||
server = setupServerDaemon();
|
||||
daemon = server._daemon;
|
||||
server.start();
|
||||
|
@ -19,7 +19,7 @@ add_task(function* setup() {
|
|||
let CompFields = CC("@mozilla.org/messengercompose/composefields;1",
|
||||
Ci.nsIMsgCompFields);
|
||||
|
||||
add_task(function* sendMessage() {
|
||||
add_task(async function sendMessage() {
|
||||
equal(daemon.post, undefined);
|
||||
let identity = getSmtpIdentity("test@tinderbox.invalid", localserver);
|
||||
var testFile = do_get_file("data/message1.eml");
|
||||
|
@ -28,11 +28,11 @@ add_task(function* sendMessage() {
|
|||
"me@example.org",
|
||||
null, urlListener, null, null,
|
||||
false, {}, {});
|
||||
yield urlListener.promise;
|
||||
await urlListener.promise;
|
||||
notEqual(daemon.post, "");
|
||||
});
|
||||
|
||||
add_task(function* cleanUp() {
|
||||
add_task(async function cleanUp() {
|
||||
NetworkTestUtils.shutdownServers();
|
||||
});
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ function setup() {
|
|||
}
|
||||
|
||||
// basic preparation done for each test
|
||||
function *runFilterAction() {
|
||||
async function runFilterAction() {
|
||||
let filterList = IMAPPump.incomingServer.getFilterList(null);
|
||||
while (filterList.filterCount)
|
||||
filterList.removeFilterAt(0);
|
||||
|
@ -68,7 +68,7 @@ function *runFilterAction() {
|
|||
IMAPPump.mailbox.uidnext++, []));
|
||||
let listener = new PromiseTestUtils.PromiseUrlListener();
|
||||
IMAPPump.inbox.updateFolderWithListener(null, listener);
|
||||
yield listener.promise;
|
||||
await listener.promise;
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
|
|
|
@ -59,118 +59,118 @@ var gTestArray =
|
|||
//},
|
||||
setupFilters,
|
||||
// The initial tests do not result in new messages added.
|
||||
function *MoveToFolder() {
|
||||
async function MoveToFolder() {
|
||||
gAction.type = Ci.nsMsgFilterAction.MoveToFolder;
|
||||
gAction.targetFolderUri = gSubfolder.URI;
|
||||
gInboxCount = folderCount(IMAPPump.inbox);
|
||||
gSubfolderCount = folderCount(gSubfolder);
|
||||
yield setupTest(gFilter, gAction);
|
||||
await setupTest(gFilter, gAction);
|
||||
|
||||
testCounts(false, 0, 0, 0);
|
||||
Assert.equal(gInboxCount, folderCount(IMAPPump.inbox));
|
||||
Assert.equal(gSubfolderCount + 1, folderCount(gSubfolder));
|
||||
},
|
||||
// do it again, sometimes that causes multiple downloads
|
||||
function *MoveToFolder2() {
|
||||
async function MoveToFolder2() {
|
||||
gAction.type = Ci.nsMsgFilterAction.MoveToFolder;
|
||||
gAction.targetFolderUri = gSubfolder.URI;
|
||||
gInboxCount = folderCount(IMAPPump.inbox);
|
||||
gSubfolderCount = folderCount(gSubfolder);
|
||||
yield setupTest(gFilter, gAction);
|
||||
await setupTest(gFilter, gAction);
|
||||
|
||||
testCounts(false, 0, 0, 0);
|
||||
Assert.equal(gInboxCount, folderCount(IMAPPump.inbox));
|
||||
Assert.equal(gSubfolderCount + 1, folderCount(gSubfolder));
|
||||
},
|
||||
/**/
|
||||
function *MoveToFolderBody() {
|
||||
async function MoveToFolderBody() {
|
||||
gAction.type = Ci.nsMsgFilterAction.MoveToFolder;
|
||||
gAction.targetFolderUri = gSubfolder.URI;
|
||||
gInboxCount = folderCount(IMAPPump.inbox);
|
||||
gSubfolderCount = folderCount(gSubfolder);
|
||||
yield setupTest(gBodyFilter, gAction);
|
||||
await setupTest(gBodyFilter, gAction);
|
||||
|
||||
testCounts(false, 0, 0, 0);
|
||||
Assert.equal(gSubfolderCount + 1, folderCount(gSubfolder));
|
||||
// no net messages were added to the inbox
|
||||
Assert.equal(gInboxCount, folderCount(IMAPPump.inbox));
|
||||
},
|
||||
function *MoveToFolderBody2() {
|
||||
async function MoveToFolderBody2() {
|
||||
gAction.type = Ci.nsMsgFilterAction.MoveToFolder;
|
||||
gAction.targetFolderUri = gSubfolder.URI;
|
||||
gInboxCount = folderCount(IMAPPump.inbox);
|
||||
gSubfolderCount = folderCount(gSubfolder);
|
||||
yield setupTest(gBodyFilter, gAction);
|
||||
await setupTest(gBodyFilter, gAction);
|
||||
|
||||
testCounts(false, 0, 0, 0);
|
||||
Assert.equal(gSubfolderCount + 1, folderCount(gSubfolder));
|
||||
// no net messages were added to the inbox
|
||||
Assert.equal(gInboxCount, folderCount(IMAPPump.inbox));
|
||||
},
|
||||
function *MarkRead() {
|
||||
async function MarkRead() {
|
||||
gAction.type = Ci.nsMsgFilterAction.MarkRead;
|
||||
gInboxCount = folderCount(IMAPPump.inbox);
|
||||
yield setupTest(gFilter, gAction);
|
||||
await setupTest(gFilter, gAction);
|
||||
testCounts(false, 0, 0, 0);
|
||||
Assert.ok(gHeader.isRead);
|
||||
Assert.equal(gInboxCount + 1, folderCount(IMAPPump.inbox));
|
||||
},
|
||||
function *MarkReadBody() {
|
||||
async function MarkReadBody() {
|
||||
gAction.type = Ci.nsMsgFilterAction.MarkRead;
|
||||
gInboxCount = folderCount(IMAPPump.inbox);
|
||||
yield setupTest(gBodyFilter, gAction);
|
||||
await setupTest(gBodyFilter, gAction);
|
||||
|
||||
testCounts(false, 0, 0, 0);
|
||||
Assert.ok(gHeader.isRead);
|
||||
Assert.equal(gInboxCount + 1, folderCount(IMAPPump.inbox));
|
||||
},
|
||||
function *KillThread() {
|
||||
async function KillThread() {
|
||||
gAction.type = Ci.nsMsgFilterAction.KillThread;
|
||||
yield setupTest(gFilter, gAction);
|
||||
await setupTest(gFilter, gAction);
|
||||
|
||||
testCounts(false, 0, 0, 0);
|
||||
let thread = db().GetThreadContainingMsgHdr(gHeader);
|
||||
Assert.notEqual(0, thread.flags & Ci.nsMsgMessageFlags.Ignored);
|
||||
},
|
||||
function *KillThreadBody() {
|
||||
async function KillThreadBody() {
|
||||
gAction.type = Ci.nsMsgFilterAction.KillThread;
|
||||
yield setupTest(gBodyFilter, gAction);
|
||||
await setupTest(gBodyFilter, gAction);
|
||||
|
||||
testCounts(false, 0, 0, 0);
|
||||
let thread = db().GetThreadContainingMsgHdr(gHeader);
|
||||
Assert.notEqual(0, thread.flags & Ci.nsMsgMessageFlags.Ignored);
|
||||
},
|
||||
function *KillSubthread() {
|
||||
async function KillSubthread() {
|
||||
gAction.type = Ci.nsMsgFilterAction.KillSubthread;
|
||||
yield setupTest(gFilter, gAction);
|
||||
await setupTest(gFilter, gAction);
|
||||
|
||||
testCounts(false, 0, 0, 0);
|
||||
Assert.notEqual(0, gHeader.flags & Ci.nsMsgMessageFlags.Ignored);
|
||||
},
|
||||
function *KillSubthreadBody() {
|
||||
async function KillSubthreadBody() {
|
||||
gAction.type = Ci.nsMsgFilterAction.KillSubthread;
|
||||
yield setupTest(gBodyFilter, gAction);
|
||||
await setupTest(gBodyFilter, gAction);
|
||||
|
||||
testCounts(false, 0, 0, 0);
|
||||
Assert.notEqual(0, gHeader.flags & Ci.nsMsgMessageFlags.Ignored);
|
||||
},
|
||||
function *DoNothing() {
|
||||
async function DoNothing() {
|
||||
gAction.type = Ci.nsMsgFilterAction.StopExecution;
|
||||
yield setupTest(gFilter, gAction);
|
||||
await setupTest(gFilter, gAction);
|
||||
|
||||
testCounts(true, 1, 1, 1);
|
||||
},
|
||||
function *DoNothingBody() {
|
||||
async function DoNothingBody() {
|
||||
gAction.type = Ci.nsMsgFilterAction.StopExecution;
|
||||
yield setupTest(gFilter, gAction);
|
||||
await setupTest(gFilter, gAction);
|
||||
|
||||
testCounts(true, 1, 1, 1);
|
||||
},
|
||||
// this tests for marking message as junk
|
||||
function *JunkScore() {
|
||||
async function JunkScore() {
|
||||
gAction.type = Ci.nsMsgFilterAction.JunkScore;
|
||||
gAction.junkScore = 100;
|
||||
yield setupTest(gFilter, gAction);
|
||||
await setupTest(gFilter, gAction);
|
||||
|
||||
// marking as junk resets new but not unread
|
||||
testCounts(false, 1, 0, 0);
|
||||
|
@ -178,10 +178,10 @@ var gTestArray =
|
|||
Assert.equal(gHeader.getStringProperty("junkscoreorigin"), "filter");
|
||||
},
|
||||
// this tests for marking message as junk
|
||||
function *JunkScoreBody() {
|
||||
async function JunkScoreBody() {
|
||||
gAction.type = Ci.nsMsgFilterAction.JunkScore;
|
||||
gAction.junkScore = 100;
|
||||
yield setupTest(gBodyFilter, gAction);
|
||||
await setupTest(gBodyFilter, gAction);
|
||||
|
||||
// marking as junk resets new but not unread
|
||||
testCounts(false, 1, 0, 0);
|
||||
|
@ -189,135 +189,135 @@ var gTestArray =
|
|||
Assert.equal(gHeader.getStringProperty("junkscoreorigin"), "filter");
|
||||
},
|
||||
// The remaining tests add new messages
|
||||
function *MarkUnread() {
|
||||
async function MarkUnread() {
|
||||
gAction.type = Ci.nsMsgFilterAction.MarkUnread;
|
||||
yield setupTest(gFilter, gAction);
|
||||
await setupTest(gFilter, gAction);
|
||||
|
||||
testCounts(true, 1, 1, 1);
|
||||
Assert.ok(!gHeader.isRead);
|
||||
},
|
||||
function *MarkUnreadBody() {
|
||||
async function MarkUnreadBody() {
|
||||
gAction.type = Ci.nsMsgFilterAction.MarkUnread;
|
||||
yield setupTest(gBodyFilter, gAction);
|
||||
await setupTest(gBodyFilter, gAction);
|
||||
|
||||
testCounts(true, 1, 1, 1);
|
||||
Assert.ok(!gHeader.isRead);
|
||||
},
|
||||
function *WatchThread() {
|
||||
async function WatchThread() {
|
||||
gAction.type = Ci.nsMsgFilterAction.WatchThread;
|
||||
yield setupTest(gFilter, gAction);
|
||||
await setupTest(gFilter, gAction);
|
||||
|
||||
testCounts(true, 1, 1, 1);
|
||||
let thread = db().GetThreadContainingMsgHdr(gHeader);
|
||||
Assert.notEqual(0, thread.flags & Ci.nsMsgMessageFlags.Watched);
|
||||
},
|
||||
function *WatchThreadBody() {
|
||||
async function WatchThreadBody() {
|
||||
gAction.type = Ci.nsMsgFilterAction.WatchThread;
|
||||
yield setupTest(gBodyFilter, gAction);
|
||||
await setupTest(gBodyFilter, gAction);
|
||||
|
||||
testCounts(true, 1, 1, 1);
|
||||
let thread = db().GetThreadContainingMsgHdr(gHeader);
|
||||
Assert.notEqual(0, thread.flags & Ci.nsMsgMessageFlags.Watched);
|
||||
},
|
||||
function *MarkFlagged() {
|
||||
async function MarkFlagged() {
|
||||
gAction.type = Ci.nsMsgFilterAction.MarkFlagged;
|
||||
yield setupTest(gFilter, gAction);
|
||||
await setupTest(gFilter, gAction);
|
||||
|
||||
testCounts(true, 1, 1, 1);
|
||||
Assert.ok(gHeader.isFlagged);
|
||||
},
|
||||
function *MarkFlaggedBody() {
|
||||
async function MarkFlaggedBody() {
|
||||
gAction.type = Ci.nsMsgFilterAction.MarkFlagged;
|
||||
yield setupTest(gBodyFilter, gAction);
|
||||
await setupTest(gBodyFilter, gAction);
|
||||
|
||||
testCounts(true, 1, 1, 1);
|
||||
Assert.ok(gHeader.isFlagged);
|
||||
},
|
||||
function *ChangePriority() {
|
||||
async function ChangePriority() {
|
||||
gAction.type = Ci.nsMsgFilterAction.ChangePriority;
|
||||
gAction.priority = Ci.nsMsgPriority.highest;
|
||||
yield setupTest(gFilter, gAction);
|
||||
await setupTest(gFilter, gAction);
|
||||
|
||||
testCounts(true, 1, 1, 1);
|
||||
Assert.equal(Ci.nsMsgPriority.highest, gHeader.priority);
|
||||
},
|
||||
function *ChangePriorityBody() {
|
||||
async function ChangePriorityBody() {
|
||||
gAction.type = Ci.nsMsgFilterAction.ChangePriority;
|
||||
gAction.priority = Ci.nsMsgPriority.highest;
|
||||
yield setupTest(gBodyFilter, gAction);
|
||||
await setupTest(gBodyFilter, gAction);
|
||||
|
||||
testCounts(true, 1, 1, 1);
|
||||
Assert.equal(Ci.nsMsgPriority.highest, gHeader.priority);
|
||||
},
|
||||
function *Label() {
|
||||
async function Label() {
|
||||
gAction.type = Ci.nsMsgFilterAction.Label;
|
||||
gAction.label = 2;
|
||||
yield setupTest(gFilter, gAction);
|
||||
await setupTest(gFilter, gAction);
|
||||
|
||||
testCounts(true, 1, 1, 1);
|
||||
Assert.equal(2, gHeader.label);
|
||||
},
|
||||
function *LabelBody() {
|
||||
async function LabelBody() {
|
||||
gAction.type = Ci.nsMsgFilterAction.Label;
|
||||
gAction.label = 3;
|
||||
yield setupTest(gBodyFilter, gAction);
|
||||
await setupTest(gBodyFilter, gAction);
|
||||
|
||||
testCounts(true, 1, 1, 1);
|
||||
Assert.equal(3, gHeader.label);
|
||||
},
|
||||
function *AddTag() {
|
||||
async function AddTag() {
|
||||
gAction.type = Ci.nsMsgFilterAction.AddTag;
|
||||
gAction.strValue = "TheTag";
|
||||
yield setupTest(gFilter, gAction);
|
||||
await setupTest(gFilter, gAction);
|
||||
|
||||
testCounts(true, 1, 1, 1);
|
||||
Assert.equal(gHeader.getStringProperty("keywords"), "thetag");
|
||||
},
|
||||
function *AddTagBody() {
|
||||
async function AddTagBody() {
|
||||
gAction.type = Ci.nsMsgFilterAction.AddTag;
|
||||
gAction.strValue = "TheTag2";
|
||||
yield setupTest(gBodyFilter, gAction);
|
||||
await setupTest(gBodyFilter, gAction);
|
||||
|
||||
testCounts(true, 1, 1, 1);
|
||||
Assert.equal(gHeader.getStringProperty("keywords"), "thetag2");
|
||||
},
|
||||
// this tests for marking message as good
|
||||
function *JunkScoreAsGood() {
|
||||
async function JunkScoreAsGood() {
|
||||
gAction.type = Ci.nsMsgFilterAction.JunkScore;
|
||||
gAction.junkScore = 0;
|
||||
yield setupTest(gFilter, gAction);
|
||||
await setupTest(gFilter, gAction);
|
||||
|
||||
testCounts(true, 1, 1, 1);
|
||||
Assert.equal(gHeader.getStringProperty("junkscore"), "0");
|
||||
Assert.equal(gHeader.getStringProperty("junkscoreorigin"), "filter");
|
||||
},
|
||||
// this tests for marking message as good
|
||||
function *JunkScoreAsGoodBody() {
|
||||
async function JunkScoreAsGoodBody() {
|
||||
gAction.type = Ci.nsMsgFilterAction.JunkScore;
|
||||
gAction.junkScore = 0;
|
||||
yield setupTest(gBodyFilter, gAction);
|
||||
await setupTest(gBodyFilter, gAction);
|
||||
|
||||
testCounts(true, 1, 1, 1);
|
||||
Assert.equal(gHeader.getStringProperty("junkscore"), "0");
|
||||
Assert.equal(gHeader.getStringProperty("junkscoreorigin"), "filter");
|
||||
},
|
||||
function *CopyToFolder() {
|
||||
async function CopyToFolder() {
|
||||
gAction.type = Ci.nsMsgFilterAction.CopyToFolder;
|
||||
gAction.targetFolderUri = gSubfolder.URI;
|
||||
gInboxCount = folderCount(IMAPPump.inbox);
|
||||
gSubfolderCount = folderCount(gSubfolder);
|
||||
yield setupTest(gFilter, gAction);
|
||||
await setupTest(gFilter, gAction);
|
||||
|
||||
testCounts(true, 1, 1, 1);
|
||||
Assert.equal(gInboxCount + 1, folderCount(IMAPPump.inbox));
|
||||
Assert.equal(gSubfolderCount + 1, folderCount(gSubfolder));
|
||||
},
|
||||
function *CopyToFolderBody() {
|
||||
async function CopyToFolderBody() {
|
||||
gAction.type = Ci.nsMsgFilterAction.CopyToFolder;
|
||||
gAction.targetFolderUri = gSubfolder.URI;
|
||||
gInboxCount = folderCount(IMAPPump.inbox);
|
||||
gSubfolderCount = folderCount(gSubfolder);
|
||||
yield setupTest(gBodyFilter, gAction);
|
||||
await setupTest(gBodyFilter, gAction);
|
||||
|
||||
testCounts(true, 1, 1, 1);
|
||||
Assert.equal(gInboxCount + 1, folderCount(IMAPPump.inbox));
|
||||
|
@ -388,7 +388,7 @@ function setupFilters()
|
|||
// basic preparation done for each test
|
||||
function setupTest(aFilter, aAction)
|
||||
{
|
||||
return Task.spawn(function* () {
|
||||
return Task.spawn(async function () {
|
||||
let filterList = IMAPPump.incomingServer.getFilterList(null);
|
||||
while (filterList.filterCount)
|
||||
filterList.removeFilterAt(0);
|
||||
|
@ -412,8 +412,8 @@ function setupTest(aFilter, aAction)
|
|||
IMAPPump.mailbox.uidnext++, []));
|
||||
let promiseUrlListener = new PromiseTestUtils.PromiseUrlListener();
|
||||
IMAPPump.inbox.updateFolderWithListener(null, promiseUrlListener);
|
||||
yield promiseUrlListener.promise;
|
||||
yield PromiseTestUtils.promiseDelay(200);
|
||||
await promiseUrlListener.promise;
|
||||
await PromiseTestUtils.promiseDelay(200);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -48,129 +48,129 @@ var gTestArray =
|
|||
[
|
||||
setupIMAPPump,
|
||||
setupFilters,
|
||||
function *DoNothing() {
|
||||
async function DoNothing() {
|
||||
gAction.type = Ci.nsMsgFilterAction.StopExecution;
|
||||
gInboxCount = folderCount(IMAPPump.inbox);
|
||||
yield setupTest(gFilter, gAction);
|
||||
await setupTest(gFilter, gAction);
|
||||
testCounts(false, 1, 0, 0);
|
||||
Assert.equal(gInboxCount + 1, folderCount(IMAPPump.inbox));
|
||||
},
|
||||
function *Delete() {
|
||||
async function Delete() {
|
||||
gAction.type = Ci.nsMsgFilterAction.Delete;
|
||||
gInboxCount = folderCount(IMAPPump.inbox);
|
||||
yield setupTest(gFilter, gAction);
|
||||
await setupTest(gFilter, gAction);
|
||||
testCounts(false, 0, 0, 0);
|
||||
Assert.equal(gInboxCount, folderCount(IMAPPump.inbox));
|
||||
},
|
||||
function *MoveToFolder() {
|
||||
async function MoveToFolder() {
|
||||
gAction.type = Ci.nsMsgFilterAction.MoveToFolder;
|
||||
gAction.targetFolderUri = gSubfolder.URI;
|
||||
gInboxCount = folderCount(IMAPPump.inbox);
|
||||
gSubfolderCount = folderCount(gSubfolder);
|
||||
yield setupTest(gFilter, gAction);
|
||||
await setupTest(gFilter, gAction);
|
||||
|
||||
testCounts(false, 0, 0, 0);
|
||||
Assert.equal(gSubfolderCount + 1, folderCount(gSubfolder));
|
||||
// no net messages were added to the inbox
|
||||
Assert.equal(gInboxCount, folderCount(IMAPPump.inbox));
|
||||
},
|
||||
function *MarkRead() {
|
||||
async function MarkRead() {
|
||||
gAction.type = Ci.nsMsgFilterAction.MarkRead;
|
||||
yield setupTest(gFilter, gAction);
|
||||
await setupTest(gFilter, gAction);
|
||||
testCounts(false, 0, 0, 0);
|
||||
Assert.ok(gHeader.isRead);
|
||||
},
|
||||
function *KillThread() {
|
||||
async function KillThread() {
|
||||
gAction.type = Ci.nsMsgFilterAction.KillThread;
|
||||
yield setupTest(gFilter, gAction);
|
||||
await setupTest(gFilter, gAction);
|
||||
// In non-postplugin, count here is 0 and not 1. Need to investigate.
|
||||
testCounts(false, 1, 0, 0);
|
||||
let thread = db().GetThreadContainingMsgHdr(gHeader);
|
||||
Assert.notEqual(0, thread.flags & Ci.nsMsgMessageFlags.Ignored);
|
||||
},
|
||||
function *WatchThread() {
|
||||
async function WatchThread() {
|
||||
gAction.type = Ci.nsMsgFilterAction.WatchThread;
|
||||
yield setupTest(gFilter, gAction);
|
||||
await setupTest(gFilter, gAction);
|
||||
// In non-postplugin, count here is 0 and not 1. Need to investigate.
|
||||
testCounts(false, 1, 0, 0);
|
||||
let thread = db().GetThreadContainingMsgHdr(gHeader);
|
||||
Assert.notEqual(0, thread.flags & Ci.nsMsgMessageFlags.Watched);
|
||||
},
|
||||
function *KillSubthread() {
|
||||
async function KillSubthread() {
|
||||
gAction.type = Ci.nsMsgFilterAction.KillSubthread;
|
||||
yield setupTest(gFilter, gAction);
|
||||
await setupTest(gFilter, gAction);
|
||||
// In non-postplugin, count here is 0 and not 1. Need to investigate.
|
||||
testCounts(false, 1, 0, 0);
|
||||
Assert.notEqual(0, gHeader.flags & Ci.nsMsgMessageFlags.Ignored);
|
||||
},
|
||||
// this tests for marking message as junk
|
||||
function *JunkScore() {
|
||||
async function JunkScore() {
|
||||
gAction.type = Ci.nsMsgFilterAction.JunkScore;
|
||||
gAction.junkScore = 100;
|
||||
yield setupTest(gFilter, gAction);
|
||||
await setupTest(gFilter, gAction);
|
||||
// marking as junk resets new but not unread
|
||||
testCounts(false, 1, 0, 0);
|
||||
Assert.equal(gHeader.getStringProperty("junkscore"), "100");
|
||||
Assert.equal(gHeader.getStringProperty("junkscoreorigin"), "filter");
|
||||
},
|
||||
function *MarkUnread() {
|
||||
async function MarkUnread() {
|
||||
gAction.type = Ci.nsMsgFilterAction.MarkUnread;
|
||||
yield setupTest(gFilter, gAction);
|
||||
await setupTest(gFilter, gAction);
|
||||
testCounts(true, 1, 1, 1);
|
||||
Assert.ok(!gHeader.isRead);
|
||||
},
|
||||
function *MarkFlagged() {
|
||||
async function MarkFlagged() {
|
||||
gAction.type = Ci.nsMsgFilterAction.MarkFlagged;
|
||||
yield setupTest(gFilter, gAction);
|
||||
await setupTest(gFilter, gAction);
|
||||
testCounts(true, 1, 1, 1);
|
||||
Assert.ok(gHeader.isFlagged);
|
||||
},
|
||||
function *ChangePriority() {
|
||||
async function ChangePriority() {
|
||||
gAction.type = Ci.nsMsgFilterAction.ChangePriority;
|
||||
gAction.priority = Ci.nsMsgPriority.highest;
|
||||
yield setupTest(gFilter, gAction);
|
||||
await setupTest(gFilter, gAction);
|
||||
testCounts(true, 1, 1, 1);
|
||||
Assert.equal(Ci.nsMsgPriority.highest, gHeader.priority);
|
||||
},
|
||||
function *Label() {
|
||||
async function Label() {
|
||||
gAction.type = Ci.nsMsgFilterAction.Label;
|
||||
gAction.label = 2;
|
||||
yield setupTest(gFilter, gAction);
|
||||
await setupTest(gFilter, gAction);
|
||||
testCounts(true, 1, 1, 1);
|
||||
Assert.equal(2, gHeader.label);
|
||||
},
|
||||
function *AddTag() {
|
||||
async function AddTag() {
|
||||
gAction.type = Ci.nsMsgFilterAction.AddTag;
|
||||
gAction.strValue = "TheTag";
|
||||
yield setupTest(gFilter, gAction);
|
||||
await setupTest(gFilter, gAction);
|
||||
testCounts(true, 1, 1, 1);
|
||||
Assert.equal(gHeader.getStringProperty("keywords"), "thetag");
|
||||
},
|
||||
// this tests for marking message as good
|
||||
function *JunkScoreAsGood() {
|
||||
async function JunkScoreAsGood() {
|
||||
gAction.type = Ci.nsMsgFilterAction.JunkScore;
|
||||
gAction.junkScore = 0;
|
||||
yield setupTest(gFilter, gAction);
|
||||
await setupTest(gFilter, gAction);
|
||||
testCounts(true, 1, 1, 1);
|
||||
Assert.equal(gHeader.getStringProperty("junkscore"), "0");
|
||||
Assert.equal(gHeader.getStringProperty("junkscoreorigin"), "filter");
|
||||
},
|
||||
function *CopyToFolder() {
|
||||
async function CopyToFolder() {
|
||||
gAction.type = Ci.nsMsgFilterAction.CopyToFolder;
|
||||
gAction.targetFolderUri = gSubfolder.URI;
|
||||
gInboxCount = folderCount(IMAPPump.inbox);
|
||||
gSubfolderCount = folderCount(gSubfolder);
|
||||
yield setupTest(gFilter, gAction);
|
||||
await setupTest(gFilter, gAction);
|
||||
testCounts(true, 1, 1, 1);
|
||||
Assert.equal(gInboxCount + 1, folderCount(IMAPPump.inbox));
|
||||
Assert.equal(gSubfolderCount + 1, folderCount(gSubfolder));
|
||||
},
|
||||
function *Custom() {
|
||||
async function Custom() {
|
||||
gAction.type = Ci.nsMsgFilterAction.Custom;
|
||||
gAction.customId = 'mailnews@mozilla.org#testOffline';
|
||||
gAction.strValue = 'true';
|
||||
actionTestOffline.needsBody = true;
|
||||
yield setupTest(gFilter, gAction);
|
||||
await setupTest(gFilter, gAction);
|
||||
testCounts(true, 1, 1, 1);
|
||||
},
|
||||
/**/
|
||||
|
@ -217,7 +217,7 @@ function setupFilters()
|
|||
// basic preparation done for each test
|
||||
function setupTest(aFilter, aAction)
|
||||
{
|
||||
return Task.spawn(function* () {
|
||||
return Task.spawn(async function () {
|
||||
let filterList = IMAPPump.incomingServer.getFilterList(null);
|
||||
while (filterList.filterCount)
|
||||
filterList.removeFilterAt(0);
|
||||
|
@ -239,8 +239,8 @@ function setupTest(aFilter, aAction)
|
|||
IMAPPump.mailbox.uidnext++, []));
|
||||
let promiseUrlListener = new PromiseTestUtils.PromiseUrlListener();
|
||||
IMAPPump.inbox.updateFolderWithListener(null, promiseUrlListener);
|
||||
yield promiseUrlListener.promise;
|
||||
yield PromiseTestUtils.promiseDelay(200);
|
||||
await promiseUrlListener.promise;
|
||||
await PromiseTestUtils.promiseDelay(200);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -25,23 +25,23 @@ function setupCUSTOM1() {
|
|||
Services.prefs.setBoolPref("mail.server.default.autosync_offline_stores", false);
|
||||
}
|
||||
|
||||
function *startTest()
|
||||
async function startTest()
|
||||
{
|
||||
IMAPPump.incomingServer.rootFolder.createSubfolder("folder 1", null);
|
||||
yield PromiseTestUtils.promiseFolderAdded("folder 1");
|
||||
await PromiseTestUtils.promiseFolderAdded("folder 1");
|
||||
|
||||
addImapMessage();
|
||||
let listener = new PromiseTestUtils.PromiseUrlListener();
|
||||
IMAPPump.inbox.updateFolderWithListener(null, listener);
|
||||
yield listener.promise;
|
||||
await listener.promise;
|
||||
|
||||
// ...and download for offline use.
|
||||
let promiseUrlListener = new PromiseTestUtils.PromiseUrlListener();
|
||||
IMAPPump.inbox.downloadAllForOffline(promiseUrlListener, null);
|
||||
yield promiseUrlListener.promise;
|
||||
await promiseUrlListener.promise;
|
||||
}
|
||||
|
||||
function *doMove() {
|
||||
async function doMove() {
|
||||
var messages = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
|
||||
let rootFolder = IMAPPump.incomingServer.rootFolder;
|
||||
gFolder1 = rootFolder.getChildNamed("folder 1")
|
||||
|
@ -53,14 +53,14 @@ function *doMove() {
|
|||
MailServices.copy.CopyMessages(IMAPPump.inbox, messages, gFolder1, true,
|
||||
listener, null, false);
|
||||
IMAPPump.server.performTest("UID MOVE");
|
||||
yield listener.promise;
|
||||
await listener.promise;
|
||||
}
|
||||
|
||||
function *testMove() {
|
||||
async function testMove() {
|
||||
Assert.equal(IMAPPump.inbox.getTotalMessages(false), 0);
|
||||
let listener = new PromiseTestUtils.PromiseUrlListener();
|
||||
gFolder1.updateFolderWithListener(null, listener);
|
||||
yield listener.promise;
|
||||
await listener.promise;
|
||||
Assert.equal(gFolder1.getTotalMessages(false), 1);
|
||||
|
||||
// maildir should also delete the files.
|
||||
|
|
|
@ -57,11 +57,11 @@ function promptPasswordPS(aParent, aDialogTitle, aText, aPassword, aCheckMsg,
|
|||
return false;
|
||||
}
|
||||
|
||||
add_task(function *() {
|
||||
add_task(async function () {
|
||||
do_test_pending();
|
||||
|
||||
// Prepare files for passwords (generated by a script in bug 1018624).
|
||||
yield setupForPassword("signons-mailnews1.8-imap.json")
|
||||
await setupForPassword("signons-mailnews1.8-imap.json")
|
||||
|
||||
registerAlertTestUtils();
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ var server, daemon, incomingServer;
|
|||
|
||||
const PORT = 143;
|
||||
|
||||
add_task(function* setup() {
|
||||
add_task(async function setup() {
|
||||
// Disable new mail notifications
|
||||
Services.prefs.setBoolPref("mail.biff.play_sound", false);
|
||||
Services.prefs.setBoolPref("mail.biff.show_alert", false);
|
||||
|
@ -40,7 +40,7 @@ add_task(function* setup() {
|
|||
imapAccount.incomingServer = incomingServer;
|
||||
});
|
||||
|
||||
add_task(function* downloadEmail() {
|
||||
add_task(async function downloadEmail() {
|
||||
let inboxFolder = incomingServer.rootFolder.getChildNamed("INBOX");
|
||||
|
||||
// Check that we haven't got any messages in the folder, if we have its a test
|
||||
|
@ -50,13 +50,13 @@ add_task(function* downloadEmail() {
|
|||
// Now get the mail
|
||||
let asyncUrlListener = new PromiseTestUtils.PromiseUrlListener();
|
||||
inboxFolder.getNewMessages(null, asyncUrlListener);
|
||||
yield asyncUrlListener.promise;
|
||||
await asyncUrlListener.promise;
|
||||
|
||||
// We downloaded a message, so it works!
|
||||
Assert.equal(inboxFolder.getTotalMessages(false), 1);
|
||||
});
|
||||
|
||||
add_task(function* cleanUp() {
|
||||
add_task(async function cleanUp() {
|
||||
NetworkTestUtils.shutdownServers();
|
||||
incomingServer.closeCachedConnections();
|
||||
server.stop();
|
||||
|
|
|
@ -9,14 +9,14 @@
|
|||
load("../../../resources/POP3pump.js");
|
||||
ChromeUtils.import("resource://testing-common/mailnews/PromiseTestUtils.jsm");
|
||||
|
||||
add_task(function* runPump() {
|
||||
add_task(async function runPump() {
|
||||
|
||||
gPOP3Pump.files = ["../../../data/bugmail1",
|
||||
"../../../data/bugmail1",
|
||||
"../../../data/bugmail1",
|
||||
"../../../data/bugmail1",
|
||||
"../../../data/bugmail1"];
|
||||
yield gPOP3Pump.run();
|
||||
await gPOP3Pump.run();
|
||||
|
||||
// get message headers for the inbox folder
|
||||
var hdrs = showMessages(localAccountUtils.inboxFolder);
|
||||
|
@ -44,7 +44,7 @@ add_task(function* runPump() {
|
|||
// compact
|
||||
var listener = new PromiseTestUtils.PromiseUrlListener();
|
||||
localAccountUtils.inboxFolder.compact(listener, null);
|
||||
yield listener.promise;
|
||||
await listener.promise;
|
||||
|
||||
dump("Messages after compact\n");
|
||||
hdrs = showMessages(localAccountUtils.inboxFolder);
|
||||
|
@ -53,7 +53,7 @@ add_task(function* runPump() {
|
|||
// Add some more messages. This fails in nsMsgDatabase::AddNewHdrToDB with
|
||||
// NS_ERROR("adding hdr that already exists") before bug 1202105.
|
||||
gPOP3Pump.files = ["../../../data/draft1"];
|
||||
yield gPOP3Pump.run();
|
||||
await gPOP3Pump.run();
|
||||
|
||||
dump("Messages after new message\n");
|
||||
hdrs = showMessages(localAccountUtils.inboxFolder);
|
||||
|
|
|
@ -63,9 +63,9 @@ var gTestArray = [
|
|||
}
|
||||
Assert.equal(msgCount, 3);
|
||||
},
|
||||
function *streamMessages() {
|
||||
async function streamMessages() {
|
||||
for (let msgHdr of gMsgHdrs)
|
||||
yield streamNextMessage(msgHdr);
|
||||
await streamNextMessage(msgHdr);
|
||||
}
|
||||
];
|
||||
|
||||
|
@ -81,7 +81,7 @@ function run_test()
|
|||
run_next_test();
|
||||
}
|
||||
|
||||
var streamNextMessage = Task.async(function* (aMsgHdr) {
|
||||
var streamNextMessage = async function (aMsgHdr) {
|
||||
let messenger = Cc["@mozilla.org/messenger;1"].createInstance(Ci.nsIMessenger);
|
||||
let msgURI = aMsgHdr.folder.getUriForMsg(aMsgHdr);
|
||||
dump("streaming msg " + msgURI + " store token = " +
|
||||
|
@ -89,6 +89,6 @@ var streamNextMessage = Task.async(function* (aMsgHdr) {
|
|||
let msgServ = messenger.messageServiceFromURI(msgURI);
|
||||
let streamListener = new PromiseTestUtils.PromiseStreamListener();
|
||||
msgServ.streamMessage(msgURI, streamListener, null, null, false, "", true);
|
||||
let data = yield streamListener.promise;
|
||||
let data = await streamListener.promise;
|
||||
Assert.ok(data.startsWith("From "));
|
||||
});
|
||||
};
|
||||
|
|
|
@ -14,7 +14,7 @@ var testSubjects = ["[Bug 397009] A filter will let me tag, but not untag",
|
|||
Services.prefs.setCharPref("mail.serverDefaultStoreContractID",
|
||||
"@mozilla.org/msgstore/maildirstore;1");
|
||||
|
||||
add_task(function* runPump() {
|
||||
add_task(async function runPump() {
|
||||
// Test for multiple message copy for maildir.
|
||||
let storeID = "@mozilla.org/msgstore/maildirstore;1";
|
||||
gPOP3Pump.resetPluggableStore(storeID);
|
||||
|
@ -26,7 +26,7 @@ add_task(function* runPump() {
|
|||
|
||||
gPOP3Pump.files = ["../../../data/bugmail1",
|
||||
"../../../data/draft1"];
|
||||
yield gPOP3Pump.run();
|
||||
await gPOP3Pump.run();
|
||||
|
||||
// get message headers for the inbox folder
|
||||
let inbox = gPOP3Pump.fakeServer
|
||||
|
@ -56,7 +56,7 @@ add_task(function* runPump() {
|
|||
let promiseCopyListener = new PromiseTestUtils.PromiseCopyListener();
|
||||
MailServices.copy.CopyMessages(inbox, messages, testFolder, false,
|
||||
promiseCopyListener, null, false);
|
||||
yield promiseCopyListener.promise;
|
||||
await promiseCopyListener.promise;
|
||||
|
||||
// Check the destination headers.
|
||||
messages.clear();
|
||||
|
|
|
@ -19,7 +19,7 @@ gPOP3Pump.files = ["../../../data/bugmail1",
|
|||
var gTestSubjects = ["[Bug 397009] A filter will let me tag, but not untag",
|
||||
"Hello, did you receive my bugmail?"];
|
||||
|
||||
add_task(function* setupFolders() {
|
||||
add_task(async function setupFolders() {
|
||||
let storeID = "@mozilla.org/msgstore/maildirstore;1";
|
||||
resetPluggableStoreLocal(storeID);
|
||||
|
||||
|
@ -31,10 +31,10 @@ add_task(function* setupFolders() {
|
|||
.QueryInterface(Ci.nsIMsgLocalMailFolder)
|
||||
.createLocalSubfolder("test");
|
||||
dump("testFolder is at " + gTestFolder.filePath.path + "\n");
|
||||
yield gPOP3Pump.run();
|
||||
await gPOP3Pump.run();
|
||||
});
|
||||
|
||||
add_task(function* maildirToMbox() {
|
||||
add_task(async function maildirToMbox() {
|
||||
// Test for multiple message copy for maildir->mbox.
|
||||
|
||||
// get message headers for the inbox folder
|
||||
|
@ -56,7 +56,7 @@ add_task(function* maildirToMbox() {
|
|||
let promiseCopyListener = new PromiseTestUtils.PromiseCopyListener();
|
||||
MailServices.copy.CopyMessages(gInboxFolder, messages, gTestFolder, true,
|
||||
promiseCopyListener, null, false);
|
||||
yield promiseCopyListener.promise;
|
||||
await promiseCopyListener.promise;
|
||||
|
||||
// Check the destination headers.
|
||||
messages.clear();
|
||||
|
@ -88,7 +88,7 @@ add_task(function* maildirToMbox() {
|
|||
}
|
||||
});
|
||||
|
||||
add_task(function* mboxToMaildir() {
|
||||
add_task(async function mboxToMaildir() {
|
||||
// Test for multiple message copy for mbox->maildir.
|
||||
|
||||
// Accumulate messages to copy.
|
||||
|
@ -104,7 +104,7 @@ add_task(function* mboxToMaildir() {
|
|||
let promiseCopyListener = new PromiseTestUtils.PromiseCopyListener();
|
||||
MailServices.copy.CopyMessages(gTestFolder, messages, gInboxFolder, true,
|
||||
promiseCopyListener, null, false);
|
||||
yield promiseCopyListener.promise;
|
||||
await promiseCopyListener.promise;
|
||||
|
||||
// Check the destination headers.
|
||||
messages.clear();
|
||||
|
|
|
@ -105,7 +105,7 @@ function testNext() {
|
|||
}
|
||||
}
|
||||
|
||||
add_task(function *() {
|
||||
add_task(async function () {
|
||||
// Disable new mail notifications
|
||||
Services.prefs.setBoolPref("mail.biff.play_sound", false);
|
||||
Services.prefs.setBoolPref("mail.biff.show_alert", false);
|
||||
|
@ -113,7 +113,7 @@ add_task(function *() {
|
|||
Services.prefs.setBoolPref("mail.biff.animate_dock_icon", false);
|
||||
|
||||
// Prepare files for passwords (generated by a script in bug 1018624).
|
||||
yield setupForPassword("signons-mailnews1.8.json");
|
||||
await setupForPassword("signons-mailnews1.8.json");
|
||||
|
||||
// Set up the Server
|
||||
var serverArray = setupServerDaemon();
|
||||
|
|
|
@ -107,7 +107,7 @@ function testNext() {
|
|||
}
|
||||
}
|
||||
|
||||
add_task(function *() {
|
||||
add_task(async function () {
|
||||
// Disable new mail notifications
|
||||
Services.prefs.setBoolPref("mail.biff.play_sound", false);
|
||||
Services.prefs.setBoolPref("mail.biff.show_alert", false);
|
||||
|
@ -141,7 +141,7 @@ add_task(function *() {
|
|||
Services.prefs.setCharPref("mail.server.server2.userName", "othername");
|
||||
|
||||
// Prepare files for passwords (generated by a script in bug 1018624).
|
||||
yield setupForPassword("signons-mailnews1.8-alt.json");
|
||||
await setupForPassword("signons-mailnews1.8-alt.json");
|
||||
|
||||
// Set up the Server
|
||||
var serverArray = setupServerDaemon();
|
||||
|
|
|
@ -14,9 +14,9 @@ var kProtocol = "pop3";
|
|||
var kHostname = "localhost";
|
||||
var kServerUrl = "mailbox://" + kHostname;
|
||||
|
||||
add_task(function *() {
|
||||
add_task(async function () {
|
||||
// Prepare files for passwords (generated by a script in bug 1018624).
|
||||
yield setupForPassword("signons-mailnews1.8-multiple.json");
|
||||
await setupForPassword("signons-mailnews1.8-multiple.json");
|
||||
|
||||
// Set up the basic accounts and folders.
|
||||
// We would use createPop3ServerAndLocalFolders() however we want to have
|
||||
|
|
|
@ -174,7 +174,7 @@ function* end_test()
|
|||
do_test_finished();
|
||||
}
|
||||
|
||||
add_task(function *() {
|
||||
add_task(async function () {
|
||||
// Disable new mail notifications
|
||||
Services.prefs.setBoolPref("mail.biff.play_sound", false);
|
||||
Services.prefs.setBoolPref("mail.biff.show_alert", false);
|
||||
|
@ -183,7 +183,7 @@ add_task(function *() {
|
|||
Services.prefs.setBoolPref("signon.debug", true);
|
||||
|
||||
// Prepare files for passwords (generated by a script in bug 1018624).
|
||||
yield setupForPassword("signons-mailnews1.8.json");
|
||||
await setupForPassword("signons-mailnews1.8.json");
|
||||
|
||||
registerAlertTestUtils();
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ const PORT = 110;
|
|||
|
||||
var server, daemon, incomingServer;
|
||||
|
||||
add_task(function* setup() {
|
||||
add_task(async function setup() {
|
||||
// Disable new mail notifications
|
||||
Services.prefs.setBoolPref("mail.biff.play_sound", false);
|
||||
Services.prefs.setBoolPref("mail.biff.show_alert", false);
|
||||
|
@ -27,7 +27,7 @@ add_task(function* setup() {
|
|||
daemon.setMessages(["message1.eml"]);
|
||||
});
|
||||
|
||||
add_task(function* downloadEmail() {
|
||||
add_task(async function downloadEmail() {
|
||||
// Check that we haven't got any messages in the folder, if we have its a test
|
||||
// setup issue.
|
||||
equal(localAccountUtils.inboxFolder.getTotalMessages(false), 0);
|
||||
|
@ -36,13 +36,13 @@ add_task(function* downloadEmail() {
|
|||
let urlListener = new PromiseTestUtils.PromiseUrlListener();
|
||||
MailServices.pop3.GetNewMail(null, urlListener, localAccountUtils.inboxFolder,
|
||||
incomingServer);
|
||||
yield urlListener.promise;
|
||||
await urlListener.promise;
|
||||
|
||||
// We downloaded a message, so it works!
|
||||
equal(localAccountUtils.inboxFolder.getTotalMessages(false), 1);
|
||||
});
|
||||
|
||||
add_task(function* cleanUp() {
|
||||
add_task(async function cleanUp() {
|
||||
NetworkTestUtils.shutdownServers();
|
||||
incomingServer.closeCachedConnections();
|
||||
server.stop();
|
||||
|
|
|
@ -7,7 +7,7 @@ load("../../../resources/POP3pump.js");
|
|||
var testSubjects = ["[Bug 397009] A filter will let me tag, but not untag",
|
||||
"Hello, did you receive my bugmail?"];
|
||||
|
||||
add_task(function* runPump() {
|
||||
add_task(async function runPump() {
|
||||
// demonstration of access to the local inbox folder
|
||||
dump("local inbox folder " + localAccountUtils.inboxFolder.URI + " is loaded\n");
|
||||
// demonstration of access to the fake server
|
||||
|
@ -15,7 +15,7 @@ add_task(function* runPump() {
|
|||
|
||||
gPOP3Pump.files = ["../../../data/bugmail1",
|
||||
"../../../data/draft1"];
|
||||
yield gPOP3Pump.run();
|
||||
await gPOP3Pump.run();
|
||||
|
||||
// get message headers for the inbox folder
|
||||
let enumerator = localAccountUtils.inboxFolder.msgDatabase.EnumerateMessages();
|
||||
|
|
|
@ -21,7 +21,7 @@ function verifyError(block, errorCode) {
|
|||
var StructuredHeaders = CC("@mozilla.org/messenger/structuredheaders;1",
|
||||
Ci.msgIWritableStructuredHeaders);
|
||||
|
||||
add_task(function* check_addressing() {
|
||||
add_task(async function check_addressing() {
|
||||
let headers = new StructuredHeaders();
|
||||
headers.setHeader("To", [{name: "undisclosed-recipients", group: []}]);
|
||||
Assert.ok(Array.isArray(headers.getHeader("To")));
|
||||
|
@ -44,7 +44,7 @@ add_task(function* check_addressing() {
|
|||
"\"Comma, Name\" <test@foo.invalid>");
|
||||
});
|
||||
|
||||
add_task(function* check_custom_header() {
|
||||
add_task(async function check_custom_header() {
|
||||
// Load an extension for our custom header.
|
||||
let url = Services.io.newFileURI(do_get_file("custom_header.js")).spec;
|
||||
let promise = new Promise((resolve, reject) => {
|
||||
|
@ -60,7 +60,7 @@ add_task(function* check_custom_header() {
|
|||
.getService(Ci.nsICategoryManager)
|
||||
.addCategoryEntry("custom-mime-encoder", "X-Unusual", url, false, true);
|
||||
// The category manager doesn't fire until a later timestep.
|
||||
yield promise;
|
||||
await promise;
|
||||
let headers = new StructuredHeaders();
|
||||
headers.setRawHeader("X-Unusual", "10", null);
|
||||
Assert.equal(headers.getHeader("X-Unusual"), 16);
|
||||
|
@ -68,7 +68,7 @@ add_task(function* check_custom_header() {
|
|||
Assert.equal(headers.getRawHeader("X-Unusual"), "20");
|
||||
});
|
||||
|
||||
add_task(function* check_raw() {
|
||||
add_task(async function check_raw() {
|
||||
let headers = new StructuredHeaders();
|
||||
Assert.ok(!headers.hasHeader("Date"));
|
||||
let day = new Date("2000-01-01T00:00:00Z");
|
||||
|
@ -139,7 +139,7 @@ add_task(function* check_raw() {
|
|||
Assert.ok(moreHeaders.hasHeader("Date"));
|
||||
})
|
||||
|
||||
add_task(function* check_nsIMimeHeaders() {
|
||||
add_task(async function check_nsIMimeHeaders() {
|
||||
let headers = Cc["@mozilla.org/messenger/mimeheaders;1"]
|
||||
.createInstance(Ci.nsIMimeHeaders);
|
||||
Assert.ok(headers instanceof Ci.msgIStructuredHeaders);
|
||||
|
@ -162,7 +162,7 @@ add_task(function* check_nsIMimeHeaders() {
|
|||
}
|
||||
});
|
||||
|
||||
add_task(function* checkBuildMimeText() {
|
||||
add_task(async function checkBuildMimeText() {
|
||||
let headers = new StructuredHeaders();
|
||||
headers.setHeader("To", [{name: "François Smith", email: "user@☃.invalid"}]);
|
||||
headers.setHeader("From", [{name: "John Doe", email: "jdoe@test.invalid"}]);
|
||||
|
|
|
@ -9,8 +9,8 @@ var daemon = setupNNTPDaemon();
|
|||
// Define these up here for checking with the transaction
|
||||
var test = null;
|
||||
|
||||
add_task(function *() {
|
||||
yield Services.logins.initializationPromise;
|
||||
add_task(async function () {
|
||||
await Services.logins.initializationPromise;
|
||||
|
||||
daemon.groupCredentials = {
|
||||
"test.subscribe.empty": ["group1", "pass1"],
|
||||
|
|
|
@ -14,9 +14,9 @@ var daemon = setupNNTPDaemon();
|
|||
// Define these up here for checking with the transaction
|
||||
var test = null;
|
||||
|
||||
add_task(function *() {
|
||||
add_task(async function () {
|
||||
// Prepare files for passwords (generated by a script in bug 1018624).
|
||||
yield setupForPassword("signons-mailnews1.8.json");
|
||||
await setupForPassword("signons-mailnews1.8.json");
|
||||
|
||||
var server = makeServer(NNTP_RFC4643_extension, daemon);
|
||||
server.start();
|
||||
|
|
|
@ -17,7 +17,7 @@ var daemon = setupNNTPDaemon();
|
|||
// Define these up here for checking with the transaction
|
||||
var test = null;
|
||||
|
||||
add_task(function *() {
|
||||
add_task(async function () {
|
||||
let server = makeServer(NNTP_RFC4643_extension, daemon);
|
||||
server.start();
|
||||
|
||||
|
@ -56,7 +56,7 @@ add_task(function *() {
|
|||
Services.prefs.setCharPref("mail.server.server2.type", "nntp");
|
||||
|
||||
// Prepare files for passwords (generated by a script in bug 1018624).
|
||||
yield setupForPassword("signons-mailnews1.8-alt.json");
|
||||
await setupForPassword("signons-mailnews1.8-alt.json");
|
||||
|
||||
try {
|
||||
// Note, the uri is for hostname "invalid" which is the original uri. See
|
||||
|
|
|
@ -14,9 +14,9 @@ var kProtocol = "nntp";
|
|||
var kHostname = "localhost";
|
||||
var kServerUrl = "news://" + kHostname;
|
||||
|
||||
add_task(function *() {
|
||||
add_task(async function () {
|
||||
// Prepare files for passwords (generated by a script in bug 1018624).
|
||||
yield setupForPassword("signons-mailnews1.8.json")
|
||||
await setupForPassword("signons-mailnews1.8.json")
|
||||
|
||||
// Set up the basic accounts and folders.
|
||||
localAccountUtils.loadLocalMailAccount();
|
||||
|
|
|
@ -9,7 +9,7 @@ const PORT = 119;
|
|||
|
||||
var daemon, localserver, server;
|
||||
|
||||
add_task(function* setup() {
|
||||
add_task(async function setup() {
|
||||
daemon = setupNNTPDaemon();
|
||||
server = makeServer(NNTP_RFC2980_handler, daemon);
|
||||
server.start();
|
||||
|
@ -17,18 +17,18 @@ add_task(function* setup() {
|
|||
localserver = setupLocalServer(PORT, "news.tinderbox.invalid");
|
||||
});
|
||||
|
||||
add_task(function* findMessages() {
|
||||
add_task(async function findMessages() {
|
||||
// This is a trivial check that makes sure that we actually do some network
|
||||
// traffic without caring about the exact network traffic.
|
||||
let folder = localserver.rootFolder.getChildNamed("test.filter");
|
||||
equal(folder.getTotalMessages(false), 0);
|
||||
let asyncUrlListener = new PromiseTestUtils.PromiseUrlListener();
|
||||
folder.getNewMessages(null, asyncUrlListener);
|
||||
yield asyncUrlListener.promise;
|
||||
await asyncUrlListener.promise;
|
||||
equal(folder.getTotalMessages(false), 8);
|
||||
});
|
||||
|
||||
add_task(function* cleanUp() {
|
||||
add_task(async function cleanUp() {
|
||||
NetworkTestUtils.shutdownServers();
|
||||
localserver.closeCachedConnections();
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче