Bug 1592781 catch unhandled rejections in async TaskRunner Tasks r=jgraham
authorKarl Tomlinson <karlt+@karlt.net>
Thu, 07 Nov 2019 00:47:33 +0000
changeset 502534 98ce0aadba7a30c5ca695468bf8561d1c911b038
parent 502533 195a6104b5fdd7b3f9d04d1ce8e0e86bdbb29869
child 502535 2d26bfe54d3fabcd4aabe257cbf9bb5c1cf9fd27
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgraham
bugs1592781
milestone72.0a1
Bug 1592781 catch unhandled rejections in async TaskRunner Tasks r=jgraham Unhandled rejections are then reported against the appropriate subtest. Differential Revision: https://phabricator.services.mozilla.com/D51564
testing/web-platform/meta/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-suspend.https.html.ini
testing/web-platform/tests/webaudio/resources/audit.js
--- a/testing/web-platform/meta/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-suspend.https.html.ini
+++ b/testing/web-platform/meta/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-suspend.https.html.ini
@@ -1,12 +1,6 @@
 [audioworklet-suspend.https.html]
-  expected:
-    if release_or_beta: ERROR
   [Executing "load-worklet-and-suspend"]
     bug: AudioWorklet not enabled on release_or_beta
     expected:
-      if release_or_beta: TIMEOUT
+      if release_or_beta: FAIL
 
-  [Audit report]
-    expected:
-      if release_or_beta: NOTRUN
-
--- a/testing/web-platform/tests/webaudio/resources/audit.js
+++ b/testing/web-platform/tests/webaudio/resources/audit.js
@@ -1181,19 +1181,22 @@ window.Audit = (function() {
     // task function.
     run() {
       this._state = TaskState.STARTED;
       // Print out the task entry with label and description.
       _logPassed(
           '> [' + this._label + '] ' +
           (this._description ? this._description : ''));
 
-      return new Promise(resolve => {
+      return new Promise((resolve, reject) => {
         this._resolve = resolve;
-        this._taskFunction(this, this.should.bind(this));
+        let result = this._taskFunction(this, this.should.bind(this));
+        if (result && typeof result.then === "function") {
+          result.then(undefined, reject);
+        }
       });
     }
 
     // Update the task success based on the individual assertion/test inside.
     update(subTask) {
       // After one of tests fails within a task, the result is irreversible.
       if (subTask.result === false) {
         this._result = false;