summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
authormpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-21 19:20:00 +0000
committermpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-21 19:20:00 +0000
commit4508e619808656799e4ff1061b40f81f874ba715 (patch)
tree2892fc5abca76ad0f67e4988ffd8a6b2e9388e2d /chrome/renderer
parent0e0910c8df45f95c11a1a7ad95cc4a6610b6022d (diff)
downloadchromium_src-4508e619808656799e4ff1061b40f81f874ba715.zip
chromium_src-4508e619808656799e4ff1061b40f81f874ba715.tar.gz
chromium_src-4508e619808656799e4ff1061b40f81f874ba715.tar.bz2
Print a better error message when someone passes the wrong parameters to
sendRequest. BUG=46094 TEST=no Review URL: http://codereview.chromium.org/3005022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53228 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/resources/renderer_extension_bindings.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/chrome/renderer/resources/renderer_extension_bindings.js b/chrome/renderer/resources/renderer_extension_bindings.js
index 731da47..ab1e4ce 100644
--- a/chrome/renderer/resources/renderer_extension_bindings.js
+++ b/chrome/renderer/resources/renderer_extension_bindings.js
@@ -168,6 +168,8 @@ var chrome = chrome || {};
targetId = arguments[nextArg++];
if (typeof(arguments[nextArg]) == "object")
name = arguments[nextArg++].name || name;
+ if (nextArg != arguments.length)
+ throw new Error("Invalid arguments to connect.");
var portId = OpenChannelToExtension(extensionId, targetId, name);
if (portId >= 0)
@@ -183,8 +185,10 @@ var chrome = chrome || {};
if (typeof(arguments[lastArg]) == "function")
responseCallback = arguments[lastArg--];
request = arguments[lastArg--];
- if (lastArg >= 0)
+ if (lastArg >= 0 && typeof(arguments[lastArg]) == "string")
targetId = arguments[lastArg--];
+ if (lastArg != -1)
+ throw new Error("Invalid arguments to sendRequest.");
var port = chrome.extension.connect(targetId,
{name: chromeHidden.kRequestChannel});