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

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: no more function 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
« no previous file with comments | « chrome/renderer/extensions/event_bindings.cc ('k') | chrome/renderer/extensions/user_script_scheduler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b788a8af7a99439ad60b58b3e1726b5c9440a8c7 100644
--- a/chrome/renderer/extensions/send_request_natives.cc
+++ b/chrome/renderer/extensions/send_request_natives.cc
@@ -37,14 +37,16 @@ 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();
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);
+ // See http://crbug.com/149880. The context menus APIs relies on this, but
+ // we shouln't really be doing it (e.g. for the sake of the storage API).
+ converter->SetFunctionAllowed(true);
+
+ if (!preserve_null_in_objects)
+ converter->SetStripNullFromObjects(true);
scoped_ptr<Value> value_args(
converter->FromV8Value(args[1], v8::Context::GetCurrent()));
« no previous file with comments | « chrome/renderer/extensions/event_bindings.cc ('k') | chrome/renderer/extensions/user_script_scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698