summaryrefslogtreecommitdiffstats
path: root/LayoutTests/http/tests/appcache/foreign-iframe-main.html
blob: a543eef5f4ec779f2012f280bfdbb11495562074 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<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.layoutTestController) {
    layoutTestController.dumpAsText();
    layoutTestController.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.layoutTestController) layoutTestController.notifyDone() }, false);

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