<!-- webkit-test-runner [ UsesBackForwardCache=true ] -->
<!DOCTYPE html>
<html>
<head>
<style>
    a:focus {
        background: yellow;
    }
</style>
<script>
    function runTest() {
        if (window.testRunner)
            testRunner.waitUntilDone();

        window.onpageshow = function(e) {
            if (e.persisted) {
                document.getElementById("a3").focus();
                if (window.testRunner)
                    testRunner.notifyDone();
            } else {
                document.getElementById("a2").focus();
            }
        };

        setTimeout(function() {
            window.location.href = "data:text/html,<body onload='history.back()'></body>";
        }, 0);
    }
</script>
</head>
<body onload='runTest();'>
<a id="a1" href="#">1</a>
<a id="a2" href="#">2</a>
<a id="a3" href="#">3</a>
</body>
</html>
