| <!DOCTYPE html> |
| <html> |
| <body> |
| <script src="../../../resources/js-test-pre.js"></script> |
| <div id="description"></div> |
| <pre id="console"></pre> |
| <script> |
| description('No popstate event should be fired when WebKit navigates back to a stateless history entry.'); |
| |
| var testWindow; |
| |
| onload = function() |
| { |
| testWindow = window.open('resources/no-popstate-when-back-to-stateless-entry-1.html'); |
| if (!testWindow) |
| testFailed('Could not open test window'); |
| } |
| |
| var testWindowLoadFireCount = 0; |
| |
| function onTestWindowLoad(event) |
| { |
| debug('load fired'); |
| testWindowLoadFireCount++; |
| |
| switch (testWindowLoadFireCount) { |
| case 1: |
| debug('going to page 2'); |
| // Set the location in a timeout to generate a history entry |
| setTimeout(function() {testWindow.location.href = 'resources/no-popstate-when-back-to-stateless-entry-2.html';}, 0); |
| break; |
| case 2: |
| debug('going back to page 1'); |
| setTimeout(function() {testWindow.history.back();}, 0); |
| break; |
| default: |
| debug('back at page 1'); |
| // Close the window in a timeout to guarantee that the test will not finish before a potential popstate event. |
| setTimeout(function() { |
| testWindow.close(); |
| finishJSTest(); |
| }, 0); |
| break; |
| } |
| } |
| |
| function onTestWindowPopState(event) |
| { |
| testFailed('unexpected pop state event state'); |
| } |
| |
| var jsTestIsAsync = true; |
| </script> |
| <script src="../../../resources/js-test-post.js"></script> |
| </html> |