<html>
<script>
if (window.layoutTestController) {
    layoutTestController.waitUntilDone();
    layoutTestController.dumpAsText();
}

state = "initial";

function next() {
    switch (state) {
    case "initial":
        state = "loading-plugin";
        var frame = document.getElementsByTagName("iframe")[0]
        frame.addEventListener("load", next, false);
        frame.src = "data:application/x-webkit-test-netscape,alertwhenloaded";
        break;
    case "loading-plugin":
        state = "moving-backward";
        history.back();
        break;
    case "moving-backward":
        state = "moving-forward";
        history.forward();
        break;
    case "moving-forward":
        state = "done";
        layoutTestController.notifyDone();
        break;
    default:
        alert('FAIL');
        break;
    }
}

window.onload = function() {
    // We need to wait for after the load event so that we get a new history
    // entry when navigating the frame.
    setTimeout(next, 0);
}
</script>
<iframe src="data:text/html,Waiting..."></iframe>
</html>
