diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-16 21:57:37 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-16 21:57:37 +0000 |
commit | 217d956794a8a5fb28cf6de2232c07db3de1eb91 (patch) | |
tree | 7de12e48f93401ab723203c5ebfeccdfda95bab6 /content/renderer/v8_value_converter_impl.h | |
parent | 70d19da03e8edc5610bc5c8fff5cc1fbca5e37c8 (diff) | |
download | chromium_src-217d956794a8a5fb28cf6de2232c07db3de1eb91.zip chromium_src-217d956794a8a5fb28cf6de2232c07db3de1eb91.tar.gz chromium_src-217d956794a8a5fb28cf6de2232c07db3de1eb91.tar.bz2 |
Revert 146891 - Revert 146852 - Forces V8ValueConverter to switch context when converting objects.
[The speculative revert was WRONG; test was just flaky.]
Objects passed into the V8ValueConverter may have fields that reference
objects in a v8::Context different than the one that was passed in.
This is very common for objects that were created in an isolated world and
reference globals in that world (such as window). This fix will check to see if
the current v8::Context is the same as the converting objects CreationContext().
If they are different, they will be swaped during the object's conversion.
In addition, the V8ValueConverter has been expanded to have the ability to omit duplicate
fileds in an object. This is very important when something with a graph structure (like a DOM
node) is converted.
Extra checks for integer/string fields have been added as in respone to Jakob's observation:
https://code.google.com/p/chromium/issues/detail?id=134661#c5
BUG=134661, 135104
TEST=content_unittests::V8ValueConverterImplTest.RecursiveObject
Review URL: https://chromiumcodereview.appspot.com/10704030
TBR=eaugusti@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10789024
TBR=erg@google.com
Review URL: https://chromiumcodereview.appspot.com/10794002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146903 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer/v8_value_converter_impl.h')
-rw-r--r-- | content/renderer/v8_value_converter_impl.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/content/renderer/v8_value_converter_impl.h b/content/renderer/v8_value_converter_impl.h index 7f75899..baf061a 100644 --- a/content/renderer/v8_value_converter_impl.h +++ b/content/renderer/v8_value_converter_impl.h @@ -5,6 +5,8 @@ #ifndef CONTENT_RENDERER_V8_VALUE_CONVERTER_IMPL_H_ #define CONTENT_RENDERER_V8_VALUE_CONVERTER_IMPL_H_ +#include <set> + #include "base/compiler_specific.h" #include "content/common/content_export.h" #include "content/public/renderer/v8_value_converter.h" @@ -43,15 +45,18 @@ class CONTENT_EXPORT V8ValueConverterImpl : public content::V8ValueConverter { const base::DictionaryValue* dictionary) const; v8::Handle<v8::Value> ToArrayBuffer(const base::BinaryValue* value) const; - base::Value* FromV8ValueImpl(v8::Handle<v8::Value> value) const; - base::ListValue* FromV8Array(v8::Handle<v8::Array> array) const; + base::Value* FromV8ValueImpl(v8::Handle<v8::Value> value, + std::set<int>* unique_set) const; + base::Value* FromV8Array(v8::Handle<v8::Array> array, + std::set<int>* unique_set) const; // This will convert objects of type ArrayBuffer or any of the // ArrayBufferView subclasses. The return value will be NULL if |value| is // not one of these types. base::BinaryValue* FromV8Buffer(v8::Handle<v8::Value> value) const; - base::DictionaryValue* FromV8Object(v8::Handle<v8::Object> object) const; + 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_; |