Bug 1446833: Part 2 - Stop using Task.jsm in xpcshell/head.js. r?florian
MozReview-Commit-ID: 6vSpwih9Fnr
--- a/testing/xpcshell/head.js
+++ b/testing/xpcshell/head.js
@@ -566,26 +566,26 @@ function _execute_test() {
_testLogger.error(_exception_message(ex),
{
stack: _format_stack(stack),
source_file: filename
});
};
let complete = _cleanupFunctions.length == 0;
- _Task.spawn(function* () {
+ (async () => {
for (let func of _cleanupFunctions.reverse()) {
try {
- yield func();
+ await func();
} catch (ex) {
reportCleanupError(ex);
}
}
_cleanupFunctions = [];
- }).catch(reportCleanupError).then(() => complete = true);
+ })().catch(reportCleanupError).then(() => complete = true);
_Services.tm.spinEventLoopUntil(() => complete);
// Restore idle service to avoid leaks.
_fakeIdleService.deactivate();
if (_profileInitialized) {
// Since we have a profile, we will notify profile shutdown topics at
// the end of the current test, to ensure correct cleanup on shutdown.
@@ -1398,17 +1398,17 @@ function run_next_test() {
"SKIP",
_message);
executeSoon(run_next_test);
return;
}
if (_properties.isTask) {
_gTaskRunning = true;
- _Task.spawn(_gRunningTest).then(() => {
+ (async () => _gRunningTest())().then(() => {
_gTaskRunning = false;
run_next_test();
}, ex => {
_gTaskRunning = false;
try {
do_report_unexpected_exception(ex);
} catch (ex) {
// The above throws NS_ERROR_ABORT and we don't want this to show up