OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperObjectIndex, 0); | 86 wrapper->SetAlignedPointerInInternalField(v8DOMWrapperObjectIndex, 0); |
87 } | 87 } |
88 | 88 |
89 inline v8::Local<v8::Object> V8DOMWrapper::associateObjectWithWrapper(v8::Isolat
e* isolate, ScriptWrappable* impl, const WrapperTypeInfo* wrapperTypeInfo, v8::L
ocal<v8::Object> wrapper) | 89 inline v8::Local<v8::Object> V8DOMWrapper::associateObjectWithWrapper(v8::Isolat
e* isolate, ScriptWrappable* impl, const WrapperTypeInfo* wrapperTypeInfo, v8::L
ocal<v8::Object> wrapper) |
90 { | 90 { |
91 if (DOMDataStore::setWrapper(isolate, impl, wrapperTypeInfo, wrapper)) { | 91 if (DOMDataStore::setWrapper(isolate, impl, wrapperTypeInfo, wrapper)) { |
92 wrapperTypeInfo->refObject(impl); | 92 wrapperTypeInfo->refObject(impl); |
93 setNativeInfo(wrapper, wrapperTypeInfo, impl); | 93 setNativeInfo(wrapper, wrapperTypeInfo, impl); |
94 ASSERT(hasInternalFieldsSet(wrapper)); | 94 ASSERT(hasInternalFieldsSet(wrapper)); |
95 } | 95 } |
96 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(toScriptWrappable(wrapper) == impl)
; | 96 SECURITY_CHECK(toScriptWrappable(wrapper) == impl); |
97 return wrapper; | 97 return wrapper; |
98 } | 98 } |
99 | 99 |
100 inline v8::Local<v8::Object> V8DOMWrapper::associateObjectWithWrapper(v8::Isolat
e* isolate, Node* node, const WrapperTypeInfo* wrapperTypeInfo, v8::Local<v8::Ob
ject> wrapper) | 100 inline v8::Local<v8::Object> V8DOMWrapper::associateObjectWithWrapper(v8::Isolat
e* isolate, Node* node, const WrapperTypeInfo* wrapperTypeInfo, v8::Local<v8::Ob
ject> wrapper) |
101 { | 101 { |
102 if (DOMDataStore::setWrapper(isolate, node, wrapperTypeInfo, wrapper)) { | 102 if (DOMDataStore::setWrapper(isolate, node, wrapperTypeInfo, wrapper)) { |
103 wrapperTypeInfo->refObject(ScriptWrappable::fromNode(node)); | 103 wrapperTypeInfo->refObject(ScriptWrappable::fromNode(node)); |
104 setNativeInfo(wrapper, wrapperTypeInfo, ScriptWrappable::fromNode(node))
; | 104 setNativeInfo(wrapper, wrapperTypeInfo, ScriptWrappable::fromNode(node))
; |
105 ASSERT(hasInternalFieldsSet(wrapper)); | 105 ASSERT(hasInternalFieldsSet(wrapper)); |
106 } | 106 } |
107 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(toScriptWrappable(wrapper) == Scrip
tWrappable::fromNode(node)); | 107 SECURITY_CHECK(toScriptWrappable(wrapper) == ScriptWrappable::fromNode(node)
); |
108 return wrapper; | 108 return wrapper; |
109 } | 109 } |
110 | 110 |
111 class V8WrapperInstantiationScope { | 111 class V8WrapperInstantiationScope { |
112 STACK_ALLOCATED(); | 112 STACK_ALLOCATED(); |
113 public: | 113 public: |
114 V8WrapperInstantiationScope(v8::Local<v8::Object> creationContext, v8::Isola
te* isolate, bool withSecurityCheck) | 114 V8WrapperInstantiationScope(v8::Local<v8::Object> creationContext, v8::Isola
te* isolate, bool withSecurityCheck) |
115 : m_didEnterContext(false) | 115 : m_didEnterContext(false) |
116 , m_context(isolate->GetCurrentContext()) | 116 , m_context(isolate->GetCurrentContext()) |
117 , m_tryCatch(isolate) | 117 , m_tryCatch(isolate) |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 162 |
163 bool m_didEnterContext; | 163 bool m_didEnterContext; |
164 v8::Local<v8::Context> m_context; | 164 v8::Local<v8::Context> m_context; |
165 v8::TryCatch m_tryCatch; | 165 v8::TryCatch m_tryCatch; |
166 bool m_convertExceptions; | 166 bool m_convertExceptions; |
167 }; | 167 }; |
168 | 168 |
169 } // namespace blink | 169 } // namespace blink |
170 | 170 |
171 #endif // V8DOMWrapper_h | 171 #endif // V8DOMWrapper_h |
OLD | NEW |