OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script> | 3 <script> |
4 if (window.testRunner) { | 4 window.onload = function() |
5 testRunner.dumpAsText(); | 5 { |
6 testRunner.dumpChildFramesAsText(); | 6 if (window.testRunner) { |
7 testRunner.waitUntilDone(); | 7 testRunner.dumpAsText(); |
8 } | 8 testRunner.dumpChildFramesAsText(); |
| 9 testRunner.waitUntilDone(); |
| 10 } |
9 | 11 |
10 window.addEventListener('message', function() { | 12 if (window.testRunner) { |
11 runTest(); | 13 setTimeout(pollForTest, 1); |
12 if (window.testRunner) | 14 } else { |
13 testRunner.notifyDone(); | 15 alert("This test requires it be run in DRT."); |
14 }); | |
15 | |
16 setFrameLocation = function(url) { | |
17 var frame = document.getElementById('aFrame'); | |
18 var jsErrorMessage = 'Blocked a frame with origin "http://127.0.0.1:
8000" from accessing a cross-origin frame.'; | |
19 try { | |
20 frame.location = url; | |
21 } catch (e) { | |
22 console.log("Caught exception while setting frame's location to
'" + url + "'. '" + e + "'."); | |
23 if (e.message == jsErrorMessage) | |
24 console.log("PASS: Exception was '" + e.message + "'."); | |
25 else | |
26 console.log("FAIL: Exception should have been '" + jsErrorMe
ssage + "', was '" + e.message + "'."); | |
27 } | 16 } |
28 } | 17 } |
29 | 18 |
30 function runTest() { | 19 pollForTest = function() |
31 setFrameLocation('javascript:"FAIL: this should not have been loaded
."'); | 20 { |
32 setFrameLocation(' javascript:"FAIL: this should not have been loade
d."'); | 21 if (!testRunner.globalFlag) { |
33 setFrameLocation('java\0script:"FAIL: this should not have been load
ed."'); | 22 setTimeout(pollForTest, 1); |
34 setFrameLocation('javascript\t:"FAIL: this should not have been load
ed."'); | 23 return; |
35 setFrameLocation('javascript\1:"FAIL: this should not have been load
ed."'); | 24 } |
| 25 runTest(); |
| 26 testRunner.notifyDone(); |
| 27 } |
| 28 |
| 29 runTest = function() |
| 30 { |
| 31 var frame = document.getElementById('aFrame'); |
| 32 frame.location = 'javascript:"FAIL: this should not have been loaded
."'; |
| 33 frame.location = ' javascript:"FAIL: this should not have been loade
d."'; |
| 34 frame.location = 'java\0script:"FAIL: this should not have been load
ed."'; |
| 35 frame.location = 'javascript\t:"FAIL: this should not have been load
ed."'; |
| 36 frame.location = 'javascript\1:"FAIL: this should not have been load
ed."'; |
36 } | 37 } |
37 </script> | 38 </script> |
38 </head> | 39 </head> |
39 <frameset rows="10%,*"> | 40 <frameset rows="10%,*"> |
40 <frame id='main' src="data:text/html,<p>This test passes as long as the word
'FAIL' and an accompanying message do not appear in the frame below.</p>"> | 41 <frame id='main' src="data:text/html,<p>This test passes as long as the word
'FAIL' and an accompanying message do not appear in the frame below.</p>"> |
41 <frame id='aFrame' src='http://localhost:8000/security/resources/cross-frame
-iframe.html'> | 42 <frame id='aFrame' src='http://localhost:8000/security/resources/cross-frame
-iframe.html'> |
42 </frameset> | 43 </frameset> |
43 </html> | 44 </html> |
OLD | NEW |