| OLD | NEW |
| 1 <!-- | 1 <!DOCTYPE html> |
| 2 This test case caught a crash bug in Chrome, due to a logic bug in the spec when | 2 <title>Handling of instantiation errors, 1</title> |
| 3 a second <script> element tried to load a previously-failed module. As such, the | |
| 4 test passes as long as nothing crashes. | |
| 5 | 3 |
| 6 See https://github.com/whatwg/html/pull/2559 for background. | 4 <script src="/resources/testharness.js"></script> |
| 7 --> | 5 <script src="/resources/testharnessreport.js"></script> |
| 6 <script> |
| 7 setup({allow_uncaught_exception: true}); |
| 8 | 8 |
| 9 <!DOCTYPE html> | 9 window.log = []; |
| 10 <html> | 10 |
| 11 <head> | 11 window.addEventListener("error", ev => log.push(ev.error)); |
| 12 <title>html-script-module-instantiation-error-1</title> | 12 |
| 13 <script src="/resources/testharness.js"></script> | 13 const test_load = async_test( |
| 14 <script src="/resources/testharnessreport.js"></script> | 14 "Test that missing exports lead to SyntaxError events on window and " + |
| 15 </head> | 15 "load events on script, and that exceptions are remembered"); |
| 16 <body> | 16 window.addEventListener("load", test_load.step_func_done(ev => { |
| 17 <h1>html-script-module-instantiation-error-1</h1> | 17 const exn = log[0]; |
| 18 <script> setup({allow_uncaught_exception: true}) </script> | 18 assert_array_equals(log, [exn, 1, exn, 2, exn, 3, exn, 4, exn, 5]); |
| 19 <script type="module" src="./instantiation-error-1.js"></script> | 19 assert_equals(exn.constructor, SyntaxError); |
| 20 <script type="module" src="./instantiation-error-1.js"></script> | 20 })); |
| 21 </body> | 21 |
| 22 </html> | 22 function unreachable() { log.push("unexpected"); } |
| 23 </script> |
| 24 <script type="module" src="./missing-export.js" |
| 25 onerror="unreachable()" onload="log.push(1)"></script> |
| 26 <script type="module" src="./missing-export.js" |
| 27 onerror="unreachable()" onload="log.push(2)"></script> |
| 28 <script type="module" src="./missing-export-nested.js" |
| 29 onerror="unreachable()" onload="log.push(3)"></script> |
| 30 <script type="module" src="./missing-export.js" |
| 31 onerror="unreachable()" onload="log.push(4)"></script> |
| 32 <script type="module" src="./missing-export-nested.js" |
| 33 onerror="unreachable()" onload="log.push(5)"></script> |
| OLD | NEW |