Index: chrome/test/data/extensions/api_test/messaging/externally_connectable/sites/assertions.js |
diff --git a/chrome/test/data/extensions/api_test/messaging/externally_connectable/sites/assertions.js b/chrome/test/data/extensions/api_test/messaging/externally_connectable/sites/assertions.js |
index fae9c574c99837f02dcff01c1d47044ef8d21d18..b6fb3151db8870a1a4aa43d77870c2bcfbcb597b 100644 |
--- a/chrome/test/data/extensions/api_test/messaging/externally_connectable/sites/assertions.js |
+++ b/chrome/test/data/extensions/api_test/messaging/externally_connectable/sites/assertions.js |
@@ -263,6 +263,46 @@ window.assertions = { |
}); |
}, |
+ tryIllegalArguments: function() { |
+ // Tests that illegal arguments to messaging functions throw exceptions. |
+ // Regression test for crbug.com/472700, where they crashed the renderer. |
+ function runIllegalFunction(fun) { |
+ try { |
+ fun(); |
+ } catch(e) { |
+ return true; |
+ } |
+ console.error('Function did not throw exception: ' + fun); |
+ sendToBrowser(false); |
+ return false; |
+ } |
+ var result = |
+ runIllegalFunction(chrome.runtime.connect) && |
+ runIllegalFunction(function() { |
+ chrome.runtime.connect(''); |
+ }) && |
+ runIllegalFunction(function() { |
+ chrome.runtime.connect(42); |
+ }) && |
+ runIllegalFunction(function() { |
+ chrome.runtime.connect('', 42); |
+ }) && |
+ runIllegalFunction(function() { |
+ chrome.runtime.connect({name: 'noname'}); |
+ }) && |
+ runIllegalFunction(chrome.runtime.sendMessage) && |
+ runIllegalFunction(function() { |
+ chrome.runtime.sendMessage(''); |
+ }) && |
+ runIllegalFunction(function() { |
+ chrome.runtime.sendMessage(42); |
+ }) && |
+ runIllegalFunction(function() { |
+ chrome.runtime.sendMessage('', 42); |
+ }) && |
+ sendToBrowser(true); |
+ }, |
+ |
areAnyRuntimePropertiesDefined: function(names) { |
var result = false; |
if (chrome.runtime) { |