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 window.onload = function() | 5 window.onload = function() |
6 { | 6 { |
7 if (window.testRunner) { | 7 if (window.testRunner) { |
8 testRunner.dumpAsText(); | 8 testRunner.dumpAsText(); |
9 testRunner.dumpChildFramesAsText(); | 9 testRunner.dumpChildFramesAsText(); |
10 testRunner.waitUntilDone(); | 10 testRunner.waitUntilDone(); |
11 } | 11 } |
12 | 12 |
13 if (window.testRunner) { | 13 window.addEventListener('message', function () |
14 setTimeout(pollForTest, 1); | 14 { |
15 } else { | 15 runTest(); |
16 log("To run the test, click the button below when the opened win
dow finishes loading."); | 16 testRunner.notifyDone(); |
17 var button = document.createElement("button"); | 17 }); |
18 button.appendChild(document.createTextNode("Run Test")); | |
19 button.onclick = runTest; | |
20 document.body.appendChild(button); | |
21 } | |
22 } | |
23 | |
24 pollForTest = function() | |
25 { | |
26 if (!testRunner.globalFlag) { | |
27 setTimeout(pollForTest, 1); | |
28 return; | |
29 } | |
30 runTest(); | |
31 testRunner.notifyDone(); | |
32 } | 18 } |
33 | 19 |
34 runTest = function() | 20 runTest = function() |
35 { | 21 { |
36 try { | 22 try { |
37 window[0][0].document.getElementById('accessMe').innerHTML = "FA
IL: Cross frame access to a data: URL embed in a frame on a foreign domain allow
ed."; | 23 window[0][0].document.getElementById('accessMe').innerHTML = "FA
IL: Cross frame access to a data: URL embed in a frame on a foreign domain allow
ed."; |
38 log("FAIL: Cross frame access to a data: URL embed in a frame on
a foreign domain allowed."); | 24 log("FAIL: Cross frame access to a data: URL embed in a frame on
a foreign domain allowed."); |
39 return; | 25 return; |
40 } catch (e) { | 26 } catch (e) { |
41 } | 27 } |
42 log("PASS: Cross frame access to a data: URL embed in a frame on a f
oreign domain denied!"); | 28 log("PASS: Cross frame access to a data: URL embed in a frame on a f
oreign domain denied!"); |
43 } | 29 } |
44 </script> | 30 </script> |
45 </head> | 31 </head> |
46 <body> | 32 <body> |
47 <p>The scenario for this test is that you have an iframe with content from a
foreign domain. In that foreign content | 33 <p>The scenario for this test is that you have an iframe with content from a
foreign domain. In that foreign content |
48 is an iframe which loads a data: URL. This tests that this main documen
t does not have access to that | 34 is an iframe which loads a data: URL. This tests that this main documen
t does not have access to that |
49 data: URL loaded iframe.</p> | 35 data: URL loaded iframe.</p> |
50 <iframe src="http://localhost:8000/security/dataURL/resources/foreign-domain
-data-url-accessee-iframe.html" style="width: 400px; height:200px;"></iframe> | 36 <iframe src="http://localhost:8000/security/dataURL/resources/foreign-domain
-data-url-accessee-iframe.html" style="width: 400px; height:200px;"></iframe> |
51 <pre id="console"></pre> | 37 <pre id="console"></pre> |
52 </body> | 38 </body> |
53 </html> | 39 </html> |
OLD | NEW |