2 async_test(function(t) {
3 var channel1 = new MessageChannel();
4 var channel2 = new MessageChannel();
5 var channel3 = new MessageChannel();
6 channel2.port2.onmessage = t.step_func(function (evt) {
7 evt.ports[0].postMessage("Second");
8 evt.ports[0].postMessage("Third");
9 channel3.port1.onmessage = t.step_func(function (evt) {
10 evt.ports[0].postMessage("Fourth");
12 channel3.port2.postMessage("2", evt.ports);
14 channel1.port1.postMessage("First");
15 channel2.port1.postMessage("1", [channel1.port1]);
17 channel1.port2.onmessage = t.step_func(function (evt) {
19 assert_equals(evt.data, "First");
21 } else if (counter == 1) {
22 assert_equals(evt.data, "Second");
25 else if (counter == 2) {
26 assert_equals(evt.data, "Third");
29 else if (counter == 3) {
30 assert_equals(evt.data, "Fourth");
34 }, `When transferring a port,
35 outgoing messages sent at each transfer step are received in order by the entangled port.`);