diff options
Diffstat (limited to 'LayoutTests/http/tests/appcache/local-content.html')
-rw-r--r-- | LayoutTests/http/tests/appcache/local-content.html | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/LayoutTests/http/tests/appcache/local-content.html b/LayoutTests/http/tests/appcache/local-content.html new file mode 100644 index 0000000..0787567 --- /dev/null +++ b/LayoutTests/http/tests/appcache/local-content.html @@ -0,0 +1,51 @@ +<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.layoutTestController) { + layoutTestController.dumpAsText() + layoutTestController.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.layoutTestController) + layoutTestController.notifyDone(); + }, 300); + + document.body.appendChild(ifr); +} + +function frameCreated() +{ + log("FAILURE: A local resource was opened in an iframe"); + if (window.layoutTestController) + layoutTestController.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> |