diff --git a/mailnews/base/test/unit/test_imapPump.js b/mailnews/base/test/unit/test_imapPump.js index 61d33053c4..e93c15b140 100644 --- a/mailnews/base/test/unit/test_imapPump.js +++ b/mailnews/base/test/unit/test_imapPump.js @@ -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); diff --git a/mailnews/base/test/unit/test_searchChaining.js b/mailnews/base/test/unit/test_searchChaining.js index 0d7c6f47bc..50414628ce 100644 --- a/mailnews/base/test/unit/test_searchChaining.js +++ b/mailnews/base/test/unit/test_searchChaining.js @@ -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 diff --git a/mailnews/compose/test/unit/test_attachment.js b/mailnews/compose/test/unit/test_attachment.js index 932baf499e..26df45aaea 100644 --- a/mailnews/compose/test/unit/test_attachment.js +++ b/mailnews/compose/test/unit/test_attachment.js @@ -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]); } } diff --git a/mailnews/compose/test/unit/test_bug155172.js b/mailnews/compose/test/unit/test_bug155172.js index d9f3f2c420..7d85933f27 100644 --- a/mailnews/compose/test/unit/test_bug155172.js +++ b/mailnews/compose/test/unit/test_bug155172.js @@ -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"); diff --git a/mailnews/compose/test/unit/test_detectAttachmentCharset.js b/mailnews/compose/test/unit/test_detectAttachmentCharset.js index b4fc9637bd..03e93ddad8 100644 --- a/mailnews/compose/test/unit/test_detectAttachmentCharset.js +++ b/mailnews/compose/test/unit/test_detectAttachmentCharset.js @@ -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 } diff --git a/mailnews/compose/test/unit/test_longLines.js b/mailnews/compose/test/unit/test_longLines.js index 01409df37f..c6a404997a 100644 --- a/mailnews/compose/test/unit/test_longLines.js +++ b/mailnews/compose/test/unit/test_longLines.js @@ -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() { "" + "" + longMultibyteLine + ""; 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() { "" + "" + longMultibyteLineCJK + ""; 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() { "" + "" + longMultibyteLineJapanese + ""; 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", diff --git a/mailnews/compose/test/unit/test_messageHeaders.js b/mailnews/compose/test/unit/test_messageHeaders.js index 41933d47aa..08ae8235f0 100644 --- a/mailnews/compose/test/unit/test_messageHeaders.js +++ b/mailnews/compose/test/unit/test_messageHeaders.js @@ -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 "; 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 ", @@ -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 "; fields.replyTo = "Frédéric "; 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?= ", "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 "; fields.replyTo = "Charles "; 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 = " "; 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,"', "Content-Location": '"data:text/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 ", "cc": "Alex ", "bcc": "Boris ", @@ -502,11 +502,11 @@ function* testSentMessage() { "X-Mozilla-Draft-Info": undefined, "Fcc": undefined }); - yield sendMessage({"bcc": "Somebody ", "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", diff --git a/mailnews/compose/test/unit/test_saveDraft.js b/mailnews/compose/test/unit/test_saveDraft.js index b8ab59d9d0..34d4a0e075 100644 --- a/mailnews/compose/test/unit/test_saveDraft.js +++ b/mailnews/compose/test/unit/test_saveDraft.js @@ -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); }); diff --git a/mailnews/compose/test/unit/test_sendObserver.js b/mailnews/compose/test/unit/test_sendObserver.js index 92824ba17e..be1a700eef 100644 --- a/mailnews/compose/test/unit/test_sendObserver.js +++ b/mailnews/compose/test/unit/test_sendObserver.js @@ -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 "; 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"); diff --git a/mailnews/compose/test/unit/test_smtpPassword.js b/mailnews/compose/test/unit/test_smtpPassword.js index 581bf4da68..275ca8c12b 100644 --- a/mailnews/compose/test/unit/test_smtpPassword.js +++ b/mailnews/compose/test/unit/test_smtpPassword.js @@ -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"); diff --git a/mailnews/compose/test/unit/test_smtpPassword2.js b/mailnews/compose/test/unit/test_smtpPassword2.js index 1a1e8a27f0..88f92a9c1a 100644 --- a/mailnews/compose/test/unit/test_smtpPassword2.js +++ b/mailnews/compose/test/unit/test_smtpPassword2.js @@ -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(); diff --git a/mailnews/compose/test/unit/test_smtpPasswordFailure1.js b/mailnews/compose/test/unit/test_smtpPasswordFailure1.js index bdf59a5161..88023a2e3a 100644 --- a/mailnews/compose/test/unit/test_smtpPasswordFailure1.js +++ b/mailnews/compose/test/unit/test_smtpPasswordFailure1.js @@ -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(); diff --git a/mailnews/compose/test/unit/test_smtpPasswordFailure2.js b/mailnews/compose/test/unit/test_smtpPasswordFailure2.js index 68b66cd488..b915b3f771 100644 --- a/mailnews/compose/test/unit/test_smtpPasswordFailure2.js +++ b/mailnews/compose/test/unit/test_smtpPasswordFailure2.js @@ -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(); diff --git a/mailnews/compose/test/unit/test_smtpPasswordFailure3.js b/mailnews/compose/test/unit/test_smtpPasswordFailure3.js index 16b4dfa839..4cd11dafe3 100644 --- a/mailnews/compose/test/unit/test_smtpPasswordFailure3.js +++ b/mailnews/compose/test/unit/test_smtpPasswordFailure3.js @@ -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(); diff --git a/mailnews/compose/test/unit/test_smtpProxy.js b/mailnews/compose/test/unit/test_smtpProxy.js index 0ed774ed4a..ec6d600bfe 100644 --- a/mailnews/compose/test/unit/test_smtpProxy.js +++ b/mailnews/compose/test/unit/test_smtpProxy.js @@ -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(); }); diff --git a/mailnews/imap/test/unit/test_filterNeedsBody.js b/mailnews/imap/test/unit/test_filterNeedsBody.js index 517c523e96..53e059679d 100644 --- a/mailnews/imap/test/unit/test_filterNeedsBody.js +++ b/mailnews/imap/test/unit/test_filterNeedsBody.js @@ -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() { diff --git a/mailnews/imap/test/unit/test_imapFilterActions.js b/mailnews/imap/test/unit/test_imapFilterActions.js index b55f41df54..5cb66db09b 100644 --- a/mailnews/imap/test/unit/test_imapFilterActions.js +++ b/mailnews/imap/test/unit/test_imapFilterActions.js @@ -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); }); } diff --git a/mailnews/imap/test/unit/test_imapFilterActionsPostplugin.js b/mailnews/imap/test/unit/test_imapFilterActionsPostplugin.js index cf829ea0b8..26823696d1 100644 --- a/mailnews/imap/test/unit/test_imapFilterActionsPostplugin.js +++ b/mailnews/imap/test/unit/test_imapFilterActionsPostplugin.js @@ -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); }); } diff --git a/mailnews/imap/test/unit/test_imapMove.js b/mailnews/imap/test/unit/test_imapMove.js index d69c8921ab..06a32540d5 100644 --- a/mailnews/imap/test/unit/test_imapMove.js +++ b/mailnews/imap/test/unit/test_imapMove.js @@ -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. diff --git a/mailnews/imap/test/unit/test_imapPasswordFailure.js b/mailnews/imap/test/unit/test_imapPasswordFailure.js index 47e25fe846..f69c18341e 100644 --- a/mailnews/imap/test/unit/test_imapPasswordFailure.js +++ b/mailnews/imap/test/unit/test_imapPasswordFailure.js @@ -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(); diff --git a/mailnews/imap/test/unit/test_imapProxy.js b/mailnews/imap/test/unit/test_imapProxy.js index 0cd1c5ccc3..4d6781db6d 100644 --- a/mailnews/imap/test/unit/test_imapProxy.js +++ b/mailnews/imap/test/unit/test_imapProxy.js @@ -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(); diff --git a/mailnews/local/test/unit/test_duplicateKey.js b/mailnews/local/test/unit/test_duplicateKey.js index 88ad994d0c..cf803ba846 100644 --- a/mailnews/local/test/unit/test_duplicateKey.js +++ b/mailnews/local/test/unit/test_duplicateKey.js @@ -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); diff --git a/mailnews/local/test/unit/test_movemailDownload.js b/mailnews/local/test/unit/test_movemailDownload.js index 0f9c951c42..63adaf82ce 100644 --- a/mailnews/local/test/unit/test_movemailDownload.js +++ b/mailnews/local/test/unit/test_movemailDownload.js @@ -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 ")); -}); +}; diff --git a/mailnews/local/test/unit/test_pop3MultiCopy.js b/mailnews/local/test/unit/test_pop3MultiCopy.js index 1d5d434b80..7945c82a03 100644 --- a/mailnews/local/test/unit/test_pop3MultiCopy.js +++ b/mailnews/local/test/unit/test_pop3MultiCopy.js @@ -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(); diff --git a/mailnews/local/test/unit/test_pop3MultiCopy2.js b/mailnews/local/test/unit/test_pop3MultiCopy2.js index 286cb7de54..9056de60d9 100644 --- a/mailnews/local/test/unit/test_pop3MultiCopy2.js +++ b/mailnews/local/test/unit/test_pop3MultiCopy2.js @@ -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(); diff --git a/mailnews/local/test/unit/test_pop3Password.js b/mailnews/local/test/unit/test_pop3Password.js index 4603671f6d..a1d408d120 100644 --- a/mailnews/local/test/unit/test_pop3Password.js +++ b/mailnews/local/test/unit/test_pop3Password.js @@ -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(); diff --git a/mailnews/local/test/unit/test_pop3Password2.js b/mailnews/local/test/unit/test_pop3Password2.js index 28167257de..f1653fcdaf 100644 --- a/mailnews/local/test/unit/test_pop3Password2.js +++ b/mailnews/local/test/unit/test_pop3Password2.js @@ -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(); diff --git a/mailnews/local/test/unit/test_pop3Password3.js b/mailnews/local/test/unit/test_pop3Password3.js index 6fbce77b35..d88e1b01ea 100644 --- a/mailnews/local/test/unit/test_pop3Password3.js +++ b/mailnews/local/test/unit/test_pop3Password3.js @@ -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 diff --git a/mailnews/local/test/unit/test_pop3PasswordFailure.js b/mailnews/local/test/unit/test_pop3PasswordFailure.js index 3ffd0baac5..0b3e55d2ec 100644 --- a/mailnews/local/test/unit/test_pop3PasswordFailure.js +++ b/mailnews/local/test/unit/test_pop3PasswordFailure.js @@ -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(); diff --git a/mailnews/local/test/unit/test_pop3Proxy.js b/mailnews/local/test/unit/test_pop3Proxy.js index eb30f69b20..c3c78e0c28 100644 --- a/mailnews/local/test/unit/test_pop3Proxy.js +++ b/mailnews/local/test/unit/test_pop3Proxy.js @@ -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(); diff --git a/mailnews/local/test/unit/test_pop3Pump.js b/mailnews/local/test/unit/test_pop3Pump.js index 1afe530737..d493dc175b 100644 --- a/mailnews/local/test/unit/test_pop3Pump.js +++ b/mailnews/local/test/unit/test_pop3Pump.js @@ -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(); diff --git a/mailnews/mime/test/unit/test_structured_headers.js b/mailnews/mime/test/unit/test_structured_headers.js index 22f156f010..bea2ac23e7 100644 --- a/mailnews/mime/test/unit/test_structured_headers.js +++ b/mailnews/mime/test/unit/test_structured_headers.js @@ -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\" "); }); -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"}]); diff --git a/mailnews/news/test/unit/test_nntpGroupPassword.js b/mailnews/news/test/unit/test_nntpGroupPassword.js index 391e9c34f1..f612dd67fa 100644 --- a/mailnews/news/test/unit/test_nntpGroupPassword.js +++ b/mailnews/news/test/unit/test_nntpGroupPassword.js @@ -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"], diff --git a/mailnews/news/test/unit/test_nntpPassword.js b/mailnews/news/test/unit/test_nntpPassword.js index f083253a8b..2ae365f309 100644 --- a/mailnews/news/test/unit/test_nntpPassword.js +++ b/mailnews/news/test/unit/test_nntpPassword.js @@ -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(); diff --git a/mailnews/news/test/unit/test_nntpPassword2.js b/mailnews/news/test/unit/test_nntpPassword2.js index 7e3b6b6559..a709dbe739 100644 --- a/mailnews/news/test/unit/test_nntpPassword2.js +++ b/mailnews/news/test/unit/test_nntpPassword2.js @@ -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 diff --git a/mailnews/news/test/unit/test_nntpPassword3.js b/mailnews/news/test/unit/test_nntpPassword3.js index 4318d9517e..362f8e333e 100644 --- a/mailnews/news/test/unit/test_nntpPassword3.js +++ b/mailnews/news/test/unit/test_nntpPassword3.js @@ -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(); diff --git a/mailnews/news/test/unit/test_nntpProxy.js b/mailnews/news/test/unit/test_nntpProxy.js index 4715eee68f..71d9644520 100644 --- a/mailnews/news/test/unit/test_nntpProxy.js +++ b/mailnews/news/test/unit/test_nntpProxy.js @@ -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(); });