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
--- 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;