2 <p>Test whether opening and closing a messageport in different microtasks correctly receives an in-flight message.
</p>
3 <p>Should be a START message, followed by a HELLO message then DONE.
</p>
8 document
.getElementById("log").innerHTML
+= message
+ "<br>";
11 if (window
.testRunner
) {
12 testRunner
.dumpAsText();
13 testRunner
.waitUntilDone();
18 var channel
= new MessageChannel
;
19 channel
.port2
.postMessage("HELLO");
23 function openThenPostClose() {
24 setTimeout(function() {
25 channel
.port1
.onmessage = function(evt
) {
26 log("PASS. Got Message: " + evt
.data
+ " before close");
28 setTimeout(function() {
29 channel
.port1
.close();
35 // Wait a short period of time to ensure no messages come in from previous tests.
36 setTimeout(function() {
38 if (window
.testRunner
)
39 testRunner
.notifyDone();