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

Unified Diff: Source/bindings/core/v8/ScriptWrappable.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
« no previous file with comments | « no previous file | Source/core/dom/DOMArrayBuffer.cpp » ('j') | Source/core/dom/Node.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/ScriptWrappable.cpp
diff --git a/Source/bindings/core/v8/ScriptWrappable.cpp b/Source/bindings/core/v8/ScriptWrappable.cpp
index a2607fb76152f26c46a5d19b31e2c91fa85c92f4..7a30961f58cd8e260b443d4e8b1f2da8159517e6 100644
--- a/Source/bindings/core/v8/ScriptWrappable.cpp
+++ b/Source/bindings/core/v8/ScriptWrappable.cpp
@@ -51,6 +51,12 @@ v8::Local<v8::Object> ScriptWrappable::wrap(v8::Isolate* isolate, v8::Local<v8::
ASSERT(!DOMDataStore::containsWrapper(this, isolate));
v8::Local<v8::Object> wrapper = V8DOMWrapper::createWrapper(isolate, creationContext, wrapperTypeInfo, this);
+ // V8DOMWrapper::createWrapper 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;
if (UNLIKELY(wrapper.IsEmpty()))
return wrapper;
« no previous file with comments | « no previous file | Source/core/dom/DOMArrayBuffer.cpp » ('j') | Source/core/dom/Node.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698