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

Unified Diff: extensions/renderer/argument_spec.cc

Issue 2805123002: [Extensions Bindings] Allow schema violations through sendRequest (Closed)
Patch Set: Rebase Created 3 years, 8 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: extensions/renderer/argument_spec.cc
diff --git a/extensions/renderer/argument_spec.cc b/extensions/renderer/argument_spec.cc
index a9fd3f8c8af60940ab6cb626d2d9aa0ab8c7faa5..b0cb7c3aa46abed98e0d562bc71ac172be73aa28 100644
--- a/extensions/renderer/argument_spec.cc
+++ b/extensions/renderer/argument_spec.cc
@@ -149,17 +149,15 @@ bool ArgumentSpec::ParseArgument(v8::Local<v8::Context> context,
if (type_ == ArgumentType::FUNCTION) {
if (!value->IsFunction())
return false;
- // Certain APIs, like webRequest and contextMenus, have functions as
- // parameters that aren't the callback. We need these included in the
- // signature for validation purposes, but don't *really* need to serialize
- // them. Unfortunately, if we don't, validation in the browser fails. For
- // now, the expectation is that functions are serialized as dictionaries,
- // to match the content::V8ValueConverter behavior.
- // TODO(devlin): Change this somehow. We could, for instance, add a
- // 'validation_only' property to the schema to indicate that a parameter
- // or property shouldn't be serialized or included in the compiled types.
- if (out_value)
+
+ if (out_value) {
+ // Certain APIs (contextMenus) have functions as parameters other than the
+ // callback (contextMenus uses it for an onclick listener). Our generated
+ // types have adapted to consider functions "objects" and serialize them
+ // as dictionaries.
+ // TODO(devlin): It'd be awfully nice to get rid of this eccentricity.
*out_value = base::MakeUnique<base::DictionaryValue>();
+ }
return true;
}
« no previous file with comments | « extensions/renderer/api_signature.cc ('k') | extensions/renderer/resources/context_menus_custom_bindings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698