| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 109 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 110 return handleScope.Escape(templ); | 110 return handleScope.Escape(templ); |
| 111 } | 111 } |
| 112 | 112 |
| 113 bool V8TestInterfaceDoNotCheckConstants::hasInstance(v8::Handle<v8::Value> jsVal
ue, v8::Isolate* isolate) | 113 bool V8TestInterfaceDoNotCheckConstants::hasInstance(v8::Handle<v8::Value> jsVal
ue, v8::Isolate* isolate) |
| 114 { | 114 { |
| 115 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI
nfo, jsValue) | 115 return V8PerIsolateData::from(isolate)->hasInstanceInMainWorld(&wrapperTypeI
nfo, jsValue) |
| 116 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy
peInfo, jsValue); | 116 || V8PerIsolateData::from(isolate)->hasInstanceInNonMainWorld(&wrapperTy
peInfo, jsValue); |
| 117 } | 117 } |
| 118 | 118 |
| 119 TestInterfaceDoNotCheckConstants* V8TestInterfaceDoNotCheckConstants::toNativeWi
thTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value) |
| 120 { |
| 121 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje
ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) :
0; |
| 122 } |
| 123 |
| 119 v8::Handle<v8::Object> V8TestInterfaceDoNotCheckConstants::createWrapper(PassRef
Ptr<TestInterfaceDoNotCheckConstants> impl, v8::Handle<v8::Object> creationConte
xt, v8::Isolate* isolate) | 124 v8::Handle<v8::Object> V8TestInterfaceDoNotCheckConstants::createWrapper(PassRef
Ptr<TestInterfaceDoNotCheckConstants> impl, v8::Handle<v8::Object> creationConte
xt, v8::Isolate* isolate) |
| 120 { | 125 { |
| 121 ASSERT(impl); | 126 ASSERT(impl); |
| 122 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceDoNotCheckConstants>(im
pl.get(), isolate)); | 127 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceDoNotCheckConstants>(im
pl.get(), isolate)); |
| 123 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | 128 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { |
| 124 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | 129 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); |
| 125 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | 130 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have |
| 126 // the same object de-ref functions, though, so use that as the basis of
the check. | 131 // the same object de-ref functions, though, so use that as the basis of
the check. |
| 127 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); | 132 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); |
| 128 } | 133 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 141 fromInternalPointer(object)->deref(); | 146 fromInternalPointer(object)->deref(); |
| 142 } | 147 } |
| 143 | 148 |
| 144 template<> | 149 template<> |
| 145 v8::Handle<v8::Value> toV8NoInline(TestInterfaceDoNotCheckConstants* impl, v8::H
andle<v8::Object> creationContext, v8::Isolate* isolate) | 150 v8::Handle<v8::Value> toV8NoInline(TestInterfaceDoNotCheckConstants* impl, v8::H
andle<v8::Object> creationContext, v8::Isolate* isolate) |
| 146 { | 151 { |
| 147 return toV8(impl, creationContext, isolate); | 152 return toV8(impl, creationContext, isolate); |
| 148 } | 153 } |
| 149 | 154 |
| 150 } // namespace WebCore | 155 } // namespace WebCore |
| OLD | NEW |