OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
| 4 <meta charset="utf-8"> |
4 <script src="/resources/testharness.js"></script> | 5 <script src="/resources/testharness.js"></script> |
5 <script src="/resources/testharnessreport.js"></script> | 6 <script src="/resources/testharnessreport.js"></script> |
6 </head> | 7 </head> |
7 <body> | 8 <body> |
8 <script> | 9 <script> |
9 var test_suborigin_options = [ | 10 var test_suborigin_options = [ |
10 [ "foobar 'unsafe-postmessage-send'", "Single option" ], | 11 [ 'foobar \'unsafe-postmessage-send\'', 'Single option' ], |
11 [ "foobar 'unsafe-postmessage-receive' 'unsafe-postmessage-send'", "Two opti
ons" ], | 12 [ 'foobar \'unsafe-postmessage-receive\' \'unsafe-postmessage-send\'', |
12 [ "foobar 'unsafe-cookies' 'unsafe-postmessage-receive' 'unsafe-postmessage-
send'", "All options" ], | 13 'Two options' ], |
13 [ "foobar 'unknown'", "Unknown option" ], | 14 [ 'foobar \'unsafe-cookies\' \'unsafe-postmessage-receive\' ' + |
14 [ "foobar 'unknown' 'unsafe-cookies'", "Unknown option with valid options" ]
, | 15 '\'unsafe-postmessage-send\'', |
| 16 'All options' ], |
| 17 [ 'foobar \'unknown\'', 'Unknown option' ], |
| 18 [ 'foobar \'unknown\' \'unsafe-cookies\'', |
| 19 'Unknown option with valid options' ], |
15 ]; | 20 ]; |
16 | 21 |
17 for (option in test_suborigin_options) { | 22 for (option in test_suborigin_options) { |
18 async_test(t => { | 23 async_test(t => { |
19 var id = option; | 24 var id = option; |
20 var iframe; | 25 var iframe; |
21 window.addEventListener('message', t.step_func(event => { | 26 window.addEventListener('message', t.step_func(event => { |
22 if (event.source != iframe.contentWindow) | 27 if (event.source != iframe.contentWindow) |
23 return; | 28 return; |
24 | 29 |
25 assert_equals(event.data, "SecurityError: Blocked a frame with origi
n \"http://127.0.0.1:8000\" from accessing a cross-origin frame."); | 30 assert_equals(event.data, |
| 31 'SecurityError: Blocked a frame with origin ' + |
| 32 '"http://127.0.0.1:8000" from accessing a cross-origin frame.'); |
26 t.done(); | 33 t.done(); |
27 })); | 34 })); |
28 iframe = document.createElement('iframe'); | 35 iframe = document.createElement('iframe'); |
29 iframe.setAttribute('src', "resources/reach-into-iframe.php?childsuborig
in=" + test_suborigin_options[id][0]); | 36 iframe.setAttribute('src', |
30 document.body.appendChild(iframe); | 37 'resources/reach-into-iframe.php?childsuborigin=' + |
| 38 test_suborigin_options[id][0]); |
| 39 document.body.appendChild(iframe); |
31 }, test_suborigin_options[option][1]); | 40 }, test_suborigin_options[option][1]); |
32 } | 41 } |
33 </script> | 42 </script> |
34 </body> | 43 </body> |
35 </html> | 44 </html> |
OLD | NEW |