OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
| 4 <meta charset="utf-8"> |
4 <title>Validate serialization of event.origin and event.suborigin in postMessage
.</title> | 5 <title>Validate serialization of event.origin and event.suborigin in postMessage
.</title> |
5 <script src="/resources/testharness.js"></script> | 6 <script src="/resources/testharness.js"></script> |
6 <script src="/resources/testharnessreport.js"></script> | 7 <script src="/resources/testharnessreport.js"></script> |
7 </head> | 8 </head> |
8 <script> | 9 <script> |
9 var iframe_test = async_test("Validate serialization of event.origin and event.s
uborigin in postMessage from an iframe"); | 10 var iframe_test = async_test( |
10 var window_test = async_test("Validate serialization of event.origin and event.s
uborigin in postMessage from a window"); | 11 'Validate serialization of event.origin and event.suborigin in ' + |
| 12 'postMessage from an iframe'); |
| 13 var window_test = async_test( |
| 14 'Validate serialization of event.origin and event.suborigin in ' + |
| 15 'postMessage from a window'); |
11 | 16 |
12 window.onmessage = function(event) { | 17 window.onmessage = function(event) { |
13 if (event.data.type === 'iframe') { | 18 if (event.data.type === 'iframe') { |
14 iframe_test.step(function() { | 19 iframe_test.step(function() { |
15 assert_equals(event.origin, "http-so://foobar1.127.0.0.1:8000"); | 20 assert_equals(event.origin, 'http-so://foobar1.127.0.0.1:8000'); |
16 assert_equals(event.suborigin, "foobar1"); | 21 assert_equals(event.suborigin, 'foobar1'); |
17 assert_equals(event.data.suborigin, "foobar1"); | 22 assert_equals(event.data.suborigin, 'foobar1'); |
18 iframe_test.done(); | 23 iframe_test.done(); |
19 }); | 24 }); |
20 } else if (event.data.type === 'window') { | 25 } else if (event.data.type === 'window') { |
21 window_test.step(function() { | 26 window_test.step(function() { |
22 assert_equals(event.origin, "http-so://foobar2.127.0.0.1:8000"); | 27 assert_equals(event.origin, 'http-so://foobar2.127.0.0.1:8000'); |
23 assert_equals(event.suborigin, "foobar2"); | 28 assert_equals(event.suborigin, 'foobar2'); |
24 assert_equals(event.data.suborigin, "foobar2");; | 29 assert_equals(event.data.suborigin, 'foobar2');; |
25 window_test.done(); | 30 window_test.done(); |
26 }); | 31 }); |
27 } else { | 32 } else { |
28 assert_unreached(); | 33 assert_unreached(); |
29 } | 34 } |
30 | 35 } |
31 } | |
32 | 36 |
33 window.open('resources/post-document-to-parent.php?suborigin=foobar2&type=window
'); | 37 window.open('resources/post-document-to-parent.php?suborigin=foobar2&type=window
'); |
34 </script> | 38 </script> |
35 <iframe src="resources/post-document-to-parent.php?suborigin=foobar1&type=iframe
"></iframe> | 39 <iframe src="resources/post-document-to-parent.php?suborigin=foobar1&type=iframe
"></iframe> |
36 </html> | 40 </html> |
OLD | NEW |