Index: Source/bindings/v8/DOMDataStore.h |
diff --git a/Source/bindings/v8/DOMDataStore.h b/Source/bindings/v8/DOMDataStore.h |
index 78bc836647fc2e29ed58c6cbb76b20fbbd4ffdbb..2fc5d4f8851227d04a4d3718d8e93e25ec3e297b 100644 |
--- a/Source/bindings/v8/DOMDataStore.h |
+++ b/Source/bindings/v8/DOMDataStore.h |
@@ -101,6 +101,20 @@ public: |
} |
template<typename V8T, typename T> |
+ static UnsafePersistent<v8::Object> getWrapperPersistent(T* object, v8::Isolate* isolate) |
+ { |
+ if (ScriptWrappable::wrapperCanBeStoredInObject(object) && !canExistInWorker(object)) { |
+ if (LIKELY(!DOMWrapperWorld::isolatedWorldsExist())) { |
+ UnsafePersistent<v8::Object> unsafePersistent = ScriptWrappable::getUnsafeWrapperFromObject(object); |
+ // Security: always guard against malicious tampering. |
+ RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(unsafePersistent.isEmpty() || unsafePersistent.value()->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex) == V8T::toInternalPointer(object)); |
+ return unsafePersistent; |
+ } |
+ } |
+ return current(isolate)->template getPersistent<V8T>(object, 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,14 @@ public: |
} |
template<typename V8T, typename T> |
+ inline UnsafePersistent<v8::Object> getPersistent(T* object, v8::Isolate* isolate) |
+ { |
+ if (ScriptWrappable::wrapperCanBeStoredInObject(object) && m_type == MainWorld) |
+ return ScriptWrappable::getUnsafeWrapperFromObject(object); |
+ return m_wrapperMap.get(V8T::toInternalPointer(object)); |
+ } |
+ |
+ template<typename V8T, typename T> |
inline bool setReturnValueFrom(v8::ReturnValue<v8::Value> returnValue, T* object) |
{ |
if (ScriptWrappable::wrapperCanBeStoredInObject(object) && m_type == MainWorld) |