| 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 var openedWindow; | 5 var openedWindow; |
| 6 | 6 |
| 7 window.onload = function() | 7 window.onload = function() |
| 8 { | 8 { |
| 9 if (window.testRunner) { | 9 if (window.testRunner) { |
| 10 testRunner.dumpAsText(); | 10 testRunner.dumpAsText(); |
| 11 testRunner.setCanOpenWindows(); | 11 testRunner.setCanOpenWindows(); |
| 12 testRunner.waitUntilDone(); | 12 testRunner.waitUntilDone(); |
| 13 } | 13 } |
| 14 | 14 |
| 15 openedWindow = window.open("http://localhost:8000/security/javascrip
tURL/resources/foreign-domain-javascript-url-accessee-opened-frame.html"); | 15 openedWindow = window.open("http://localhost:8000/security/javascrip
tURL/resources/foreign-domain-javascript-url-accessee-opened-frame.html"); |
| 16 | 16 |
| 17 if (window.testRunner) { | 17 window.addEventListener('message', function () |
| 18 setTimeout(pollForTest, 1); | 18 { |
| 19 } else { | 19 runTest(); |
| 20 log("To run the test, click the button below when the opened win
dow finishes loading."); | 20 closeWindowAndNotifyDone(openedWindow); |
| 21 var button = document.createElement("button"); | 21 }); |
| 22 button.appendChild(document.createTextNode("Run Test")); | |
| 23 button.onclick = runTest; | |
| 24 document.body.appendChild(button); | |
| 25 } | |
| 26 } | |
| 27 | |
| 28 pollForTest = function() | |
| 29 { | |
| 30 if (!testRunner.globalFlag) { | |
| 31 setTimeout(pollForTest, 1); | |
| 32 return; | |
| 33 } | |
| 34 runTest(); | |
| 35 closeWindowAndNotifyDone(openedWindow); | |
| 36 } | 22 } |
| 37 | 23 |
| 38 runTest = function() | 24 runTest = function() |
| 39 { | 25 { |
| 40 try { | 26 try { |
| 41 openedWindow[0].document.getElementById('accessMe').innerHTML =
"FAIL: Cross frame access to a javascript: URL embed in a frame window.open'ed o
n foreign domain allowed."; | 27 openedWindow[0].document.getElementById('accessMe').innerHTML =
"FAIL: Cross frame access to a javascript: URL embed in a frame window.open'ed o
n foreign domain allowed."; |
| 42 log("FAIL: Cross frame access to a javascript: URL embed in a fr
ame window.open'ed on foreign domain allowed."); | 28 log("FAIL: Cross frame access to a javascript: URL embed in a fr
ame window.open'ed on foreign domain allowed."); |
| 43 return; | 29 return; |
| 44 } catch (e) { | 30 } catch (e) { |
| 45 } | 31 } |
| 46 log("PASS: Cross frame access to a javascript: URL embed in a frame
window.open'ed on foreign domain denied!"); | 32 log("PASS: Cross frame access to a javascript: URL embed in a frame
window.open'ed on foreign domain denied!"); |
| 47 } | 33 } |
| 48 </script> | 34 </script> |
| 49 </head> | 35 </head> |
| 50 <body> | 36 <body> |
| 51 <pre id="console"></pre> | 37 <pre id="console"></pre> |
| 52 </body> | 38 </body> |
| 53 </html> | 39 </html> |
| OLD | NEW |