OLD | NEW |
---|---|
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="/resources/testharness.js"></script> | |
4 <script src="/resources/testharnessreport.js"></script> | |
3 <script> | 5 <script> |
4 if (window.testRunner) { | 6 if (window.testRunner) { |
domenic
2017/02/21 18:37:43
Probably all this window.testRunner stuff should g
Bin Lu
2017/02/22 05:23:43
Done for the case of disallowing it given no gestu
| |
5 testRunner.dumpAsText(); | 7 testRunner.dumpAsText(); |
6 testRunner.dumpChildFramesAsText(); | 8 testRunner.dumpChildFramesAsText(); |
7 testRunner.setDumpConsoleMessages(false); | 9 testRunner.setDumpConsoleMessages(false); |
8 testRunner.waitUntilDone(); | 10 testRunner.waitUntilDone(); |
9 } | 11 } |
10 | 12 |
11 window.addEventListener("message", e => { | 13 test(function() { |
domenic
2017/02/21 18:37:43
I think this should be async_test. Then line 14 sh
Bin Lu
2017/02/22 05:23:44
Done. Thanks for the pointer!
| |
12 if (e.data == "PASS") | 14 window.addEventListener("message", e => { |
13 testRunner.notifyDone(); | 15 assert_equals(e.data, "PASS", "The message says 'PASS' instead of 'FAIL'"); |
14 else | 16 }); |
15 testRunner.testFailed("'top.location' didn't throw."); | 17 }, "The sandboxed iframe posted a message saying the test was in the state of 'P ASS'."); |
16 }); | |
17 </script> | 18 </script> |
18 </head> | 19 </head> |
19 <body> | 20 <body> |
20 <p>This tests that an iframe in sandbox with 'allow-top-navigation-with-user -activation' | 21 <p>This tests that an iframe in sandbox with 'allow-top-navigation-by-user-a ctivation' |
21 cannot navigate its top level page, if it is not trigged by a user gesture.< /p> | 22 cannot navigate its top level page, if it is not trigged by a user gesture.< /p> |
22 <iframe sandbox='allow-top-navigation-with-user-activation allow-scripts' sr c="http://localhost:8000/security/frameNavigation/resources/iframe-that-performs -top-navigation-without-user-gesture-failed.html"></iframe> | 23 <iframe sandbox='allow-top-navigation-by-user-activation allow-scripts' src= "resources/iframe-that-performs-top-navigation-without-user-gesture-failed.html" ></iframe> |
23 </body> | 24 </body> |
24 </html> | 25 </html> |
OLD | NEW |