summaryrefslogtreecommitdiffstats
path: root/dom/security/test/csp/file_upgrade_insecure_cors.html
blob: e675c62e9f35f076226a15a4c2200133c95ae539 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  <title>Bug 1139297 - Implement CSP upgrade-insecure-requests directive</title>
</head>
<body>

<script type="text/javascript">
  // === TEST 1
  var url1 = "http://test1.example.com/tests/dom/security/test/csp/file_upgrade_insecure_cors_server.sjs?test1";
  var xhr1 = new XMLHttpRequest();
  xhr1.open("GET", url1, true);
  xhr1.onload = function() {
  	window.parent.postMessage(xhr1.response, "*");
  };
  xhr1.onerror = function() {
  	window.parent.postMessage("test1-failed", "*");
  };
  xhr1.send();

  // === TEST 2
  var url2 = "http://test1.example.com/tests/dom/security/test/csp/file_upgrade_insecure_cors_server.sjs?test2";
  var xhr2 = new XMLHttpRequest();
  xhr2.open("GET", url2, true);
  xhr2.onload = function() {
    window.parent.postMessage(xhr2.response, "*");
  };
  xhr2.onerror = function() {
    window.parent.postMessage("test2-failed", "*");
  };
  xhr2.send();

  // === TEST 3
  var url3 = "http://test2.example.com/tests/dom/security/test/csp/file_upgrade_insecure_cors_server.sjs?test3";
  var xhr3 = new XMLHttpRequest();
  xhr3.open("GET", url3, true);
  xhr3.onload = function() {
  	window.parent.postMessage(xhr3.response, "*");
  };
  xhr3.onerror = function() {
  	window.parent.postMessage("test3-failed", "*");
  };
  xhr3.send();

</script>

</body>
</html>