Bug 1455536 - Follow-up: Remove remaining unneeded uses of Task.{async|spawn}. r=arai
This commit is contained in:
Родитель
ce52cc0b22
Коммит
494c9a0bc6
|
@ -16,8 +16,8 @@ runnablePrompter.prototype = {
|
|||
_asyncPrompter: null,
|
||||
_hashKey: null,
|
||||
|
||||
run: Task.async(function *() {
|
||||
yield Services.logins.initializationPromise;
|
||||
async run() {
|
||||
await Services.logins.initializationPromise;
|
||||
this._asyncPrompter._log.debug("Running prompt for " + this._hashKey);
|
||||
let prompter = this._asyncPrompter._pendingPrompts[this._hashKey];
|
||||
let ok = false;
|
||||
|
@ -46,7 +46,7 @@ runnablePrompter.prototype = {
|
|||
|
||||
this._asyncPrompter._log.debug("Finished running prompter for " + this._hashKey);
|
||||
this._asyncPrompter._doAsyncAuthPrompt();
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
function msgAsyncPrompter() {
|
||||
|
|
|
@ -386,35 +386,33 @@ function setupFilters()
|
|||
*/
|
||||
|
||||
// basic preparation done for each test
|
||||
function setupTest(aFilter, aAction)
|
||||
async function setupTest(aFilter, aAction)
|
||||
{
|
||||
return Task.spawn(async function () {
|
||||
let filterList = IMAPPump.incomingServer.getFilterList(null);
|
||||
while (filterList.filterCount)
|
||||
filterList.removeFilterAt(0);
|
||||
if (aFilter)
|
||||
{
|
||||
aFilter.clearActionList();
|
||||
if (aAction) {
|
||||
aFilter.appendAction(aAction);
|
||||
filterList.insertFilterAt(0, aFilter);
|
||||
}
|
||||
let filterList = IMAPPump.incomingServer.getFilterList(null);
|
||||
while (filterList.filterCount)
|
||||
filterList.removeFilterAt(0);
|
||||
if (aFilter)
|
||||
{
|
||||
aFilter.clearActionList();
|
||||
if (aAction) {
|
||||
aFilter.appendAction(aAction);
|
||||
filterList.insertFilterAt(0, aFilter);
|
||||
}
|
||||
if (gInboxListener)
|
||||
gDbService.unregisterPendingListener(gInboxListener);
|
||||
}
|
||||
if (gInboxListener)
|
||||
gDbService.unregisterPendingListener(gInboxListener);
|
||||
|
||||
IMAPPump.inbox.clearNewMessages();
|
||||
IMAPPump.inbox.clearNewMessages();
|
||||
|
||||
gInboxListener = new DBListener();
|
||||
gDbService.registerPendingListener(IMAPPump.inbox, gInboxListener);
|
||||
gMoveCallbackCount = 0;
|
||||
IMAPPump.mailbox.addMessage(new imapMessage(specForFileName(gMessage),
|
||||
IMAPPump.mailbox.uidnext++, []));
|
||||
let promiseUrlListener = new PromiseTestUtils.PromiseUrlListener();
|
||||
IMAPPump.inbox.updateFolderWithListener(null, promiseUrlListener);
|
||||
await promiseUrlListener.promise;
|
||||
await PromiseTestUtils.promiseDelay(200);
|
||||
});
|
||||
gInboxListener = new DBListener();
|
||||
gDbService.registerPendingListener(IMAPPump.inbox, gInboxListener);
|
||||
gMoveCallbackCount = 0;
|
||||
IMAPPump.mailbox.addMessage(new imapMessage(specForFileName(gMessage),
|
||||
IMAPPump.mailbox.uidnext++, []));
|
||||
let promiseUrlListener = new PromiseTestUtils.PromiseUrlListener();
|
||||
IMAPPump.inbox.updateFolderWithListener(null, promiseUrlListener);
|
||||
await promiseUrlListener.promise;
|
||||
await PromiseTestUtils.promiseDelay(200);
|
||||
}
|
||||
|
||||
// Cleanup, null out everything, close all cached connections and stop the
|
||||
|
|
|
@ -215,33 +215,31 @@ function setupFilters()
|
|||
*/
|
||||
|
||||
// basic preparation done for each test
|
||||
function setupTest(aFilter, aAction)
|
||||
async function setupTest(aFilter, aAction)
|
||||
{
|
||||
return Task.spawn(async function () {
|
||||
let filterList = IMAPPump.incomingServer.getFilterList(null);
|
||||
while (filterList.filterCount)
|
||||
filterList.removeFilterAt(0);
|
||||
if (aFilter)
|
||||
{
|
||||
aFilter.clearActionList();
|
||||
if (aAction) {
|
||||
aFilter.appendAction(aAction);
|
||||
filterList.insertFilterAt(0, aFilter);
|
||||
}
|
||||
let filterList = IMAPPump.incomingServer.getFilterList(null);
|
||||
while (filterList.filterCount)
|
||||
filterList.removeFilterAt(0);
|
||||
if (aFilter)
|
||||
{
|
||||
aFilter.clearActionList();
|
||||
if (aAction) {
|
||||
aFilter.appendAction(aAction);
|
||||
filterList.insertFilterAt(0, aFilter);
|
||||
}
|
||||
if (gInboxListener)
|
||||
gDbService.unregisterPendingListener(gInboxListener);
|
||||
}
|
||||
if (gInboxListener)
|
||||
gDbService.unregisterPendingListener(gInboxListener);
|
||||
|
||||
gInboxListener = new DBListener();
|
||||
gDbService.registerPendingListener(IMAPPump.inbox, gInboxListener);
|
||||
gMoveCallbackCount = 0;
|
||||
IMAPPump.mailbox.addMessage(new imapMessage(specForFileName(gMessage),
|
||||
IMAPPump.mailbox.uidnext++, []));
|
||||
let promiseUrlListener = new PromiseTestUtils.PromiseUrlListener();
|
||||
IMAPPump.inbox.updateFolderWithListener(null, promiseUrlListener);
|
||||
await promiseUrlListener.promise;
|
||||
await PromiseTestUtils.promiseDelay(200);
|
||||
});
|
||||
gInboxListener = new DBListener();
|
||||
gDbService.registerPendingListener(IMAPPump.inbox, gInboxListener);
|
||||
gMoveCallbackCount = 0;
|
||||
IMAPPump.mailbox.addMessage(new imapMessage(specForFileName(gMessage),
|
||||
IMAPPump.mailbox.uidnext++, []));
|
||||
let promiseUrlListener = new PromiseTestUtils.PromiseUrlListener();
|
||||
IMAPPump.inbox.updateFolderWithListener(null, promiseUrlListener);
|
||||
await promiseUrlListener.promise;
|
||||
await PromiseTestUtils.promiseDelay(200);
|
||||
}
|
||||
|
||||
// Cleanup, null out everything, close all cached connections and stop the
|
||||
|
|
|
@ -94,28 +94,28 @@ function MochaSuite(name) {
|
|||
this.suites = [];
|
||||
}
|
||||
|
||||
/// The real code for running a suite of tests, written as a generator.
|
||||
MochaSuite.prototype._runSuite = function *() {
|
||||
/// The real code for running a suite of tests, written as async function.
|
||||
MochaSuite.prototype._runSuite = async function () {
|
||||
info("Running suite " + this.name);
|
||||
for (let setup of this.setup) {
|
||||
yield runFunction(setup);
|
||||
await runFunction(setup);
|
||||
}
|
||||
for (let test of this.tests) {
|
||||
info("Running test " + test.name);
|
||||
yield runFunction(test.test);
|
||||
await runFunction(test.test);
|
||||
}
|
||||
for (let suite of this.suites) {
|
||||
yield suite.runSuite();
|
||||
await suite.runSuite();
|
||||
}
|
||||
for (let fn of this.teardown) {
|
||||
yield runFunction(fn);
|
||||
await runFunction(fn);
|
||||
}
|
||||
info("Finished suite " + this.name);
|
||||
};
|
||||
|
||||
/// The outer call to run a test suite, which returns a promise of completion.
|
||||
MochaSuite.prototype.runSuite = function () {
|
||||
return Task.spawn(this._runSuite.bind(this));
|
||||
return this._runSuite();
|
||||
};
|
||||
|
||||
/// Run the given function, returning a promise of when the test will complete.
|
||||
|
|
Загрузка…
Ссылка в новой задаче