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

Unified Diff: Source/core/dom/DOMTypedArray.cpp

Issue 1210083004: bindings: Supports reentrance to ScriptWrappable::wrap through V8DOMWrapper::createWrapper. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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
Index: Source/core/dom/DOMTypedArray.cpp
diff --git a/Source/core/dom/DOMTypedArray.cpp b/Source/core/dom/DOMTypedArray.cpp
index c5d5e327d018c255fc63682c4ee9b7566ddf929b..e969a3ac90129eeaf320276d672a4d7e891fe41d 100644
--- a/Source/core/dom/DOMTypedArray.cpp
+++ b/Source/core/dom/DOMTypedArray.cpp
@@ -38,6 +38,12 @@ v8::Local<v8::Object> DOMTypedArray<WTFTypedArray, V8TypedArray>::wrap(v8::Isola
ASSERT(v8Buffer->IsArrayBuffer());
v8::Local<v8::Object> wrapper = V8TypedArray::New(v8Buffer.As<v8::ArrayBuffer>(), byteOffset(), length());
+ // V8TypedArray::New may run an arbitrary script and it may result in
+ // creating a new wrapper and associating it with |this|. If so, the
+ // wrapper already created and associated must be used.
+ v8::Local<v8::Object> associatedWrapper = DOMDataStore::getWrapper(this, isolate);
+ if (UNLIKELY(!associatedWrapper.IsEmpty()))
+ return associatedWrapper;
return associateWithWrapper(isolate, wrapperTypeInfo, wrapper);
}

Powered by Google App Engine
This is Rietveld 408576698