summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module-assertions/invalid-content-type.any.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module-assertions/invalid-content-type.any.js')
-rw-r--r--testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module-assertions/invalid-content-type.any.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module-assertions/invalid-content-type.any.js b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module-assertions/invalid-content-type.any.js
new file mode 100644
index 0000000000..cbccbd4842
--- /dev/null
+++ b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module-assertions/invalid-content-type.any.js
@@ -0,0 +1,17 @@
+// META: global=window,dedicatedworker,sharedworker
+
+const content_types = [
+ "application/json+protobuf",
+ "application/json+blah",
+ "text/x-json",
+ "text/json+blah",
+ "application/blahjson",
+ "image/json",
+];
+for (const content_type of content_types) {
+ promise_test(async test => {
+ await promise_rejects_js(test, TypeError,
+ import(`./module.json?pipe=header(Content-Type,${content_type})`, { assert: { type: "json"} }),
+ `Import of a JSON module with MIME type ${content_type} should fail`);
+ }, `Try importing JSON module with MIME type ${content_type}`);
+}