| <!-- webkit-test-runner [ enableBackForwardCache=true ] --> |
| <p>This tests navigation while being restored from a page cache. WebKit should not hit any debug assertions.</p> |
| <button onclick="delete sessionStorage.testStage; runTest()">Start test</button> |
| testRunner.clearBackForwardList(); |
| testRunner.waitUntilDone(); |
| internals.clearBackForwardCache(); |
| sessionStorage.testStage = 'initial'; |
| window.addEventListener("pageshow", () => { |
| switch (sessionStorage.testStage) { |
| location.href = 'resources/navigate-back-with-finish-test-stage.html'; |
| document.getElementById('result').textContent = persisted ? 'PASS' : 'FAIL - Not put into the page cache'; |
| delete sessionStorage.testStage; |
| sessionStorage.testStage = 'navigate'; |
| input.setAttribute('autofocus', ''); |
| document.getElementById('input').addEventListener('focus', navigate); |
| location.href = 'resources/page-cache-helper.html'; |
| if (sessionStorage.testStage != 'navigate') |
| location.href = 'resources/navigate-back-with-finish-test-stage.html'; |
| document.getElementById('result').textContent = 'FAIL'; |
| document.getElementById('result').textContent = 'PASS'; |
| delete sessionStorage.testStage; |