| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../resources/js-test-pre.js"></script> |
| </head> |
| <body> |
| <p id="description"></p> |
| <pre id="console"></pre> |
| |
| <iframe src="data:text/plain,iframe1" id="iframe1" name="iframe1"></iframe> |
| <iframe src="data:text/plain,iframe2" id="iframe2" name="iframe2"></iframe> |
| |
| <script> |
| var wentBack = false; |
| |
| description('Tests that we trigger same-document navigation when history entries are generated via fragment changes, even if the frames present in the document change between history entries.'); |
| |
| if (window.testRunner) { |
| testRunner.dumpChildFramesAsText(); |
| testRunner.clearBackForwardList(); |
| testRunner.dumpBackForwardList(); |
| } |
| |
| onload = function() |
| { |
| // Run afer onload, to make sure that we can generate history entries. |
| setTimeout(beginTest, 0); |
| } |
| |
| onpopstate = function(event) { |
| var loc = location.href; |
| var filenameAndQuery = loc.substring(loc.lastIndexOf('/') + 1); |
| debug('popstate to state: ' + event.state + ' filename: ' + filenameAndQuery); |
| |
| if (!location.hash) { |
| if (wentBack) { |
| debug('going forward'); |
| history.forward(); |
| } |
| } else if (location.hash == '#newState') { |
| if (!wentBack) { |
| wentBack = true; |
| debug('going back'); |
| history.back(); |
| } else { |
| finishJSTest(); |
| } |
| } else { |
| testFailed('Unexpected state'); |
| } |
| }; |
| |
| |
| function beginTest() |
| { |
| debug('removing iframe2'); |
| document.body.removeChild(document.getElementById('iframe2')); |
| |
| debug('navigating to #newState'); |
| window.location.href = '#newState'; |
| } |
| var jsTestIsAsync = true; |
| </script> |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |