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

Unified Diff: Source/core/dom/DOMArrayBuffer.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/DOMArrayBuffer.cpp
diff --git a/Source/core/dom/DOMArrayBuffer.cpp b/Source/core/dom/DOMArrayBuffer.cpp
index 7556aec914f04a59e53453e910a26083e69f2a87..c0ee1e5143bad2f4ce4317604979f0cc9019e613 100644
--- a/Source/core/dom/DOMArrayBuffer.cpp
+++ b/Source/core/dom/DOMArrayBuffer.cpp
@@ -21,6 +21,12 @@ v8::Local<v8::Object> DOMArrayBuffer::wrap(v8::Isolate* isolate, v8::Local<v8::O
const WrapperTypeInfo* wrapperTypeInfo = this->wrapperTypeInfo();
v8::Local<v8::Object> wrapper = v8::ArrayBuffer::New(isolate, data(), byteLength());
+ // V8::ArrayBuffer::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