dedicated-worker-parse-error-failure.html (1130B)
1 <!DOCTYPE html> 2 <title>DedicatedWorker: parse error failure</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script> setup({allow_uncaught_exception: true}); </script> 6 <script src="./support/check-error-arguments.js"></script> 7 <script> 8 9 promise_test(async () => { 10 const scriptURL = 'modules/resources/syntax-error.js'; 11 const worker = new Worker(scriptURL, { type: 'classic' }); 12 const args = await new Promise(resolve => 13 worker.onerror = (...args) => resolve(args)); 14 window.checkErrorArguments(args); 15 }, 'Classic worker construction for script with syntax error should dispatch ' + 16 'an event named error.'); 17 18 promise_test(async () => { 19 const scriptURL = 'modules/resources/static-import-worker.js'; 20 const worker = new Worker(scriptURL, { type: 'classic' }); 21 worker.postMessage('Send message for tests from main script.'); 22 const args = await new Promise(resolve => 23 worker.onerror = (...args) => resolve(args)); 24 window.checkErrorArguments(args); 25 }, 'Static import on classic worker should dispatch an event named error.'); 26 27 </script>