Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: LayoutTests/http/tests/security/javascriptURL/javascriptURL-execution-context-frame-location-htmldom.html

Issue 22829002: Throw an exception when denying access to 'Frame's 'location' setter. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script> 3 <script>
4 window.onload = function() 4 window.onload = function()
5 { 5 {
6 if (window.testRunner) { 6 if (window.testRunner) {
7 testRunner.dumpAsText(); 7 testRunner.dumpAsText();
8 testRunner.dumpChildFramesAsText(); 8 testRunner.dumpChildFramesAsText();
9 testRunner.waitUntilDone(); 9 testRunner.waitUntilDone();
10 } 10 }
11 11
12 if (window.testRunner) { 12 if (window.testRunner) {
13 setTimeout(pollForTest, 1); 13 setTimeout(pollForTest, 1);
14 } else { 14 } else {
15 alert("This test requires it be run in DRT."); 15 alert("This test requires it be run in DRT.");
16 } 16 }
17 } 17 }
18 18
19 pollForTest = function() 19 pollForTest = function()
20 { 20 {
21 if (!testRunner.globalFlag) { 21 if (!testRunner.globalFlag) {
22 setTimeout(pollForTest, 1); 22 setTimeout(pollForTest, 1);
23 return; 23 return;
24 } 24 }
25 runTest(); 25 runTest();
26 testRunner.notifyDone(); 26 testRunner.notifyDone();
27 } 27 }
28
29 setFrameLocation = function(url) {
30 var frame = document.getElementById('aFrame');
31 try {
32 frame.location = url;
33 } catch (e) {
34 console.log("Caught exception while setting frame's location to '" + url + "'. '" + e + "'.");
35 }
36 }
28 37
29 runTest = function() 38 runTest = function()
30 { 39 {
31 var frame = document.getElementById('aFrame'); 40 setFrameLocation('javascript:"FAIL: this should not have been loaded ."');
32 frame.location = 'javascript:"FAIL: this should not have been loaded ."'; 41 setFrameLocation(' javascript:"FAIL: this should not have been loade d."');
33 frame.location = ' javascript:"FAIL: this should not have been loade d."'; 42 setFrameLocation('java\0script:"FAIL: this should not have been load ed."');
34 frame.location = 'java\0script:"FAIL: this should not have been load ed."'; 43 setFrameLocation('javascript\t:"FAIL: this should not have been load ed."');
35 frame.location = 'javascript\t:"FAIL: this should not have been load ed."'; 44 setFrameLocation('javascript\1:"FAIL: this should not have been load ed."');
36 frame.location = 'javascript\1:"FAIL: this should not have been load ed."';
37 } 45 }
38 </script> 46 </script>
39 </head> 47 </head>
40 <frameset rows="10%,*"> 48 <frameset rows="10%,*">
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>"> 49 <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>">
42 <frame id='aFrame' src='http://localhost:8000/security/resources/cross-frame -iframe.html'> 50 <frame id='aFrame' src='http://localhost:8000/security/resources/cross-frame -iframe.html'>
43 </frameset> 51 </frameset>
44 </html> 52 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698