OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../resources/cross-frame-access.js"></script> | 3 <script src="../resources/cross-frame-access.js"></script> |
4 <script> | 4 <script> |
5 if (window.testRunner) { | 5 if (window.testRunner) { |
6 testRunner.dumpAsText(); | 6 testRunner.dumpAsText(); |
7 testRunner.setCanOpenWindows(); | 7 testRunner.setCanOpenWindows(); |
8 testRunner.waitUntilDone(); | 8 testRunner.waitUntilDone(); |
9 } | 9 } |
10 function loaded() { | 10 function loaded() { |
11 var url = "data:text/html,<html>" | 11 var url = "data:text/html,<html>" |
12 + "<head>" | 12 + "<head>" |
13 + "<scr" + "ipt>" | 13 + "<scr" + "ipt>" |
14 + "function test() {" | 14 + "function test() {" |
15 + "try {" | 15 + "try {" |
16 + "opener.document.getElementById(\"accessMe\").
innerHTML = \"FAIL: Access from a window opened with a data: URL was allowed!\";
" | 16 + "opener.document.getElementById(\"accessMe\").
innerHTML = \"FAIL: Access from a window opened with a data: URL was allowed!\";
" |
17 + "} catch (e) {" | 17 + "} catch (e) {" |
18 + "}" | 18 + "}" |
19 + "if (window.testRunner)" | 19 + "window.opener.postMessage('done', '*');" |
20 + "testRunner.globalFlag = true;" // Flag that t
he test has completed and we can close the window now | |
21 + "}" | 20 + "}" |
22 + "</scri" + "pt>" | 21 + "</scri" + "pt>" |
23 + "</head>" | 22 + "</head>" |
24 + "<body onload=\"test();\">" | 23 + "<body onload=\"test();\">" |
25 + "<p>Opened Frame.</p>" | 24 + "<p>Opened Frame.</p>" |
26 + "</body>" | 25 + "</body>" |
27 + "</html>"; | 26 + "</html>"; |
28 | 27 |
| 28 window.addEventListener('message', function () { |
| 29 closeWindowAndNotifyDone(openedWindow); |
| 30 }); |
29 var openedWindow = window.open(url); | 31 var openedWindow = window.open(url); |
30 | |
31 if (window.testRunner) { | |
32 setTimeout(waitForFlag, 1); | |
33 function waitForFlag() { | |
34 if (!testRunner.globalFlag) { | |
35 setTimeout(waitForFlag, 1); | |
36 return; | |
37 } | |
38 closeWindowAndNotifyDone(openedWindow); | |
39 } | |
40 } | |
41 } | 32 } |
42 </script> | 33 </script> |
43 </head> | 34 </head> |
44 <body onload="loaded();"> | 35 <body onload="loaded();"> |
45 <p>Opener Frame</p> | 36 <p>Opener Frame</p> |
46 <p id='accessMe'>PASS: Access from a window opened with a data: URL was deni
ed.</p> | 37 <p id='accessMe'>PASS: Access from a window opened with a data: URL was deni
ed.</p> |
47 </body> | 38 </body> |
48 </html> | 39 </html> |
OLD | NEW |