OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../../resources/js-test.js"></script> |
| 5 </head> |
| 6 <body> |
| 7 <p id="description"></p> |
| 8 <pre id="console"></pre> |
| 9 |
| 10 <script> |
| 11 var jsTestIsAsync = true; |
| 12 |
| 13 description('Tests that appending iframe with with no URL and setting its UR
L later (including hash part) does not overwrite current history entry.'); |
| 14 |
| 15 if (window.testRunner) |
| 16 testRunner.clearBackForwardList(); |
| 17 |
| 18 onload = beginTest; |
| 19 |
| 20 function beginTest() { |
| 21 // The frame must be appened both on initial load and after navigating |
| 22 // back. On first load we must set the same SRC as after navigating away
. |
| 23 var iframe = document.createElement('iframe'); |
| 24 document.body.appendChild(iframe); |
| 25 |
| 26 if (location.hash.indexOf('wentBack') == -1) { |
| 27 // Run else code path after going back. |
| 28 location.hash = 'wentBack'; |
| 29 |
| 30 setFrameSrc(); |
| 31 |
| 32 // Navigate forward and back to create forward navigation entry. |
| 33 // Must be done outside the load handler to generate history entry. |
| 34 window.setTimeout(function() { |
| 35 location.href = 'data:text/html,<body onload="history.back()">Mu
st not see this text!!!</body>'; |
| 36 }, 0); |
| 37 } else { |
| 38 window.setTimeout(setFrameSrcAndfinishTest, 100); |
| 39 } |
| 40 } |
| 41 |
| 42 function setFrameSrc() { |
| 43 document.querySelector('iframe').src = 'about:blank/#identifier'; |
| 44 } |
| 45 |
| 46 function setFrameSrcAndfinishTest() { |
| 47 document.querySelector('iframe').src = 'about:blank/#identifier'; |
| 48 testRunner.dumpBackForwardList(); |
| 49 finishJSTest(); |
| 50 } |
| 51 </script> |
| 52 </body> |
| 53 </html> |
OLD | NEW |