summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/history/replaceState-onbeforeunload-scroll-state.html
blob: f77eaf6cf2fdbfafd981a9432a0885e72f615727 (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
<body>
<div style="height: 2000px;"></div>
<script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

function test() {
    if (sessionStorage.getItem('replaceState-beforeunload') == 'true') {
        sessionStorage.removeItem("replaceState-beforeunload");
        document.body.appendChild(document.createTextNode(
            "Scroll state should not be propagated between unrelated documents: " +
            (window.scrollY == 0 ? "PASS" : "FAIL")));
        if (window.testRunner)
            testRunner.notifyDone();
    } else {
        sessionStorage.setItem('replaceState-beforeunload', 'true');
        location = "resources/replaceState-during-beforeunload.html";
    }
}

window.onload = function() {
    setTimeout(test, 0);
};
</script>
</body>