| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 181 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 182 return handleScope.Escape(templ); | 182 return handleScope.Escape(templ); |
| 183 } | 183 } |
| 184 | 184 |
| 185 bool V8TestSpecialOperationsOverrideBuiltins::hasInstance(v8::Handle<v8::Value>
jsValue, v8::Isolate* isolate) | 185 bool V8TestSpecialOperationsOverrideBuiltins::hasInstance(v8::Handle<v8::Value>
jsValue, v8::Isolate* isolate) |
| 186 { | 186 { |
| 187 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI
nfo, jsValue) | 187 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI
nfo, jsValue) |
| 188 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy
peInfo, jsValue); | 188 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy
peInfo, jsValue); |
| 189 } | 189 } |
| 190 | 190 |
| 191 TestSpecialOperationsOverrideBuiltins* V8TestSpecialOperationsOverrideBuiltins::
toNativeWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value) |
| 192 { |
| 193 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje
ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) :
0; |
| 194 } |
| 195 |
| 191 v8::Handle<v8::Object> V8TestSpecialOperationsOverrideBuiltins::createWrapper(Pa
ssRefPtr<TestSpecialOperationsOverrideBuiltins> impl, v8::Handle<v8::Object> cre
ationContext, v8::Isolate* isolate) | 196 v8::Handle<v8::Object> V8TestSpecialOperationsOverrideBuiltins::createWrapper(Pa
ssRefPtr<TestSpecialOperationsOverrideBuiltins> impl, v8::Handle<v8::Object> cre
ationContext, v8::Isolate* isolate) |
| 192 { | 197 { |
| 193 ASSERT(impl); | 198 ASSERT(impl); |
| 194 ASSERT(!DOMDataStore::containsWrapper<V8TestSpecialOperationsOverrideBuiltin
s>(impl.get(), isolate)); | 199 ASSERT(!DOMDataStore::containsWrapper<V8TestSpecialOperationsOverrideBuiltin
s>(impl.get(), isolate)); |
| 195 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 200 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
| 196 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 201 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
| 197 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | 202 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
| 198 // the same object de-ref functions, though, so use that as the basis of
the check. | 203 // the same object de-ref functions, though, so use that as the basis of
the check. |
| 199 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); | 204 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
| 200 } | 205 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 213 fromInternalPointer(object)->deref(); | 218 fromInternalPointer(object)->deref(); |
| 214 } | 219 } |
| 215 | 220 |
| 216 template<> | 221 template<> |
| 217 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsOverrideBuiltins* impl,
v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 222 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsOverrideBuiltins* impl,
v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 218 { | 223 { |
| 219 return toV8(impl, creationContext, isolate); | 224 return toV8(impl, creationContext, isolate); |
| 220 } | 225 } |
| 221 | 226 |
| 222 } // namespace WebCore | 227 } // namespace WebCore |
| OLD | NEW |