• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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">
7if (window.layoutTestController) {
8    layoutTestController.dumpAsText()
9    layoutTestController.waitUntilDone();
10}
11
12function log(message)
13{
14    document.getElementById("result").innerHTML += message + "<br>";
15}
16
17function 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
31function frameCreated()
32{
33    log("FAILURE: A local resource was opened in an iframe");
34    if (window.layoutTestController)
35        layoutTestController.notifyDone();
36}
37
38function reload()
39{
40    // Reload to ensure that the main document was loaded from application cache.
41    window.location.reload();
42}
43
44applicationCache.addEventListener('noupdate', noupdate, false);
45
46applicationCache.addEventListener('cached', reload, false);
47applicationCache.addEventListener('error', function() { alert("Unexpected error event") }, false);
48
49</script>
50</body>
51</html>
52