2 <script src=
"../../resources/js-test.js"></script>
4 window
.jsTestIsAsync
= true;
7 var errorsInWorker
= 0;
9 for (i
= 0; i
< workers
; ++i
) {
10 var worker
= new Worker('resources/throw-on-message-worker.js');
11 promises
.push(new Promise(function(resolve
, reject
) {
12 worker
.onmessage = function(event
) {
13 if (event
.data
=== 'second')
15 else if (event
.data
=== 'error')
19 worker
.postMessage('first');
20 worker
.postMessage('second');
23 Promise
.all(promises
).then(function() {
24 if (errorsInWorker
=== workers
)
25 testPassed('all worker errors were reported.');
27 testFailed('only ' + errorsInWorker
+ ' errors reported in ' + workers
+ ' workers');