1 <html manifest="resources/subframes-2.manifest"> 2 <body> 3 <p>Test that a subframe without manifest gets picked by a relevant application cache that 4 contains its resource.</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 debug(message) 20 { 21 // If running manually in the browser, print the sequence of events. 22 if (!window.layoutTestController) 23 log(message); 24 } 25 26 var receivedExpectedMessage = false; 27 var receivedCheckingEvent = false; 28 var receivedNoupdateEvent = false; 29 30 function checkDone() 31 { 32 if (receivedExpectedMessage && receivedCheckingEvent && receivedNoupdateEvent) { 33 log("SUCCESS"); 34 if (window.layoutTestController) 35 layoutTestController.notifyDone(); 36 } 37 } 38 39 function test() 40 { 41 applicationCache.onnoupdate = null; 42 applicationCache.oncached = null; 43 44 // When a new main resource is associated with the cache, an update should be started. 45 applicationCache.onchecking = function() { debug("checking"); receivedCheckingEvent = true; checkDone(); } 46 applicationCache.onnoupdate = function() { debug("noupdate"); receivedNoupdateEvent = true; checkDone(); } 47 48 var ifr = document.createElement("iframe"); 49 ifr.setAttribute("src", "resources/subframe-2.html"); 50 document.body.appendChild(ifr); 51 } 52 53 applicationCache.onnoupdate = function() { test() } 54 applicationCache.oncached = function() { test() } 55 56 applicationCache.onupdateready = function() { log("FAIL: received unexpected updateready event") } 57 applicationCache.onerror = function() { log("FAIL: received unexpected error event") } 58 59 window.addEventListener("message", function() { debug("message"); receivedExpectedMessage = true; checkDone(); }, false); 60 61 </script> 62 </body> 63 </html> 64