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