summaryrefslogtreecommitdiffstats
path: root/dom/security/test/mixedcontentblocker/file_redirect.html
blob: 99e187379139b34e1a868f1ec30f09a3605f16fe (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
<!DOCTYPE HTML>
<html>
<head>
  <title>Bug1402363: Test mixed content redirects</title>
</head>
<body>

<script type="text/javascript">
  const PATH = "https://example.com/tests/dom/security/test/mixedcontentblocker/";

  // check a fetch redirect from https to https (should be allowed)
  fetch(PATH + "file_redirect_handler.sjs?https-to-https-redirect", {
    method: 'get'
  }).then(function(response) {
    window.parent.postMessage("https-to-https-loaded", "*");
  }).catch(function(err) {
    window.parent.postMessage("https-to-https-blocked", "*");
  });

  // check a fetch redirect from https to http (should be blocked)
  fetch(PATH + "file_redirect_handler.sjs?https-to-http-redirect", {
    method: 'get'
  }).then(function(response) {
    window.parent.postMessage("https-to-http-loaded", "*");
  }).catch(function(err) {
    window.parent.postMessage("https-to-http-blocked", "*");
  });

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