1 <html> 2 <head> 3 <script> 4 5 // Helpers. 6 7 function log(message) { 8 document.getElementById("console").innerHTML += message + "<br>"; 9 } 10 11 // Start and end. 12 13 function startTest() { 14 if (window.layoutTestController) { 15 layoutTestController.clearAllApplicationCaches(); 16 layoutTestController.dumpApplicationCacheDelegateCallbacks(); 17 layoutTestController.dumpAsText(); 18 layoutTestController.waitUntilDone(); 19 } 20 21 addIFrameWithAppCache(); 22 } 23 24 function finishTest() { 25 if (window.layoutTestController) 26 layoutTestController.notifyDone(); 27 } 28 29 function addIFrameWithAppCache() { 30 var iframe = document.createElement("iframe"); 31 iframe.src = "resources/origin-delete-iframe.html"; 32 iframe.id = "cachedFrame"; 33 document.body.appendChild(iframe); 34 35 window.onmessage = function(event) { 36 log(event.data); 37 if (event.data === "PASS - cached iframe-1") { 38 log("clearing cache for origin"); 39 layoutTestController.clearApplicationCacheForOrigin("http://127.0.0.1:8000"); 40 var frame = document.getElementById('cachedFrame'); 41 frame.contentWindow.postMessage("appcache_status", "*"); 42 } else if (event.data === "appcache_status=5"){ 43 log("SUCCESS - cache was made obsolete"); 44 finishTest(); 45 } else { 46 log("FAIL - received unexpected message " + event.data); 47 finishTest(); 48 } 49 }; 50 } 51 </script> 52 </head> 53 <body onload="startTest()"> 54 <p>This test checks that application cache groups correctly become obsolete after application cache is deletion for a specific origin. 55 </p> 56 <pre id="console"></pre> 57 </body> 58 </html> 59