summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module-assertions/parse-error.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module-assertions/parse-error.html')
-rw-r--r--testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module-assertions/parse-error.html21
1 files changed, 21 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module-assertions/parse-error.html b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module-assertions/parse-error.html
new file mode 100644
index 0000000000..9d0e3284fe
--- /dev/null
+++ b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module-assertions/parse-error.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>JSON modules: parse error</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+setup({
+ allow_uncaught_exception: true,
+});
+async_test(t => {
+ window.addEventListener("error", t.step_func_done(e => {
+ assert_true(e instanceof ErrorEvent, "ErrorEvent");
+ assert_equals(e.filename, new URL("parse-error.json", location).href);
+ assert_true(e.error instanceof SyntaxError, "SyntaxError");
+ }));
+});
+</script>
+<script type="module">
+import v from "./parse-error.json" assert { type: "json" };
+</script>