test_redirect.html (1231B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>Bug1402363: Test mixed content redirects</title> 5 <script src="/tests/SimpleTest/SimpleTest.js"></script> 6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 7 </head> 8 9 <body onload='startTest()'> 10 <iframe style="width:100%;height:300px;" id="testframe"></iframe> 11 12 <script class="testbody" type="text/javascript"> 13 14 SimpleTest.waitForExplicitFinish(); 15 16 const PATH = "https://example.com/tests/dom/security/test/mixedcontentblocker/"; 17 let testcounter = 0; 18 19 window.addEventListener("message", receiveMessage); 20 function receiveMessage(event) { 21 if (event.data === "https-to-https-loaded") { 22 ok(true, "https to https fetch redirect should be allowed"); 23 } 24 else if (event.data === "https-to-http-blocked") { 25 ok(true, "https to http fetch redirect should be blocked"); 26 } 27 else { 28 ok(false, "sanity: we should never enter that branch (" + event.data + ")"); 29 } 30 testcounter++; 31 if (testcounter < 2) { 32 return; 33 } 34 window.removeEventListener("message", receiveMessage); 35 SimpleTest.finish(); 36 } 37 38 function startTest() { 39 let testframe = document.getElementById("testframe"); 40 testframe.src = PATH + "file_redirect.html"; 41 } 42 43 </script> 44 </body> 45 </html>