| 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.waitUntilDone(); | 7 testRunner.waitUntilDone(); |
| 8 testRunner.setCanOpenWindows(); | 8 testRunner.setCanOpenWindows(); |
| 9 } | 9 } |
| 10 | 10 |
| 11 var openedWindow; | 11 var openedWindow; |
| 12 | 12 |
| 13 function loaded() { | 13 function loaded() { |
| 14 var url = "data:text/html,<html>" | 14 var url = "data:text/html,<html>" |
| 15 + "<head>" | 15 + "<head>" |
| 16 + "<scr" + "ipt>" | 16 + "<scr" + "ipt>" |
| 17 + "function fireSentinel() {" | 17 + "function fireSentinel() {" |
| 18 + "if (window.testRunner)" | 18 + "window.opener.postMessage('done', '*');" |
| 19 + "testRunner.globalFlag = true;" | |
| 20 + "}" | 19 + "}" |
| 21 + "</scr" + "ipt>" | 20 + "</scr" + "ipt>" |
| 22 + "</head>" | 21 + "</head>" |
| 23 + "<body onload=\"fireSentinel();\">" | 22 + "<body onload=\"fireSentinel();\">" |
| 24 + "<p>Opened Frame</p>" | 23 + "<p>Opened Frame</p>" |
| 25 + "<p id='accessMe'>PASS: Cross frame access from an opener
frame was denied</p>" | 24 + "<p id='accessMe'>PASS: Cross frame access from an opener
frame was denied</p>" |
| 26 + "</body>" | 25 + "</body>" |
| 27 + "</html>"; | 26 + "</html>"; |
| 28 | 27 |
| 28 window.addEventListener('message', performTest); |
| 29 openedWindow = window.open(url); | 29 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 performTest(); | |
| 39 } | |
| 40 } else { | |
| 41 log("Click the button when all the subframes have finished loadi
ng."); | |
| 42 } | |
| 43 } | 30 } |
| 44 | 31 |
| 45 function performTest() { | 32 function performTest() { |
| 46 try { | 33 try { |
| 47 openedWindow.document.getElementById('accessMe').innerHTML = 'FA
IL: Access to a window opened with a data: URL was allowed.'; | 34 openedWindow.document.getElementById('accessMe').innerHTML = 'FA
IL: Access to a window opened with a data: URL was allowed.'; |
| 48 } catch (e) { | 35 } catch (e) { |
| 49 } | 36 } |
| 50 | 37 |
| 51 if (window.testRunner) | 38 if (window.testRunner) |
| 52 closeWindowAndNotifyDone(openedWindow); | 39 closeWindowAndNotifyDone(openedWindow); |
| 53 } | 40 } |
| 54 </script> | 41 </script> |
| 55 </head> | 42 </head> |
| 56 <body onload="loaded();"> | 43 <body onload="loaded();"> |
| 57 <p>Opener Frame</p> | 44 <p>Opener Frame</p> |
| 58 <button onclick="performTest()">Test</button> | |
| 59 <pre id="console"></pre> | 45 <pre id="console"></pre> |
| 60 </body> | 46 </body> |
| 61 </html> | 47 </html> |
| OLD | NEW |