test_bug1367586.html (1694B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=1367586 5 --> 6 <head> 7 <title>Test for Bug 1367586</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 10 </head> 11 <body> 12 <iframe id="load-frame"></iframe> 13 <pre id="test"> 14 <script class="testbody" type="text/javascript"> 15 16 SimpleTest.waitForExplicitFinish(); 17 18 var frm = document.getElementById("load-frame"); 19 var step = 0; 20 21 window.addEventListener("load", () => { 22 frm.contentWindow.location = "http://mochi.test:8888/tests/caps/tests/mochitest/file_bug1367586-redirect.sjs"; 23 frm.addEventListener("load", function() { 24 ++step; 25 SimpleTest.executeSoon((function(_step, _frm) { 26 switch (_step) { 27 case 1: 28 is(_frm.contentWindow.location.href, "http://mochi.test:8888/tests/caps/tests/mochitest/file_bug1367586-target.html", 29 "Redirected to the expected target in step 1"); 30 _frm.contentWindow.location = "http://mochi.test:8888/tests/caps/tests/mochitest/file_bug1367586-followon.html"; 31 break; 32 case 2: 33 is(_frm.contentWindow.location.href, "http://mochi.test:8888/tests/caps/tests/mochitest/file_bug1367586-followon.html", 34 "Navigated to the expected URL in step 2"); 35 _frm.contentWindow.history.back(); 36 break; 37 case 3: 38 is(_frm.contentWindow.location.href, "http://mochi.test:8888/tests/caps/tests/mochitest/file_bug1367586-target.html", 39 "Seeing the correct URL when navigating back in step 3"); 40 SimpleTest.finish(); 41 break; 42 } 43 }).bind(window, step, frm)); 44 }); 45 }); 46 47 </script> 48 </pre> 49 </body> 50 </html>