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

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

Issue 22985006: Throw an exception when denying access to 'Frame's 'location' setter. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 if (window.testRunner) {
5 { 5 testRunner.dumpAsText();
6 if (window.testRunner) { 6 testRunner.dumpChildFramesAsText();
7 testRunner.dumpAsText(); 7 testRunner.waitUntilDone();
8 testRunner.dumpChildFramesAsText(); 8 }
9 testRunner.waitUntilDone();
10 }
11 9
12 if (window.testRunner) { 10 window.addEventListener('message', function() {
13 setTimeout(pollForTest, 1); 11 runTest();
14 } else { 12 if (window.testRunner)
15 alert("This test requires it be run in DRT."); 13 testRunner.notifyDone();
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 + "'.");
16 } 27 }
17 } 28 }
18 29
19 pollForTest = function() 30 function runTest() {
20 { 31 setFrameLocation('javascript:"FAIL: this should not have been loaded ."');
21 if (!testRunner.globalFlag) { 32 setFrameLocation(' javascript:"FAIL: this should not have been loade d."');
22 setTimeout(pollForTest, 1); 33 setFrameLocation('java\0script:"FAIL: this should not have been load ed."');
23 return; 34 setFrameLocation('javascript\t:"FAIL: this should not have been load ed."');
24 } 35 setFrameLocation('javascript\1:"FAIL: this should not have been load ed."');
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."';
37 } 36 }
38 </script> 37 </script>
39 </head> 38 </head>
40 <frameset rows="10%,*"> 39 <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>"> 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>">
42 <frame id='aFrame' src='http://localhost:8000/security/resources/cross-frame -iframe.html'> 41 <frame id='aFrame' src='http://localhost:8000/security/resources/cross-frame -iframe.html'>
43 </frameset> 42 </frameset>
44 </html> 43 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/http/tests/security/javascriptURL/javascriptURL-execution-context-frame-location-htmldom-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698