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

Unified Diff: extensions/renderer/api_binding_js_util.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
« no previous file with comments | « chrome/browser/extensions/native_bindings_apitest.cc ('k') | extensions/renderer/api_signature.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/api_binding_js_util.cc
diff --git a/extensions/renderer/api_binding_js_util.cc b/extensions/renderer/api_binding_js_util.cc
index 8b39aa9dae0097c5f314cc1be9dad6a911f00daf..1701faaf3d71e93d563d2ac51f00815aa64dac17 100644
--- a/extensions/renderer/api_binding_js_util.cc
+++ b/extensions/renderer/api_binding_js_util.cc
@@ -79,10 +79,15 @@ void APIBindingJSUtil::SendRequest(
std::unique_ptr<base::ListValue> converted_arguments;
v8::Local<v8::Function> callback;
- std::string error;
- CHECK(signature->ParseArgumentsToJSON(context, request_args, *type_refs_,
- &converted_arguments, &callback,
- &error));
+
+ // Some APIs (like fileSystem and contextMenus) don't provide arguments that
+ // match the expected schema. For now, we need to ignore these and trust the
+ // JS gives us something we expect.
+ // TODO(devlin): We should ideally always be able to validate these, meaning
+ // that we either need to make the APIs give us the expected signature, or
+ // need to have a way of indicating an internal signature.
+ CHECK(signature->ConvertArgumentsIgnoringSchema(
+ context, request_args, &converted_arguments, &callback));
request_handler_->StartRequest(context, name, std::move(converted_arguments),
callback, custom_callback, thread);
« no previous file with comments | « chrome/browser/extensions/native_bindings_apitest.cc ('k') | extensions/renderer/api_signature.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698