Index: LayoutTests/fast/events/message-port-clone.html |
diff --git a/LayoutTests/fast/events/message-port-clone.html b/LayoutTests/fast/events/message-port-clone.html |
index b738887c39dac0ee28e5e7149b694e40b1022833..8b3ef59fb57d9d4cbfcab9a09193e7d13efe8643 100644 |
--- a/LayoutTests/fast/events/message-port-clone.html |
+++ b/LayoutTests/fast/events/message-port-clone.html |
@@ -13,20 +13,36 @@ channel.port1.onmessage = channel.port2.onmessage = function(evt) { |
} |
// Posting port to itself should throw an exception. |
-shouldThrow("channel.port1.postMessage('msg', [channel.port1])", '"DataCloneError: Failed to execute \'postMessage\' on \'MessagePort\': Item #0 in the array of ports contains the source port."'); |
+shouldThrow("channel.port1.postMessage('msg', [channel.port1])", '"DataCloneError: Failed to execute \'postMessage\' on \'MessagePort\': Port at index 0 contains the source port."'); |
debug("Posting port to entangled pair neuters the port and does nothing else:"); |
channel = new MessageChannel; |
var channel2 = new MessageChannel; |
channel.port1.postMessage("msg", [channel.port2]); |
-shouldThrow("channel2.port1.postMessage('msg', [channel.port2])", '"DataCloneError: Failed to execute \'postMessage\' on \'MessagePort\': Item #0 in the array of ports is already neutered."'); |
+shouldThrow("channel2.port1.postMessage('msg', [channel.port2])", '"DataCloneError: Failed to execute \'postMessage\' on \'MessagePort\': Port at index 0 is already neutered."'); |
channel = new MessageChannel; |
channel2 = new MessageChannel |
channel.port1.postMessage("msg", [channel2.port1]); |
+debug("Posting a neutered ArrayBuffer should throw."); |
+channel = new MessageChannel; |
+var arrayBuffer = new ArrayBuffer(2); |
+ |
+channel.port1.postMessage("msg", [arrayBuffer]); |
+shouldThrow("channel.port1.postMessage(arrayBuffer, [])", '"DataCloneError: Failed to execute \'postMessage\' on \'MessagePort\': An ArrayBuffer is neutered and could not be cloned."'); |
+ |
+debug("Posting a neutered ArrayBufferView should throw."); |
+channel = new MessageChannel; |
+var uint16Array = new Uint16Array(10); |
+ |
+shouldThrow("channel.port1.postMessage('msg', [uint16Array])", '"DataCloneError: Failed to execute \'postMessage\' on \'MessagePort\': Value at index 0 does not have a transferable type."'); |
+ |
+channel.port1.postMessage("msg", [uint16Array.buffer]); |
+shouldThrow("channel.port1.postMessage(uint16Array, [])", '"DataCloneError: Failed to execute \'postMessage\' on \'MessagePort\': An ArrayBuffer is neutered and could not be cloned."'); |
+ |
// Should not be able to post a cloned port. |
-shouldThrow("channel.port1.postMessage('msg', [channel2.port1])", '"DataCloneError: Failed to execute \'postMessage\' on \'MessagePort\': Item #0 in the array of ports is already neutered."'); |
+shouldThrow("channel.port1.postMessage('msg', [channel2.port1])", '"DataCloneError: Failed to execute \'postMessage\' on \'MessagePort\': Port at index 0 is already neutered."'); |
// Test posting messages to a port in cloned state. |
@@ -90,6 +106,7 @@ function testPostClosePort() |
finishJSTest(); |
} |
} |
+ |
</script> |
</body> |
</html> |