• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html manifest="does-not-exist.manifest">
2<script>
3if (window.layoutTestController) {
4    layoutTestController.dumpAsText()
5    layoutTestController.waitUntilDone();
6}
7
8function log(message)
9{
10    document.getElementById("result").innerHTML += message + "<br>";
11}
12
13function unexpectedEvent(name)
14{
15    log("FAILURE: Unexpected " + name + " event.");
16}
17
18applicationCache.addEventListener('noupdate', function() { unexpectedEvent("noupdate") }, false);
19applicationCache.addEventListener('downloading', function() { unexpectedEvent("downloading") }, false);
20applicationCache.addEventListener('progress', function() { unexpectedEvent("progress") }, false);
21applicationCache.addEventListener('updateready', function() { unexpectedEvent("updateready") }, false);
22applicationCache.addEventListener('cached', function() { unexpectedEvent("cached") }, false);
23applicationCache.addEventListener('obsolete', function() { unexpectedEvent("obsolete") }, false);
24
25function test()
26{
27    if (!gotCheckingEvent)
28        log("FAILURE: Did not get a checking event");
29    if (window.applicationCache.status)
30        log("FAILURE: Cache status is not UNCACHED, " + window.applicationCache.status);
31
32    // The manifest failed to load, so there should be no cache, and subresources should be loaded normally.
33    try {
34        var req = new XMLHttpRequest();
35        req.open("GET", "resources/simple.txt", false);
36        req.send();
37
38        if (req.responseText == 'Hello, World!')
39            log("SUCCESS");
40        else
41            log("FAILURE: Did not get expected response data.");
42    } catch (e) {
43        log("FAILURE: Could not load data.");
44    }
45
46    if (window.layoutTestController)
47        layoutTestController.notifyDone();
48}
49
50var gotCheckingEvent = false;
51applicationCache.addEventListener('checking', function() { gotCheckingEvent = true; }, false);
52
53applicationCache.addEventListener('error', function() { test() }, false);
54
55</script>
56<p>Test that subresources can be loaded if manifest is not available. Should say SUCCESS.</p>
57
58<div id=result></div>
59</html>
60