| 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 227 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 228 return handleScope.Escape(templ); | 228 return handleScope.Escape(templ); |
| 229 } | 229 } |
| 230 | 230 |
| 231 bool V8TestSpecialOperationsInt::hasInstance(v8::Handle<v8::Value> jsValue, v8::
Isolate* isolate) | 231 bool V8TestSpecialOperationsInt::hasInstance(v8::Handle<v8::Value> jsValue, v8::
Isolate* isolate) |
| 232 { | 232 { |
| 233 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI
nfo, jsValue) | 233 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI
nfo, jsValue) |
| 234 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy
peInfo, jsValue); | 234 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy
peInfo, jsValue); |
| 235 } | 235 } |
| 236 | 236 |
| 237 TestSpecialOperationsInt* V8TestSpecialOperationsInt::toNativeWithTypeCheck(v8::
Isolate* isolate, v8::Handle<v8::Value> value) |
| 238 { |
| 239 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje
ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) :
0; |
| 240 } |
| 241 |
| 237 v8::Handle<v8::Object> V8TestSpecialOperationsInt::createWrapper(PassRefPtr<Test
SpecialOperationsInt> impl, v8::Handle<v8::Object> creationContext, v8::Isolate*
isolate) | 242 v8::Handle<v8::Object> V8TestSpecialOperationsInt::createWrapper(PassRefPtr<Test
SpecialOperationsInt> impl, v8::Handle<v8::Object> creationContext, v8::Isolate*
isolate) |
| 238 { | 243 { |
| 239 ASSERT(impl); | 244 ASSERT(impl); |
| 240 ASSERT(!DOMDataStore::containsWrapper<V8TestSpecialOperationsInt>(impl.get()
, isolate)); | 245 ASSERT(!DOMDataStore::containsWrapper<V8TestSpecialOperationsInt>(impl.get()
, isolate)); |
| 241 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 246 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
| 242 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 247 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
| 243 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | 248 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
| 244 // the same object de-ref functions, though, so use that as the basis of
the check. | 249 // the same object de-ref functions, though, so use that as the basis of
the check. |
| 245 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); | 250 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
| 246 } | 251 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 259 fromInternalPointer(object)->deref(); | 264 fromInternalPointer(object)->deref(); |
| 260 } | 265 } |
| 261 | 266 |
| 262 template<> | 267 template<> |
| 263 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsInt* impl, v8::Handle<v8
::Object> creationContext, v8::Isolate* isolate) | 268 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsInt* impl, v8::Handle<v8
::Object> creationContext, v8::Isolate* isolate) |
| 264 { | 269 { |
| 265 return toV8(impl, creationContext, isolate); | 270 return toV8(impl, creationContext, isolate); |
| 266 } | 271 } |
| 267 | 272 |
| 268 } // namespace WebCore | 273 } // namespace WebCore |
| OLD | NEW |