OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <title> postMessage(): target port and source port </title> |
| 5 <script src="/resources/testharness.js"></script> |
| 6 <script src="/resources/testharnessreport.js"></script> |
| 7 </head> |
| 8 <body> |
| 9 <div id=log></div> |
| 10 <script> |
| 11 |
| 12 var TARGET = null; |
| 13 var SOURCE = null; |
| 14 var description = "The postMessage() method - Let target port be the port wi
th which source " |
| 15 + "port is entangled, if any."; |
| 16 |
| 17 var t = async_test("Test Description: " + description); |
| 18 |
| 19 var channel = new MessageChannel(); |
| 20 SOURCE = channel.port1; |
| 21 TARGET = channel.port2; |
| 22 TARGET.start(); |
| 23 TARGET.addEventListener("message", t.step_func(TestMessageEvent), true); |
| 24 |
| 25 SOURCE.postMessage("ping"); |
| 26 |
| 27 function TestMessageEvent(evt) |
| 28 { |
| 29 assert_equals(evt.target, TARGET); |
| 30 assert_not_equals(evt.target, SOURCE); |
| 31 t.done(); |
| 32 } |
| 33 </script> |
| 34 </body> |
| 35 </html> |
OLD | NEW |