This test checks the various use cases around sending multiple ports through MessagePort.postMessage
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS channel.port1.postMessage() threw exception TypeError: Failed to execute 'postMessage' on 'MessagePort': 1 argument required, but only 0 present..
PASS channel.port1.postMessage("same port", [channel.port1]) threw exception DataCloneError: Failed to execute 'postMessage' on 'MessagePort': Port at index 0 contains the source port..
PASS channel.port1.postMessage("null port", [channel3.port1, null, channel3.port2]) threw exception TypeError: Failed to execute 'postMessage' on 'MessagePort': Failed to convert value to 'object'..
PASS channel.port1.postMessage("notAPort", [channel3.port1, {}, channel3.port2]) threw exception DataCloneError: Failed to execute 'postMessage' on 'MessagePort': Value at index 1 does not have a transferable type..
PASS channel.port1.postMessage("duplicate port", [channel3.port1, channel3.port1]) threw exception DataCloneError: Failed to execute 'postMessage' on 'MessagePort': Message port at index 1 is a duplicate of an earlier port..
PASS channel.port1.postMessage("notASequence", [{length: 3}]) threw exception DataCloneError: Failed to execute 'postMessage' on 'MessagePort': Value at index 0 does not have a transferable type..
PASS channel.port1.postMessage("duplicate buffer", [arrayBuffer, arrayBuffer]) threw exception DataCloneError: Failed to execute 'postMessage' on 'MessagePort': ArrayBuffer at index 1 is a duplicate of an earlier ArrayBuffer..
PASS channel.port1.postMessage("largeSequence", largePortArray) threw exception RangeError: Failed to execute 'postMessage' on 'MessagePort': Array length exceeds supported limit..
PASS event.ports is non-null and zero length when no port sent
PASS successfullyParsed is true
TEST COMPLETE
PASS event.ports is non-null and zero length when empty array sent
PASS event.ports contains two ports when two ports sent
PASS event.ports contains two ports when two ports re-sent after error
PASS Sending host object has thrown DataCloneError: Failed to execute 'postMessage' on 'MessagePort': MessageChannel object could not be cloned.
PASS Sending host object has thrown DataCloneError: Failed to execute 'postMessage' on 'MessagePort': Navigator object could not be cloned.
PASS Sending Function object has thrown DataCloneError: Failed to execute 'postMessage' on 'MessagePort': function() {} could not be cloned.
PASS send-port: transferred one port
PASS send-port-twice: transferred one port twice
PASS send-two-ports: transferred two ports
TEST COMPLETE