OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script> | 3 <script> |
4 if (window.testRunner) { | 4 if (window.testRunner) { |
5 testRunner.dumpAsText(); | 5 testRunner.dumpAsText(); |
6 testRunner.waitUntilDone(); | 6 testRunner.waitUntilDone(); |
7 } | 7 } |
8 | 8 |
9 window.unload = function() { | 9 function loaded() { |
10 alert("FAIL"); | 10 if (window.testRunner) |
11 } | 11 testRunner.notifyDone(); |
12 | |
13 window.onload = function() { | |
14 // There's no way to write a test that determinstically fails because the | |
15 // history API is asynchronous. There's no way to know whether the | |
16 // asynchronous haven't yet happened or never will. Consequently, we just | |
17 // wait for a bit. | |
18 setTimeout(function() { | |
19 alert("PASS"); | |
20 if (window.testRunner) | |
21 testRunner.notifyDone(); | |
22 }, 20); | |
23 } | 12 } |
24 </script> | 13 </script> |
25 </head> | 14 </head> |
26 <body> | 15 <body> |
27 <p>This test verifies that a sandboxed IFrame cannot navigate the top-level fram
e using the history API.</p> | 16 <p>This test verifies that a sandboxed IFrame cannot access the history object
of the top-level frame. |
28 <iframe sandbox="allow-scripts" src="data:text/html,<script>top.history.back()</
script>"> | 17 It passes if a console error is present, noting that the inner frame cannot ac
cess the outer.</p> |
29 <iframe sandbox="allow-scripts" src="data:text/html,<script>top.history.forward(
)</script>"> | 18 <iframe sandbox="allow-scripts" src="data:text/html,<script>top.history</script>
" onload="loaded()"> |
30 <iframe sandbox="allow-scripts" src="data:text/html,<script>top.history.go(-1)</
script>"> | |
31 </body> | 19 </body> |
32 </html> | 20 </html> |
OLD | NEW |