<html manifest="resources/foreign-iframe.manifest"> <!-- Any manifest would do the trick. -->
<body>
<p>Test for <a href="rdar://problem/6284708">&lt;rdar://problem/6284708></a> AppCache crashes in ApplicationCacheResource::addType().</p>

<div id=result></div>

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

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

function test()
{
    var ifr = document.createElement("iframe");
    ifr.setAttribute("src", "http://localhost:8000/appcache/resources/foreign-iframe.html");
    document.body.appendChild(ifr);
}

applicationCache.addEventListener('checking', function() { log("checking") }, false);
applicationCache.addEventListener('error', function() { log("error") }, false);
applicationCache.addEventListener('downloading', function() { log("downloading") }, false);
applicationCache.addEventListener('progress', function() { log("progress") }, false);
applicationCache.addEventListener('updateready', function() { log("updateready") }, false);
applicationCache.addEventListener('obsolete', function() { log("obsolete") }, false);

applicationCache.addEventListener('noupdate', function() { log("noupdate"); test() }, false);
applicationCache.addEventListener('cached', function() { log("cached"); test() }, false);

window.addEventListener("message", function() { log("SUCCESS"); if (window.testRunner) testRunner.notifyDone() }, false);

</script>
</body>
</html>
