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