summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/loader/scroll-position-restored-on-back-non-cached.html
blob: a92d67ef073c851bb9d9bbedbd38f6eafc272ff6 (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
30
31
32
33
34
35
<html>
<head>
<script>

function navigate()
{
    if (location.hash == "") {
        if (window.testRunner) {
            testRunner.dumpAsText();
            testRunner.waitUntilDone();
        }

        scrollTo(0,100);
        history.pushState({ }, "", window.location + "#1");
        setTimeout("window.location.href = 'resources/empty-document-goes-back.html'", 0);
        return;
    }

    setTimeout(function () { 
        var scrollPosition = document.body.scrollTop;
        var result = document.getElementById("result");
        if (scrollPosition == 100)
            result.innerHTML = "Success! The scroll position was restored after navigation."
        if (window.testRunner)
            testRunner.notifyDone();
    }, 0);
}

</script>
</head>
<body style="width:800px" onpageshow="navigate();">
    <div id="result">Fail. The scroll position was not restored after navigation.</div><br/><br/>
    <div style="width:600; height:1000; background-color:purple;"></div>
</body>
</htmL>