Home | History | Annotate | Download | only in appcache
      1 <html manifest="does-not-exist.manifest">
      2 <script>
      3 if (window.layoutTestController) {
      4     layoutTestController.dumpAsText()
      5     layoutTestController.waitUntilDone();
      6 }
      7 
      8 function log(message)
      9 {
     10     document.getElementById("result").innerHTML += message + "<br>";
     11 }
     12 
     13 function unexpectedEvent(name)
     14 {
     15     log("FAILURE: Unexpected " + name + " event.");
     16 }
     17 
     18 applicationCache.addEventListener('noupdate', function() { unexpectedEvent("noupdate") }, false);
     19 applicationCache.addEventListener('downloading', function() { unexpectedEvent("downloading") }, false);
     20 applicationCache.addEventListener('progress', function() { unexpectedEvent("progress") }, false);
     21 applicationCache.addEventListener('updateready', function() { unexpectedEvent("updateready") }, false);
     22 applicationCache.addEventListener('cached', function() { unexpectedEvent("cached") }, false);
     23 applicationCache.addEventListener('obsolete', function() { unexpectedEvent("obsolete") }, false);
     24 
     25 function 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 
     50 var gotCheckingEvent = false;
     51 applicationCache.addEventListener('checking', function() { gotCheckingEvent = true; }, false);
     52 
     53 applicationCache.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