<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>
