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

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

Issue 10890002: Make V8ValueConverter.FromV8Value behave similarly to JSON.stringify (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use the actual objects, not empty objects Created 8 years, 3 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: chrome/renderer/extensions/send_request_natives.cc
diff --git a/chrome/renderer/extensions/send_request_natives.cc b/chrome/renderer/extensions/send_request_natives.cc
index a5a8834f77aff0ee742c5d5c8554f4bcbb3379e9..bba13bf9bc63c83bbf4e3d0ff4b6c60e01294491 100644
--- a/chrome/renderer/extensions/send_request_natives.cc
+++ b/chrome/renderer/extensions/send_request_natives.cc
@@ -37,14 +37,15 @@ v8::Handle<v8::Value> SendRequestNatives::StartRequest(
int request_id = args[2]->Int32Value();
bool has_callback = args[3]->BooleanValue();
bool for_io_thread = args[4]->BooleanValue();
+ bool preserve_null_in_objects = args[5]->BooleanValue();
+ bool allow_functions_in_objects = args[6]->BooleanValue();
scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create());
- // Make "undefined" the same as "null" for optional arguments, but for objects
- // strip nulls (like {foo: null}, and therefore {foo: undefined} as well) to
- // make it easier for extension APIs to check for optional arguments.
- converter->SetUndefinedAllowed(true);
- converter->SetStripNullFromObjects(true);
+ if (!preserve_null_in_objects)
+ converter->SetStripNullFromObjects(true);
+ if (allow_functions_in_objects)
+ converter->SetFunctionAllowed(true);
scoped_ptr<Value> value_args(
converter->FromV8Value(args[1], v8::Context::GetCurrent()));

Powered by Google App Engine
This is Rietveld 408576698