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-16 01:22:54 +0000
committerkalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-16 01:22:54 +0000
commitdcd4d20dabd4e21de94ee6f0208db81fcd9071d2 (patch)
tree848c21e36797a3f26444b08aa924e9771199aae8 /content/renderer/v8_value_converter_impl.h
parent61d6e608a4d9a5355e66ac9a6ba59743f650262b (diff)
downloadchromium_src-dcd4d20dabd4e21de94ee6f0208db81fcd9071d2.zip
chromium_src-dcd4d20dabd4e21de94ee6f0208db81fcd9071d2.tar.gz
chromium_src-dcd4d20dabd4e21de94ee6f0208db81fcd9071d2.tar.bz2
Revert 157025 - 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://codereview.chromium.org/10890002 TBR=kalman@chromium.org Review URL: https://codereview.chromium.org/10911327 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@157031 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, 11 insertions, 7 deletions
diff --git a/content/renderer/v8_value_converter_impl.h b/content/renderer/v8_value_converter_impl.h
index c6b9511..baf061a 100644
--- a/content/renderer/v8_value_converter_impl.h
+++ b/content/renderer/v8_value_converter_impl.h
@@ -23,9 +23,13 @@ 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 void SetRegExpAllowed(bool val) OVERRIDE;
- virtual void SetFunctionAllowed(bool val) OVERRIDE;
+ virtual bool GetRegexpAllowed() const OVERRIDE;
+ virtual void SetRegexpAllowed(bool val) OVERRIDE;
+ virtual bool GetStripNullFromObjects() const OVERRIDE;
virtual void SetStripNullFromObjects(bool val) OVERRIDE;
virtual v8::Handle<v8::Value> ToV8Value(
const base::Value* value,
@@ -54,14 +58,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 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, we will convet RegExp JavaScript objects to string.
+ bool regexp_allowed_;
// If true, undefined and null values are ignored when converting v8 objects
// into Values.