| Tests various use cases when cloning MessagePorts. |
| |
| On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". |
| |
| |
| PASS channel.port1.postMessage('msg', [channel.port1]) threw exception DataCloneError: Failed to execute 'postMessage' on 'MessagePort': Port at index 0 contains the source port.. |
| Posting port to entangled pair neuters the port and does nothing else: |
| PASS channel2.port1.postMessage('msg', [channel.port2]) threw exception DataCloneError: Failed to execute 'postMessage' on 'MessagePort': Port at index 0 is already neutered.. |
| Posting a neutered ArrayBuffer should throw. |
| PASS channel.port1.postMessage(arrayBuffer, []) threw exception DataCloneError: Failed to execute 'postMessage' on 'MessagePort': An ArrayBuffer is neutered and could not be cloned.. |
| Posting a neutered ArrayBufferView should throw. |
| PASS channel.port1.postMessage('msg', [uint16Array]) threw exception TypeError: Failed to execute 'postMessage' on 'MessagePort': Value at index 0 does not have a transferable type.. |
| PASS channel.port1.postMessage(uint16Array, []) threw exception DataCloneError: Failed to execute 'postMessage' on 'MessagePort': An ArrayBuffer is neutered and could not be cloned.. |
| PASS channel.port1.postMessage('msg', [channel2.port1]) threw exception DataCloneError: Failed to execute 'postMessage' on 'MessagePort': Port at index 0 is already neutered.. |
| PASS testEvent.ports.length is 1 |
| PASS parseInt(testEvent.data) is 1 |
| PASS parseInt(testEvent.data) is 2 |
| PASS parseInt(testEvent.data) is 3 |
| PASS Posted messages to cloned port. |
| PASS testEvent.data is 'testme' |
| PASS testEvent.ports is not null |
| PASS testEvent.ports.length is 1 |
| PASS testEvent.data is 'closed' |
| PASS successfullyParsed is true |
| |
| TEST COMPLETE |
| |