summaryrefslogtreecommitdiffstats
path: root/LayoutTests/http/tests/appcache/404-resource.html
blob: 5439b8f1f88eea7a3d3db8eb584b21094e6c837e (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/404-resource.manifest">
<body>
<p>Test that a missing explicit resource makes caching fail.</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>";
}

function unexpectedCallback(eventName)
{
    log("FAIL: An unexpected " + eventName + " event was dispatched on window.applicationCache.");
}

function test()
{
    if (applicationCache.status == applicationCache.UNCACHED)
        log("SUCCESS");
    else
        log("FAILURE: cache status is not uncached: " + applicationCache.status);

    if (window.layoutTestController)
        layoutTestController.notifyDone();
}

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

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