summaryrefslogtreecommitdiffstats
path: root/content/renderer/v8_value_converter_impl.h
diff options
context:
space:
mode:
authorkalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-17 04:05:24 +0000
committerkalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-17 04:05:24 +0000
commite0658bcde3e33be5f5c50f6c6aeef693bf5c2a99 (patch)
tree5daa748e37e6476057dcf21412dc4e232f16810b /content/renderer/v8_value_converter_impl.h
parent53606d54350cc33bc434ec65a388dfea1211b632 (diff)
downloadchromium_src-e0658bcde3e33be5f5c50f6c6aeef693bf5c2a99.zip
chromium_src-e0658bcde3e33be5f5c50f6c6aeef693bf5c2a99.tar.gz
chromium_src-e0658bcde3e33be5f5c50f6c6aeef693bf5c2a99.tar.bz2
Make V8ValueConverter.FromV8Value be more consistent with JSON.stringify: don't
serialize undefined as null, don't serialize functions as objects, omit values from objects when they don't serialize, and insert null into arrays when they don't serialize. It is now possible for FromV8Value to return NULL; previously it would return Value::CreateNullValue on failure. This is needed for the Storage API, where we promise that the values that are passed in are serialized as JSON, yet the value conversion doesn't work in a way that allows it. However, the null-stripping behavior needs to be configurable so that existing extension APIs (which only expect null/undefined to appear for optional values) still work. BUG=145081 Review URL: https://chromiumcodereview.appspot.com/10890002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@157074 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer/v8_value_converter_impl.h')
-rw-r--r--content/renderer/v8_value_converter_impl.h18
1 files changed, 7 insertions, 11 deletions
diff --git a/content/renderer/v8_value_converter_impl.h b/content/renderer/v8_value_converter_impl.h
index baf061a..c6b9511 100644
--- a/content/renderer/v8_value_converter_impl.h
+++ b/content/renderer/v8_value_converter_impl.h
@@ -23,13 +23,9 @@ class CONTENT_EXPORT V8ValueConverterImpl : public content::V8ValueConverter {
V8ValueConverterImpl();
// V8ValueConverter implementation.
- virtual bool GetUndefinedAllowed() const OVERRIDE;
- virtual void SetUndefinedAllowed(bool val) OVERRIDE;
- virtual bool GetDateAllowed() const OVERRIDE;
virtual void SetDateAllowed(bool val) OVERRIDE;
- virtual bool GetRegexpAllowed() const OVERRIDE;
- virtual void SetRegexpAllowed(bool val) OVERRIDE;
- virtual bool GetStripNullFromObjects() const OVERRIDE;
+ virtual void SetRegExpAllowed(bool val) OVERRIDE;
+ virtual void SetFunctionAllowed(bool val) OVERRIDE;
virtual void SetStripNullFromObjects(bool val) OVERRIDE;
virtual v8::Handle<v8::Value> ToV8Value(
const base::Value* value,
@@ -58,14 +54,14 @@ class CONTENT_EXPORT V8ValueConverterImpl : public content::V8ValueConverter {
base::Value* FromV8Object(v8::Handle<v8::Object> object,
std::set<int>* unique_set) const;
- // If true, we will convert undefined JavaScript values to null.
- bool undefined_allowed_;
-
// If true, we will convert Date JavaScript objects to doubles.
bool date_allowed_;
- // If true, we will convet RegExp JavaScript objects to string.
- bool regexp_allowed_;
+ // If true, we will convert RegExp JavaScript objects to string.
+ bool reg_exp_allowed_;
+
+ // If true, we will convert Function JavaScript objects to dictionaries.
+ bool function_allowed_;
// If true, undefined and null values are ignored when converting v8 objects
// into Values.