summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/harness/resources/cached-page-1.html
blob: 0dbfd4d98e982b32b4b65c99c409a883239394b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<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>