file_bug426646-1.html (1074B)
1 <html><head> 2 <title>Bug 426646, Using location.replace breaks iframe history</title> 3 <script type="text/javascript"> 4 var BASE_URI = "http://mochi.test:8888/tests/dom/base/test/"; 5 var url1 = BASE_URI + "iframe1_bug426646.html"; 6 7 function soon(f) { 8 return function() { setTimeout(f, 0); }; 9 } 10 11 function doe() { 12 document.body.innerHTML = "<iframe src='about:blank'></iframe>"; 13 document.body.innerHTML += "<iframe src='about:blank'></iframe>"; 14 window.frames[0].frameElement.onload = soon(doe2); 15 window.frames[0].location.replace(url1); 16 } 17 18 function doe2() { 19 window.frames[0].location = 'iframe2_bug426646.html'; 20 window.frames[0].frameElement.onload = soon(doe3); 21 } 22 23 function doe3() { 24 window.frames[0].frameElement.onload = soon(doe4); 25 history.go(-1); 26 } 27 28 function doe4() { 29 opener.is(String(window.frames[0].location), url1, "History.go(-1) didn't work?"); 30 opener.is(String(window.frames[1].location), "about:blank", 31 "History.go(-1) didn't work?"); 32 close(); 33 } 34 </script> 35 </head> 36 <body onload="doe();" onunload="opener.nextTest();"> 37 </body></html>