<script src="/js-test-resources/js-test-pre.js"></script>
<script>
jsTestIsAsync = true;

description("Verify that document loaded with 304 response can be reloaded correctly.");

var iframe;

function loadFrame(onload)
{
    if (iframe)
        document.body.removeChild(iframe);
    iframe = document.createElement("iframe");
    iframe.src = "resources/iframe304body.py";
    iframe.onload = onload;
    document.body.appendChild(iframe);
}

function verify() {
    shouldBeEqualToString("iframe.contentDocument.body.textContent", "body text");
}

function test() {
    loadFrame(function () {
        verify();
        loadFrame(function () {
            verify();
            iframe.onload = function () {
                verify();
                finishJSTest();
            };
            debug("Reloading");
            iframe.contentWindow.internals.forceReload(false);
        });
    });
}
</script>
</head>
<body onload="test()">
<script src="/js-test-resources/js-test-post.js"></script>
