| <script> |
| |
| var intervalId; |
| function check() { |
| // This flag is set by cached-page-2 when it loads. |
| // If the timer is fired before cached-page-2 loads, just bail and wait. |
| if (!window.opener.canExit) |
| return; |
| |
| clearInterval(intervalId); |
| window.opener.log("Back on page-1, timer is still firing."); |
| window.opener.log("PASS."); |
| window.opener.finish(); |
| } |
| |
| function loadNext() |
| { |
| // Verify that this onload handler is called only once. On navigation back |
| // this page will be served from the cache, w/o firing onload. |
| window.opener.reportOnload(); |
| |
| intervalId = setInterval(check, 10); |
| |
| window.opener.log("page-1, about to navigate to page-2.") |
| // Location changes need to happen outside the onload handler to generate history entries. |
| setTimeout(function() {location.href = "cached-page-2.html";}, 0); |
| } |
| </script> |
| <body onload="loadNext()"></body> |