summaryrefslogtreecommitdiffstats
path: root/dom/security/test/csp/test_csp_style_src_empty_hash.html
blob: b500c196e691a6a40a33590ab08fe6bbc7ae785f (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
<!DOCTYPE HTML>
<html>
<head>
  <title>Bug 1609122 - Empty Style Element with valid style-src hash </title>
  <!-- Including SimpleTest.js so we can use waitForExplicitFinish !-->
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  
  <meta http-equiv="Content-Security-Policy" content="style-src 'sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=';">
</head>
<body>
<iframe style="width:100%;" id="testframe"></iframe>

<script class="testbody" type="text/javascript">

SimpleTest.waitForExplicitFinish();

/* Description of the test:
 * We try to load a stylesheet that is empty with a matching hash
 * sha256-47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=' should match ""
 * thus allow the style to be accessed
 */


var s = document.head.appendChild(document.createElement("style"));
s.disabled = true;

is(s.disabled, true, "Empty Stylesheet with matching Hash was not blocked");
SimpleTest.finish();

</script>
</body>
</html>