Html程序  |  41行  |  900 B

<html>
<body>
<p>Test that the manifest is picked correctly when reloading.</p>
<p>Should say SUCCESS:</p>
<div id=result></div>

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

function log(message)
{
    document.getElementById("result").innerHTML += message + "<br>";
}

var state = 0;
function receivedMessage(message)
{
    log(message);

    if (state == 0) {
        state = 1;
        setTimeout("frames[0].location.reload()", 0);
    } else if (state == 1) {
        state = 2;
        setTimeout("frames[0].test()", 0);
    } else if (state == 2) {
        if (window.layoutTestController)
            layoutTestController.notifyDone();
    }
}

window.addEventListener("message", function(e) { receivedMessage(e.data) }, false);

</script>
<iframe src="resources/reload-iframe.html"></iframe>
</body>
</html>