aboutsummaryrefslogtreecommitdiffstats
path: root/tests/wpt/web-platform-tests/kv-storage/non-secure-context-script-element.html
diff options
context:
space:
mode:
Diffstat (limited to 'tests/wpt/web-platform-tests/kv-storage/non-secure-context-script-element.html')
-rw-r--r--tests/wpt/web-platform-tests/kv-storage/non-secure-context-script-element.html25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/wpt/web-platform-tests/kv-storage/non-secure-context-script-element.html b/tests/wpt/web-platform-tests/kv-storage/non-secure-context-script-element.html
new file mode 100644
index 00000000000..66802b1254e
--- /dev/null
+++ b/tests/wpt/web-platform-tests/kv-storage/non-secure-context-script-element.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>KV Storage: should not work in non-secure contexts when included via a script element</title>
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script>
+"use strict";
+setup({ allow_uncaught_exception: true });
+
+test(() => {
+ assert_false(self.isSecureContext, "This test must run in a non-secure context");
+}, "Prerequisite check");
+
+async_test(t => {
+ self.addEventListener("error", t.step_func_done(errorEvent => {
+ assert_equals(errorEvent.error.constructor, DOMException, "Must trigger a DOMException");
+ assert_equals(errorEvent.error.name, "SecurityError",
+ "The DOMException must be a \"SecurityError\"");
+ }, { once: true }));
+});
+</script>
+
+<script type="module" src="std:kv-storage"></script>