blob: 87726b3c50a7e7c6d251a62e0fabb48eabf4e4e9 [file] [log] [blame]
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': Value at index 1 is an untransferable 'null' value..
PASS channel.port1.postMessage("notAPort", [channel3.port1, {}, channel3.port2]) threw exception TypeError: 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("notAnArray", channel3.port1) threw exception TypeError: Failed to execute 'postMessage' on 'MessagePort': Iterator getter is not callable..
PASS channel.port1.postMessage("notASequence", [{length: 3}]) threw exception TypeError: 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 successfullyParsed is true
TEST COMPLETE
PASS event.ports is non-null and zero length when no port sent
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 Sending Error object has thrown DataCloneError: Failed to execute 'postMessage' on 'MessagePort': Error 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