Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Unified Diff: LayoutTests/fast/events/resources/message-port-multi.js

Issue 1022283002: Throw TypeError if value conversion to transferable fails. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add more tests for TypeError throwing Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/events/resources/message-port-multi.js
diff --git a/LayoutTests/fast/events/resources/message-port-multi.js b/LayoutTests/fast/events/resources/message-port-multi.js
index 1cdaf6cb31c89f2cf5c6144d8eac8bc80d3a6fc0..6ae5176299ad6bd832abf111f03bdaf3fa2b4977 100644
--- a/LayoutTests/fast/events/resources/message-port-multi.js
+++ b/LayoutTests/fast/events/resources/message-port-multi.js
@@ -16,14 +16,14 @@ channel.port1.postMessage("two ports", [channel2.port1, channel2.port2]);
// Now test various failure cases
shouldThrow('channel.port1.postMessage("same port", [channel.port1])', '"DataCloneError: Failed to execute \'postMessage\' on \'MessagePort\': Port at index 0 contains the source port."');
-shouldThrow('channel.port1.postMessage("null port", [channel3.port1, null, channel3.port2])', '"DataCloneError: Failed to execute \'postMessage\' on \'MessagePort\': Value at index 1 is an untransferable \'null\' value."');
-shouldThrow('channel.port1.postMessage("notAPort", [channel3.port1, {}, channel3.port2])', '"DataCloneError: Failed to execute \'postMessage\' on \'MessagePort\': Value at index 1 does not have a transferable type."');
+shouldThrow('channel.port1.postMessage("null port", [channel3.port1, null, channel3.port2])', '"TypeError: Failed to execute \'postMessage\' on \'MessagePort\': Value at index 1 is an untransferable \'null\' value."');
+shouldThrow('channel.port1.postMessage("notAPort", [channel3.port1, {}, channel3.port2])', '"TypeError: Failed to execute \'postMessage\' on \'MessagePort\': Value at index 1 does not have a transferable type."');
shouldThrow('channel.port1.postMessage("duplicate port", [channel3.port1, channel3.port1])', '"DataCloneError: Failed to execute \'postMessage\' on \'MessagePort\': Message port at index 1 is a duplicate of an earlier port."');
// Should be OK to send channel3.port1 (should not have been disentangled by the previous failed calls).
channel.port1.postMessage("entangled ports", [channel3.port1, channel3.port2]);
shouldThrow('channel.port1.postMessage("notAnArray", channel3.port1)', '"TypeError: Failed to execute \'postMessage\' on \'MessagePort\': The 2nd argument is neither an array, nor does it have indexed properties."');
-shouldThrow('channel.port1.postMessage("notASequence", [{length: 3}])', '"DataCloneError: Failed to execute \'postMessage\' on \'MessagePort\': Value at index 0 does not have a transferable type."');
+shouldThrow('channel.port1.postMessage("notASequence", [{length: 3}])', '"TypeError: Failed to execute \'postMessage\' on \'MessagePort\': Value at index 0 does not have a transferable type."');
var arrayBuffer = new ArrayBuffer(2);
shouldThrow('channel.port1.postMessage("duplicate buffer", [arrayBuffer, arrayBuffer])', '"DataCloneError: Failed to execute \'postMessage\' on \'MessagePort\': ArrayBuffer at index 1 is a duplicate of an earlier ArrayBuffer."');
@@ -31,7 +31,7 @@ shouldThrow('channel.port1.postMessage("duplicate buffer", [arrayBuffer, arrayBu
// entries).
var largePortArray = [];
largePortArray[1234567890] = channel4.port1;
-shouldThrow('channel.port1.postMessage("largeSequence", largePortArray)', '"DataCloneError: Failed to execute \'postMessage\' on \'MessagePort\': Value at index 0 is an untransferable \'undefined\' value."');
+shouldThrow('channel.port1.postMessage("largeSequence", largePortArray)', '"TypeError: Failed to execute \'postMessage\' on \'MessagePort\': Value at index 0 is an untransferable \'undefined\' value."');
channel.port1.postMessage("done");
@@ -145,4 +145,3 @@ channel.port2.onmessage = function(event) {
} else
testFailed("Received unexpected message: " + event.data);
}
-

Powered by Google App Engine
This is Rietveld 408576698