| <html manifest="resources/local-content.manifest"> |
| <body> |
| <p>Test that documents loaded from application cache don't get access to local resources accidentally.</p> |
| <p>Should say SUCCESS:</p> |
| <div id="result"></div> |
| <script type="text/javascript"> |
| if (window.testRunner) { |
| testRunner.dumpAsText() |
| testRunner.waitUntilDone(); |
| } |
| |
| function log(message) |
| { |
| document.getElementById("result").innerHTML += message + "<br>"; |
| } |
| |
| function noupdate() |
| { |
| var ifr = document.createElement("iframe"); |
| ifr.setAttribute("src", "file:///usr/include/stdio.h"); |
| ifr.onload = frameCreated; |
| setTimeout(function() { |
| log("SUCCESS"); |
| if (window.testRunner) |
| testRunner.notifyDone(); |
| }, 300); |
| |
| document.body.appendChild(ifr); |
| } |
| |
| function frameCreated() |
| { |
| log("FAILURE: A local resource was opened in an iframe"); |
| if (window.testRunner) |
| testRunner.notifyDone(); |
| } |
| |
| function reload() |
| { |
| // Reload to ensure that the main document was loaded from application cache. |
| window.location.reload(); |
| } |
| |
| applicationCache.addEventListener('noupdate', noupdate, false); |
| |
| applicationCache.addEventListener('cached', reload, false); |
| applicationCache.addEventListener('error', function() { alert("Unexpected error event") }, false); |
| |
| </script> |
| </body> |
| </html> |