| 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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 477 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 478 return handleScope.Escape(templ); | 478 return handleScope.Escape(templ); |
| 479 } | 479 } |
| 480 | 480 |
| 481 bool V8TestTypedefs::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* iso
late) | 481 bool V8TestTypedefs::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* iso
late) |
| 482 { | 482 { |
| 483 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI
nfo, jsValue) | 483 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI
nfo, jsValue) |
| 484 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy
peInfo, jsValue); | 484 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy
peInfo, jsValue); |
| 485 } | 485 } |
| 486 | 486 |
| 487 TestTypedefs* V8TestTypedefs::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Ha
ndle<v8::Value> value) |
| 488 { |
| 489 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje
ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) :
0; |
| 490 } |
| 491 |
| 487 v8::Handle<v8::Object> V8TestTypedefs::createWrapper(PassRefPtr<TestTypedefs> im
pl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 492 v8::Handle<v8::Object> V8TestTypedefs::createWrapper(PassRefPtr<TestTypedefs> im
pl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 488 { | 493 { |
| 489 ASSERT(impl); | 494 ASSERT(impl); |
| 490 ASSERT(!DOMDataStore::containsWrapper<V8TestTypedefs>(impl.get(), isolate)); | 495 ASSERT(!DOMDataStore::containsWrapper<V8TestTypedefs>(impl.get(), isolate)); |
| 491 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 496 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
| 492 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 497 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
| 493 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | 498 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
| 494 // the same object de-ref functions, though, so use that as the basis of
the check. | 499 // the same object de-ref functions, though, so use that as the basis of
the check. |
| 495 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); | 500 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
| 496 } | 501 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 509 fromInternalPointer(object)->deref(); | 514 fromInternalPointer(object)->deref(); |
| 510 } | 515 } |
| 511 | 516 |
| 512 template<> | 517 template<> |
| 513 v8::Handle<v8::Value> toV8NoInline(TestTypedefs* impl, v8::Handle<v8::Object> cr
eationContext, v8::Isolate* isolate) | 518 v8::Handle<v8::Value> toV8NoInline(TestTypedefs* impl, v8::Handle<v8::Object> cr
eationContext, v8::Isolate* isolate) |
| 514 { | 519 { |
| 515 return toV8(impl, creationContext, isolate); | 520 return toV8(impl, creationContext, isolate); |
| 516 } | 521 } |
| 517 | 522 |
| 518 } // namespace WebCore | 523 } // namespace WebCore |
| OLD | NEW |