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

Unified Diff: chrome/renderer/resources/renderer_extension_bindings.js

Issue 3005022: Print a better error message when someone passes the wrong parameters to (Closed)
Patch Set: Created 10 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/resources/renderer_extension_bindings.js
diff --git a/chrome/renderer/resources/renderer_extension_bindings.js b/chrome/renderer/resources/renderer_extension_bindings.js
index 731da476347fc0d5dd0f1e7e35fa9b115b2c38cb..ab1e4cec2a19c7a93233ebbcb9d417fb74d55491 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});
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698