diff options
Diffstat (limited to 'testing/web-platform/tests/trusted-types/tt-block-eval.html')
-rw-r--r-- | testing/web-platform/tests/trusted-types/tt-block-eval.html | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/testing/web-platform/tests/trusted-types/tt-block-eval.html b/testing/web-platform/tests/trusted-types/tt-block-eval.html new file mode 100644 index 0000000000..13178bd44b --- /dev/null +++ b/testing/web-platform/tests/trusted-types/tt-block-eval.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<html> +<head> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <meta http-equiv="Content-Security-Policy" content="require-trusted-types-for 'script'"> +</head> +<body> +<script> + trustedTypes.createPolicy("default", {createScript: _ => null}); + + test(t => { + let a = 0; + assert_throws_js(EvalError, _ => { + eval('a="hello there"'); + }); + assert_equals(a, 0); + }, "eval blocks if the default policy rejects a value."); +</script> |