Bug 1446833: Part 2 - Stop using Task.jsm in xpcshell/head.js. r?florian draft
authorKris Maglione <maglione.k@gmail.com>
Sun, 18 Mar 2018 15:27:04 -0700
changeset 769190 7fd21a311567e1979e73494cc26b6ba04a36cf2b
parent 769189 79692462549fc0240459000b0b490d046f473b67
child 769191 a65cfa697c4537872b50d6cbbe0f49dae4c16b63
push id103063
push usermaglione.k@gmail.com
push dateSun, 18 Mar 2018 23:28:42 +0000
reviewersflorian
bugs1446833
milestone61.0a1
Bug 1446833: Part 2 - Stop using Task.jsm in xpcshell/head.js. r?florian MozReview-Commit-ID: 6vSpwih9Fnr
testing/xpcshell/head.js
--- 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