<!DOCTYPE html>
<html>
<body>
<link rel="stylesheet" href="../../../resources/js-test-style.css" type="text/css">
<script src="../../../resources/js-test-pre.js"></script>
<div id="description"></div>
<pre id="console"></pre>
<script>
description('Tests that popstate events fire synchronously during fragment navigation.');

window.onload = function()
{
    debug('onload fired');
    history.pushState("test", "test");
    history.back();
}

var initialPopState = true;

window.onpopstate = function()
{
    debug('popstate fired');

    if (!initialPopState) {
        window.setTimeout(finishJSTest, 0);
        return;
    }

    initialPopState = false;

    debug('Setting hash to #foo');
    location.hash = '#foo';
    debug('Set hash to #foo');
}

var successfullyParsed = true;
var jsTestIsAsync = true;
</script>
<script src="../../../resources/js-test-post.js"></script>
</html>
