<body>
<p>Test Closed MessagePort Whether Receive Message Or Not.</p>
<p>Should be a START message, followed with DONE.</p>
<pre id=log></pre>
<script>
function log(message)
{
    document.getElementById("log").innerHTML += message + "<br>";
}

if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

log("START");

var channel = new MessageChannel;
channel.port1.onmessage = function(evt) {
    log("Closed port receiving: FAIL. Got Message: " +  evt.data + " after close");
}
channel.port1.close();
channel.port2.postMessage("This message can't be received");
done();

function done() {
    // Wait a short period of time to ensure no messages come in from previous tests.
    setTimeout(function() {
        log("DONE");
        if (window.testRunner)
            testRunner.notifyDone();
    }, 100);
}

</script>
</body>
