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