<!-- webkit-test-runner [ UsesBackForwardCache=true ] -->
<style>
#puffin {
    font: Ahem 10px;
    position: absolute;
    top: 0;
    left: 0;
    overflow: scroll;
    width: 100px;
    height: 100px;
    background-color: #ccc;
}
</style>
<div id="puffin">
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</div>
<pre id="tree"></pre>
<script>
testRunner.dumpAsText();
testRunner.waitUntilDone();

var testDiv = document.getElementById("puffin");

testDiv.addEventListener("scroll", function(event) {
    location.href = 'data:text/html,<script>alert("Going back.");history.back();</' + 'script>';
});

window.addEventListener("pageshow", function(event) {
    if (event.persisted) {
        document.getElementById("tree").innerText = window.internals.elementRenderTreeAsText(document.getElementById("puffin"));
        testRunner.notifyDone();
    }
}, false);

window.addEventListener("load", function() {
    testDiv.scrollTop = 100;
});
</script>
