summaryrefslogtreecommitdiffstats
path: root/parser/htmlparser/tests/mochitest/test_base_csp_img.html
blob: d17a99c657e6beebed6284688d7068fac294a5f4 (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
29
30
31
32
33
34
35
<!DOCTYPE HTML>
<html>
<head>
  <title>Base with base-uri CSP</title>
  <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />

  <!-- Set CSP -->
  <meta http-equiv="Content-Security-Policy" content="base-uri 'self';">

  <!-- Base should be ignored -->
  <base href="http://example.org/">
</head>
<body>

<img src="/tests/parser/htmlparser/tests/mochitest/file_base_csp_img.sjs?image" width=10 height=10>

<script>
add_task(async function() {
  let response = await fetch(
    "http://mochi.test:8888/tests/parser/htmlparser/tests/mochitest/file_base_csp_img.sjs?result"
  );
  let hosts = await response.json();

  is(hosts.length, 1, "One host");
  is(hosts[0], "mochi.test", "Host was not influenced by base");

  info("finished");
});
</script>

</body>
</html>