summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/content-security-policy/generic/eval-typecheck-callout-order.tentative.html
blob: 0be7cf29a284d5f2471c7ada0b5cd643b6f0fb6a (plain)
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
26
27
28
<!DOCTYPE HTML>
<html>
<head>
    <script src='/resources/testharness.js' nonce='abc'></script>
    <script src='/resources/testharnessreport.js' nonce='abc'></script>
    <title>Test for order of Type(evalInput) and host callout</title>
</head>
<body>
    <div id='log'></div>

    <script nonce='abc'>
    test(function() {
      assert_throws_js(EvalError, function() {
        eval("0");
      }, "eval of a string should reach host callout");
    }, "eval of a string should be checked by CSP");

    test(function() {
      let array = ["0"];
      assert_equals(
        eval(array),
        array,
        "eval is identity when applied to non-strings");
    }, "eval of a non-string should not be checked by CSP");
    </script>

</body>
</html>