summaryrefslogtreecommitdiffstats
path: root/dom/security/test/csp/file_nonce_redirects.html
blob: e29116490079d1ea65ba1c8e9d675083f37e1ca2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<!DOCTYPE HTML>
<html>
  <head>
  <meta charset='utf-8'>
  <meta http-equiv="Content-Security-Policy" content="script-src 'nonce-abcd1234'">
  <title>Bug 1469150:Scripts with valid nonce get blocked if URL redirects</title>
  </head>
<body>

<script nonce='abcd1234' id='redirectScript'></script>

<script nonce='abcd1234' type='application/javascript'>
  var redirectScript = document.getElementById('redirectScript');
  redirectScript.onload = function(e) {
    window.parent.postMessage({result: 'script-loaded'}, '*');
  };
  redirectScript.onerror = function(e) {
    window.parent.postMessage({result: 'script-blocked'}, '*');
  }
  redirectScript.src = 'file_nonce_redirector.sjs?redirect';
</script>
</body>
</html>