diff options
Diffstat (limited to 'testing/web-platform/tests/html/semantics/scripting-1/the-script-element/import-attributes/invalid-import-errors-order.html')
-rw-r--r-- | testing/web-platform/tests/html/semantics/scripting-1/the-script-element/import-attributes/invalid-import-errors-order.html | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/import-attributes/invalid-import-errors-order.html b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/import-attributes/invalid-import-errors-order.html new file mode 100644 index 0000000000..8c438f626b --- /dev/null +++ b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/import-attributes/invalid-import-errors-order.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<title>Handling of invalid module type import attributes</title> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> + setup({allow_uncaught_exception: true}); + + var log = []; + window.addEventListener("error", ev => log.push(ev.error)); + + const test_load = async_test( + "Test that the errors order for invalid import declarations is" + + " specifier, then attribute key, and then type attribute value."); + window.addEventListener("load", test_load.step_func_done(ev => { + assert_equals(log.length, 3); + assert_equals(log[0].constructor, SyntaxError); + assert_equals(log[1].constructor, SyntaxError); + assert_equals(log[2].constructor, SyntaxError); + })); + + function unreachable() { log.push("unexpected"); } +</script> +<script type="module" onerror="unreachable()"> + // unknown attribute is reported before invalid specifier + import "INVALID" with { unknown: "foo" }; +</script> +<script type="module" onerror="unreachable()"> + // unknown attribute is reported before unknown type + import "./valid" with { unknown: "foo", type: "unknown" }; +</script> +<script type="module" onerror="unreachable()"> + // unknown attribute is reported before invalid specifier in subsequent import + import "./valid" with { unknown: "foo" }; + import "INVALID"; +</script> |