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

Unified Diff: chrome/renderer/extensions/extension_process_bindings.cc

Issue 173034: Validation of extension api callback and event parameters in DEBUG (Closed)
Patch Set: build docs Created 11 years, 4 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/renderer/extensions/extension_api_client_unittest.cc ('k') | chrome/renderer/renderer_resources.grd » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/extensions/extension_process_bindings.cc
diff --git a/chrome/renderer/extensions/extension_process_bindings.cc b/chrome/renderer/extensions/extension_process_bindings.cc
index 8d07d8292bdfb9b4ec00a0c85f6063c31da60add..d28adb05bc69bda2eecb7c458785acc1e6eb9217 100644
--- a/chrome/renderer/extensions/extension_process_bindings.cc
+++ b/chrome/renderer/extensions/extension_process_bindings.cc
@@ -298,8 +298,16 @@ void ExtensionProcessBindings::HandleResponse(int request_id, bool success,
argv[2] = v8::Boolean::New(success);
argv[3] = v8::String::New(response.c_str());
argv[4] = v8::String::New(error.c_str());
- bindings_utils::CallFunctionInContext(
+ v8::Handle<v8::Value> retval = bindings_utils::CallFunctionInContext(
request->second->context, "handleResponse", arraysize(argv), argv);
+ // In debug, the js will validate the callback parameters and return a
+ // string if a validation error has occured.
+#ifdef _DEBUG
+ if (!retval.IsEmpty() && !retval->IsUndefined()) {
+ std::string error = *v8::String::AsciiValue(retval);
+ DCHECK(false) << error;
+ }
+#endif
pending_requests.erase(request);
}
« no previous file with comments | « chrome/renderer/extensions/extension_api_client_unittest.cc ('k') | chrome/renderer/renderer_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698