Home | History | Annotate | Download | only in appcache
      1 <html manifest="resources/subframes-4.manifest">
      2 <body>
      3 <p>Test that a subframe with manifest that matches top frame manifest works correctly.</p>
      4 <p>In this case, the subframe resource is listed in manifest explicitly.</p>
      5 <p>Should say SUCCESS:</p>
      6 <div id=result></div>
      7 
      8 <script>
      9 if (window.layoutTestController) {
     10     layoutTestController.dumpAsText();
     11     layoutTestController.waitUntilDone();
     12 }
     13 
     14 function log(message)
     15 {
     16     document.getElementById("result").innerHTML += message + "<br>";
     17 }
     18 
     19 function test()
     20 {
     21     applicationCache.onnoupdate = null;
     22     applicationCache.oncached = null;
     23 
     24     // When a new main resource is associated with the cache, an update should be started.
     25     applicationCache.onchecking = function() { log("checking") }
     26 
     27     var ifr = document.createElement("iframe");
     28     ifr.setAttribute("src", "resources/subframe-4.html");
     29     document.body.appendChild(ifr);
     30 }
     31 
     32 function test2()
     33 {
     34     window.removeEventListener("message", test2, false);
     35     window.addEventListener("message", test3, false);
     36 
     37     // Add an identical frame, to test that loading its resources from appcache works.
     38     var ifr = document.createElement("iframe");
     39     ifr.setAttribute("src", "resources/subframe-4.html");
     40     document.body.appendChild(ifr);
     41 }
     42 
     43 function test3()
     44 {
     45     log("SUCCESS");
     46     if (window.layoutTestController)
     47         layoutTestController.notifyDone();
     48 }
     49 
     50 applicationCache.onnoupdate = function() { test() }
     51 applicationCache.oncached = function() { test() }
     52 
     53 applicationCache.onupdateready = function() { log("FAIL: received unexpected updateready event") }
     54 applicationCache.onerror = function() { log("FAIL: received unexpected error event") }
     55 
     56 window.addEventListener("message", test2, false);
     57 
     58 </script>
     59 </body>
     60 </html>
     61