Index: Source/bindings/v8/DOMDataStore.h |
diff --git a/Source/bindings/v8/DOMDataStore.h b/Source/bindings/v8/DOMDataStore.h |
index 78bc836647fc2e29ed58c6cbb76b20fbbd4ffdbb..fee10b7e1e40c488e8d5f2d654d5d9b6a3d86fd1 100644 |
--- a/Source/bindings/v8/DOMDataStore.h |
+++ b/Source/bindings/v8/DOMDataStore.h |
@@ -101,6 +101,20 @@ public: |
} |
template<typename V8T, typename T> |
+ static void setWrapperReferenceFrom(const v8::Persistent<v8::Object>& parent, T* child, v8::Isolate* isolate) |
+ { |
+ if (ScriptWrappable::wrapperCanBeStoredInObject(child) && !canExistInWorker(child)) { |
+ if (LIKELY(!DOMWrapperWorld::isolatedWorldsExist())) { |
+ UnsafePersistent<v8::Object> unsafePersistent = ScriptWrappable::getUnsafeWrapperFromObject(child); |
+ // Security: always guard against malicious tampering. |
+ RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(unsafePersistent.isEmpty() || unsafePersistent.value()->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex) == V8T::toInternalPointer(child)); |
+ unsafePersistent.setReferenceFrom(parent, isolate); |
+ } |
+ } |
+ current(isolate)->template setReferenceFrom<V8T>(parent, child, isolate); |
+ } |
+ |
+ template<typename V8T, typename T> |
static void setWrapper(T* object, v8::Handle<v8::Object> wrapper, v8::Isolate* isolate, const WrapperConfiguration& configuration) |
{ |
if (ScriptWrappable::wrapperCanBeStoredInObject(object) && !canExistInWorker(object)) { |
@@ -127,6 +141,16 @@ public: |
} |
template<typename V8T, typename T> |
+ inline void setReferenceFrom(const v8::Persistent<v8::Object>& parent, T* child, v8::Isolate* isolate) |
haraken
2013/10/16 04:46:38
hmm, the implementation of setReferenceFrom looks
haraken
2013/10/16 05:37:31
Discussed offline with kouhei-san. I understand th
|
+ { |
+ if (ScriptWrappable::wrapperCanBeStoredInObject(child) && m_type == MainWorld) { |
+ ScriptWrappable::getUnsafeWrapperFromObject(child).setReferenceFrom(parent, isolate); |
+ return; |
+ } |
+ m_wrapperMap.setReferenceFrom(parent, V8T::toInternalPointer(child), isolate); |
+ } |
+ |
+ template<typename V8T, typename T> |
inline bool setReturnValueFrom(v8::ReturnValue<v8::Value> returnValue, T* object) |
{ |
if (ScriptWrappable::wrapperCanBeStoredInObject(object) && m_type == MainWorld) |