aboutsummaryrefslogtreecommitdiffstats
path: root/tests/wpt/web-platform-tests/kv-storage/non-secure-context-script-element.html
blob: 66802b1254eda87e1a966d6f835676ecba942cbe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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>