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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/ToV8.h

Issue 1924073003: Use correct creation context when converting sequences to V8 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/core/v8/ToV8.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/ToV8.h b/third_party/WebKit/Source/bindings/core/v8/ToV8.h
index 39ad5ddf5d831d4db8ed1707974769eb52a02703..3f4a97795b59ea2d00ceff072b9e83cefde0a52c 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ToV8.h
+++ b/third_party/WebKit/Source/bindings/core/v8/ToV8.h
@@ -198,11 +198,15 @@ inline v8::Local<v8::Value> toV8(const Dictionary& value, v8::Local<v8::Object>
template<typename Sequence>
inline v8::Local<v8::Value> toV8SequenceInternal(const Sequence& sequence, v8::Local<v8::Object> creationContext, v8::Isolate* isolate)
{
- v8::Local<v8::Array> array = v8::Array::New(isolate, sequence.size());
+ v8::Local<v8::Array> array;
+ {
+ v8::Context::Scope contextScope(creationContext->CreationContext());
+ array = v8::Array::New(isolate, sequence.size());
+ }
uint32_t index = 0;
typename Sequence::const_iterator end = sequence.end();
for (typename Sequence::const_iterator iter = sequence.begin(); iter != end; ++iter) {
- v8::Local<v8::Value> value = toV8(*iter, creationContext, isolate);
+ v8::Local<v8::Value> value = toV8(*iter, array, isolate);
if (value.IsEmpty())
value = v8::Undefined(isolate);
if (!v8CallBoolean(array->Set(isolate->GetCurrentContext(), v8::Integer::New(isolate, index++), value)))
@@ -226,9 +230,13 @@ inline v8::Local<v8::Value> toV8(const HeapVector<T, inlineCapacity>& value, v8:
template<typename T>
inline v8::Local<v8::Value> toV8(const Vector<std::pair<String, T>>& value, v8::Local<v8::Object> creationContext, v8::Isolate* isolate)
{
- v8::Local<v8::Object> object = v8::Object::New(isolate);
+ v8::Local<v8::Object> object;
+ {
+ v8::Context::Scope contextScope(creationContext->CreationContext());
+ object = v8::Object::New(isolate);
+ }
for (unsigned i = 0; i < value.size(); ++i) {
- v8::Local<v8::Value> v8Value = toV8(value[i].second, creationContext, isolate);
+ v8::Local<v8::Value> v8Value = toV8(value[i].second, object, isolate);
if (v8Value.IsEmpty())
v8Value = v8::Undefined(isolate);
if (!v8CallBoolean(object->Set(isolate->GetCurrentContext(), v8String(isolate, value[i].first), v8Value)))
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698