1 <html manifest="resources/local-content.manifest"> 2 <body> 3 <p>Test that documents loaded from application cache don't get access to local resources accidentally.</p> 4 <p>Should say SUCCESS:</p> 5 <div id="result"></div> 6 <script type="text/javascript"> 7 if (window.layoutTestController) { 8 layoutTestController.dumpAsText() 9 layoutTestController.waitUntilDone(); 10 } 11 12 function log(message) 13 { 14 document.getElementById("result").innerHTML += message + "<br>"; 15 } 16 17 function noupdate() 18 { 19 var ifr = document.createElement("iframe"); 20 ifr.setAttribute("src", "file:///usr/include/stdio.h"); 21 ifr.onload = frameCreated; 22 setTimeout(function() { 23 log("SUCCESS"); 24 if (window.layoutTestController) 25 layoutTestController.notifyDone(); 26 }, 300); 27 28 document.body.appendChild(ifr); 29 } 30 31 function frameCreated() 32 { 33 log("FAILURE: A local resource was opened in an iframe"); 34 if (window.layoutTestController) 35 layoutTestController.notifyDone(); 36 } 37 38 function reload() 39 { 40 // Reload to ensure that the main document was loaded from application cache. 41 window.location.reload(); 42 } 43 44 applicationCache.addEventListener('noupdate', noupdate, false); 45 46 applicationCache.addEventListener('cached', reload, false); 47 applicationCache.addEventListener('error', function() { alert("Unexpected error event") }, false); 48 49 </script> 50 </body> 51 </html> 52