parse-error.html (988B)
1 <!DOCTYPE html> 2 <meta charset=utf-8> 3 <title>JSON modules: parse error</title> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <div id=log></div> 7 <script> 8 setup({ 9 allow_uncaught_exception: true, 10 }); 11 async_test(t => { 12 window.addEventListener("error", t.step_func_done(e => { 13 assert_true(e instanceof ErrorEvent, "ErrorEvent"); 14 assert_true(e.error instanceof SyntaxError, "SyntaxError"); 15 16 // The specific values of these properties are implementation-defined 17 // per https://html.spec.whatwg.org/#report-an-exception 18 // and https://html.spec.whatwg.org/#extract-error. 19 // But, we can at least check that they exist. 20 assert_not_equals(e.message, undefined); 21 assert_not_equals(e.filename, undefined); 22 assert_not_equals(e.lineno, undefined); 23 assert_not_equals(e.colno, undefined); 24 })); 25 }); 26 </script> 27 <script type="module"> 28 import v from "./parse-error.json" with { type: "json" }; 29 </script>