summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/content-security-policy/securitypolicyviolation/blockeduri-eval.html
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--testing/web-platform/tests/content-security-policy/securitypolicyviolation/blockeduri-eval.html20
1 files changed, 20 insertions, 0 deletions
diff --git a/testing/web-platform/tests/content-security-policy/securitypolicyviolation/blockeduri-eval.html b/testing/web-platform/tests/content-security-policy/securitypolicyviolation/blockeduri-eval.html
new file mode 100644
index 0000000000..ddd5068df1
--- /dev/null
+++ b/testing/web-platform/tests/content-security-policy/securitypolicyviolation/blockeduri-eval.html
@@ -0,0 +1,20 @@
+<!doctype html>
+<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline'">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+ async_test(t => {
+ var watcher = new EventWatcher(t, document, 'securitypolicyviolation');
+ watcher.wait_for('securitypolicyviolation').then(t.step_func_done(e => {
+ assert_equals(e.blockedURI, "eval");
+ assert_equals(e.lineNumber, 15);
+ assert_equals(e.columnNumber, 12);
+ }));
+
+ try {
+ eval("assert_unreached('eval() should be blocked.");
+ } catch (e) {
+ assert_equals(e.name, 'EvalError');
+ }
+ }, "Eval violations have a blockedURI of 'eval'");
+</script>