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

Side by Side Diff: LayoutTests/http/tests/security/suborigins/suborigin-valid-names.html

Issue 1180923003: Add window access checks for Suborigins (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix tests on Windows Created 5 years, 6 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>Valid suborigin names</title> 4 <title>Valid suborigin names</title>
5 <script src="/resources/testharness.js"></script>
6 <script src="/resources/testharnessreport.js"></script>
7 </head> 5 </head>
8 6
9 <script> 7 <script>
8 if (window.testRunner) {
9 testRunner.dumpAsText();
10 testRunner.waitUntilDone();
11 }
12
13 function finish() {
14 if (window.testRunner)
15 testRunner.notifyDone();
16 }
17
10 var test_suborigin_names = [ 18 var test_suborigin_names = [
11 "foobar", 19 "foobar",
12 "foob4r", 20 "foob4r",
13 "Foobar", 21 "Foobar",
14 "FOOBAR", 22 "FOOBAR",
15 "42", 23 "42",
16 ]; 24 ];
17 25
18 var iframe; 26 var iframe;
19 var i = 0; 27 var i = 0;
20 function next() { 28 function next() {
21 name = test_suborigin_names[i]; 29 if (i >= test_suborigin_names.length)
30 finish();
31 document.getElementById('iframe').src = "resources/reach-into-iframe.php?chi ldsuborigin=" + test_suborigin_names[i];
22 i++; 32 i++;
23 iframe.src = "resources/childsuborigin.php?suborigin=" + name;
24 } 33 }
25 34
26 window.onmessage = function() { 35 window.onmessage = function(event) {
27 if (i > test_suborigin_names.length) 36 alert(event.data);
28 done();
29
30 var secret = '';
31 try {
32 secret = iframe.contentWindow.secret;
33 assert_unreached();
34 } catch(e) {
35 assert_equals(secret, "", "The parent frame should never be able to get the secret value from the child iframe.");
36 };
37 next(); 37 next();
38 }; 38 };
39 39
40 window.onload = function() {; 40 window.onload = function() {
41 iframe = document.getElementById('iframe');
42 next(); 41 next();
43 }; 42 };
44 </script> 43 </script>
45 <iframe id="iframe"></iframe> 44 <iframe id="iframe"></iframe>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698