| <script> |
| onload = function() { |
| if (location.search.substring(1).length == 0) { |
| sessionStorage.testStage = 0; |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| testRunner.clearBackForwardList(); |
| testRunner.waitUntilDone(); |
| } |
| } |
| |
| // Location changes need to happen outside the onload handler to generate history entries. |
| setTimeout(function() { |
| // This test advances history by 2 pages, then navigates back one, and |
| // records history.length. We expect history.length to indicate the total |
| // length of session history. At the end of the test, it should be 2 greater |
| // than it was at the start of the test. |
| switch (sessionStorage.testStage++) { |
| case 0: |
| sessionStorage.initialLength = history.length; |
| location = "?a"; |
| break; |
| case 1: |
| location = "?b"; |
| break; |
| case 2: |
| history.back(); |
| break; |
| case 3: |
| if (history.length == (sessionStorage.initialLength - 0) + 2) |
| document.body.innerHTML = "PASS"; |
| else |
| document.body.innerHTML = "FAIL: initialLength=" + sessionStorage.initialLength + ", history.length=" + history.length; |
| if (window.testRunner) |
| testRunner.notifyDone(); |
| break; |
| } |
| }, 0); |
| } |
| onunload = function() { |
| // disable page cache |
| } |
| </script> |
| <body></body> |