Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / appcache / local-content.html
blob8829931b042af0b3630eb201536efe6a02561c7a
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.testRunner) {
8 testRunner.dumpAsText()
9 testRunner.waitUntilDone();
12 function log(message)
14 document.getElementById("result").innerHTML += message + "<br>";
17 function noupdate()
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.testRunner)
25 testRunner.notifyDone();
26 }, 300);
28 document.body.appendChild(ifr);
31 function frameCreated()
33 log("FAILURE: A local resource was opened in an iframe");
34 if (window.testRunner)
35 testRunner.notifyDone();
38 function reload()
40 // Reload to ensure that the main document was loaded from application cache.
41 window.location.reload();
44 applicationCache.addEventListener('noupdate', noupdate, false);
46 applicationCache.addEventListener('cached', reload, false);
47 applicationCache.addEventListener('error', function() { alert("Unexpected error event") }, false);
49 </script>
50 </body>
51 </html>