| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! | |
| 6 | |
| 7 #include "config.h" | |
| 8 #include "V8TestSpecialOperationsIdentifierRaisesException.h" | |
| 9 | |
| 10 #include "RuntimeEnabledFeatures.h" | |
| 11 #include "V8TestInterfaceEmpty.h" | |
| 12 #include "bindings/v8/ExceptionState.h" | |
| 13 #include "bindings/v8/V8DOMConfiguration.h" | |
| 14 #include "bindings/v8/V8HiddenValue.h" | |
| 15 #include "bindings/v8/V8ObjectConstructor.h" | |
| 16 #include "core/dom/ContextFeatures.h" | |
| 17 #include "core/dom/Document.h" | |
| 18 #include "platform/TraceEvent.h" | |
| 19 #include "wtf/GetPtr.h" | |
| 20 #include "wtf/RefPtr.h" | |
| 21 | |
| 22 namespace WebCore { | |
| 23 | |
| 24 static void initializeScriptWrappableForInterface(TestSpecialOperationsIdentifie
rRaisesException* object) | |
| 25 { | |
| 26 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | |
| 27 ScriptWrappable::setTypeInfoInObject(object, &V8TestSpecialOperationsIde
ntifierRaisesException::wrapperTypeInfo); | |
| 28 else | |
| 29 ASSERT_NOT_REACHED(); | |
| 30 } | |
| 31 | |
| 32 } // namespace WebCore | |
| 33 | |
| 34 void webCoreInitializeScriptWrappableForInterface(WebCore::TestSpecialOperations
IdentifierRaisesException* object) | |
| 35 { | |
| 36 WebCore::initializeScriptWrappableForInterface(object); | |
| 37 } | |
| 38 | |
| 39 namespace WebCore { | |
| 40 const WrapperTypeInfo V8TestSpecialOperationsIdentifierRaisesException::wrapperT
ypeInfo = { gin::kEmbedderBlink, V8TestSpecialOperationsIdentifierRaisesExceptio
n::domTemplate, V8TestSpecialOperationsIdentifierRaisesException::derefObject, 0
, 0, 0, V8TestSpecialOperationsIdentifierRaisesException::installPerContextEnabl
edMethods, 0, WrapperTypeObjectPrototype, false }; | |
| 41 | |
| 42 namespace TestSpecialOperationsIdentifierRaisesExceptionV8Internal { | |
| 43 | |
| 44 template <typename T> void V8_USE(T) { } | |
| 45 | |
| 46 static void itemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 47 { | |
| 48 ExceptionState exceptionState(ExceptionState::ExecutionContext, "item", "Tes
tSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolate()); | |
| 49 if (UNLIKELY(info.Length() < 1)) { | |
| 50 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i
nfo.Length())); | |
| 51 exceptionState.throwIfNeeded(); | |
| 52 return; | |
| 53 } | |
| 54 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio
nsIdentifierRaisesException::toNative(info.Holder()); | |
| 55 V8TRYCATCH_EXCEPTION_VOID(unsigned, index, toUInt32(info[0], exceptionState)
, exceptionState); | |
| 56 RefPtr<TestInterfaceEmpty> result = impl->item(index, exceptionState); | |
| 57 if (exceptionState.throwIfNeeded()) | |
| 58 return; | |
| 59 v8SetReturnValue(info, result.release()); | |
| 60 } | |
| 61 | |
| 62 static void itemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 63 { | |
| 64 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | |
| 65 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::itemMethod(info); | |
| 66 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
| 67 } | |
| 68 | |
| 69 static void setItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 70 { | |
| 71 ExceptionState exceptionState(ExceptionState::ExecutionContext, "setItem", "
TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolate(
)); | |
| 72 if (UNLIKELY(info.Length() < 2)) { | |
| 73 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i
nfo.Length())); | |
| 74 exceptionState.throwIfNeeded(); | |
| 75 return; | |
| 76 } | |
| 77 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio
nsIdentifierRaisesException::toNative(info.Holder()); | |
| 78 V8TRYCATCH_EXCEPTION_VOID(unsigned, index, toUInt32(info[0], exceptionState)
, exceptionState); | |
| 79 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, value, info[1]); | |
| 80 String result = impl->setItem(index, value, exceptionState); | |
| 81 if (exceptionState.throwIfNeeded()) | |
| 82 return; | |
| 83 v8SetReturnValueString(info, result, info.GetIsolate()); | |
| 84 } | |
| 85 | |
| 86 static void setItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& inf
o) | |
| 87 { | |
| 88 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | |
| 89 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::setItemMethod(info
); | |
| 90 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
| 91 } | |
| 92 | |
| 93 static void deleteItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 94 { | |
| 95 ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteItem"
, "TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsola
te()); | |
| 96 if (UNLIKELY(info.Length() < 1)) { | |
| 97 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i
nfo.Length())); | |
| 98 exceptionState.throwIfNeeded(); | |
| 99 return; | |
| 100 } | |
| 101 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio
nsIdentifierRaisesException::toNative(info.Holder()); | |
| 102 V8TRYCATCH_EXCEPTION_VOID(unsigned, index, toUInt32(info[0], exceptionState)
, exceptionState); | |
| 103 bool result = impl->deleteItem(index, exceptionState); | |
| 104 if (exceptionState.throwIfNeeded()) | |
| 105 return; | |
| 106 v8SetReturnValueBool(info, result); | |
| 107 } | |
| 108 | |
| 109 static void deleteItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>&
info) | |
| 110 { | |
| 111 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | |
| 112 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::deleteItemMethod(i
nfo); | |
| 113 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
| 114 } | |
| 115 | |
| 116 static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 117 { | |
| 118 ExceptionState exceptionState(ExceptionState::ExecutionContext, "namedItem",
"TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolat
e()); | |
| 119 if (UNLIKELY(info.Length() < 1)) { | |
| 120 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i
nfo.Length())); | |
| 121 exceptionState.throwIfNeeded(); | |
| 122 return; | |
| 123 } | |
| 124 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio
nsIdentifierRaisesException::toNative(info.Holder()); | |
| 125 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]); | |
| 126 RefPtr<TestInterfaceEmpty> result = impl->namedItem(name, exceptionState); | |
| 127 if (exceptionState.throwIfNeeded()) | |
| 128 return; | |
| 129 v8SetReturnValue(info, result.release()); | |
| 130 } | |
| 131 | |
| 132 static void namedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i
nfo) | |
| 133 { | |
| 134 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | |
| 135 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedItemMethod(in
fo); | |
| 136 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
| 137 } | |
| 138 | |
| 139 static void setNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info) | |
| 140 { | |
| 141 ExceptionState exceptionState(ExceptionState::ExecutionContext, "setNamedIte
m", "TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIso
late()); | |
| 142 if (UNLIKELY(info.Length() < 2)) { | |
| 143 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i
nfo.Length())); | |
| 144 exceptionState.throwIfNeeded(); | |
| 145 return; | |
| 146 } | |
| 147 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio
nsIdentifierRaisesException::toNative(info.Holder()); | |
| 148 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]); | |
| 149 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, value, info[1]); | |
| 150 String result = impl->setNamedItem(name, value, exceptionState); | |
| 151 if (exceptionState.throwIfNeeded()) | |
| 152 return; | |
| 153 v8SetReturnValueString(info, result, info.GetIsolate()); | |
| 154 } | |
| 155 | |
| 156 static void setNamedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>
& info) | |
| 157 { | |
| 158 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | |
| 159 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::setNamedItemMethod
(info); | |
| 160 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
| 161 } | |
| 162 | |
| 163 static void deleteNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& inf
o) | |
| 164 { | |
| 165 ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteNamed
Item", "TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.Get
Isolate()); | |
| 166 if (UNLIKELY(info.Length() < 1)) { | |
| 167 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i
nfo.Length())); | |
| 168 exceptionState.throwIfNeeded(); | |
| 169 return; | |
| 170 } | |
| 171 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio
nsIdentifierRaisesException::toNative(info.Holder()); | |
| 172 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]); | |
| 173 bool result = impl->deleteNamedItem(name, exceptionState); | |
| 174 if (exceptionState.throwIfNeeded()) | |
| 175 return; | |
| 176 v8SetReturnValueBool(info, result); | |
| 177 } | |
| 178 | |
| 179 static void deleteNamedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Val
ue>& info) | |
| 180 { | |
| 181 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | |
| 182 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::deleteNamedItemMet
hod(info); | |
| 183 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
| 184 } | |
| 185 | |
| 186 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo
<v8::Value>& info) | |
| 187 { | |
| 188 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio
nsIdentifierRaisesException::toNative(info.Holder()); | |
| 189 ExceptionState exceptionState(ExceptionState::IndexedGetterContext, "TestSpe
cialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolate()); | |
| 190 RefPtr<TestInterfaceEmpty> result = impl->item(index, exceptionState); | |
| 191 if (exceptionState.throwIfNeeded()) | |
| 192 return; | |
| 193 if (!result) | |
| 194 return; | |
| 195 v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl); | |
| 196 } | |
| 197 | |
| 198 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCall
backInfo<v8::Value>& info) | |
| 199 { | |
| 200 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); | |
| 201 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::indexedPropertyGet
ter(index, info); | |
| 202 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
| 203 } | |
| 204 | |
| 205 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value,
const v8::PropertyCallbackInfo<v8::Value>& info) | |
| 206 { | |
| 207 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio
nsIdentifierRaisesException::toNative(info.Holder()); | |
| 208 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyValue, v8Va
lue); | |
| 209 ExceptionState exceptionState(ExceptionState::IndexedSetterContext, "TestSpe
cialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolate()); | |
| 210 bool result = impl->setItem(index, propertyValue, exceptionState); | |
| 211 if (exceptionState.throwIfNeeded()) | |
| 212 return; | |
| 213 if (!result) | |
| 214 return; | |
| 215 v8SetReturnValue(info, v8Value); | |
| 216 } | |
| 217 | |
| 218 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v
8Value, const v8::PropertyCallbackInfo<v8::Value>& info) | |
| 219 { | |
| 220 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); | |
| 221 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::indexedPropertySet
ter(index, v8Value, info); | |
| 222 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
| 223 } | |
| 224 | |
| 225 static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInf
o<v8::Boolean>& info) | |
| 226 { | |
| 227 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio
nsIdentifierRaisesException::toNative(info.Holder()); | |
| 228 ExceptionState exceptionState(ExceptionState::IndexedDeletionContext, "TestS
pecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolate()); | |
| 229 DeleteResult result = impl->deleteItem(index, exceptionState); | |
| 230 if (exceptionState.throwIfNeeded()) | |
| 231 return; | |
| 232 if (result != DeleteUnknownProperty) | |
| 233 return v8SetReturnValueBool(info, result == DeleteSuccess); | |
| 234 } | |
| 235 | |
| 236 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal
lbackInfo<v8::Boolean>& info) | |
| 237 { | |
| 238 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); | |
| 239 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::indexedPropertyDel
eter(index, info); | |
| 240 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
| 241 } | |
| 242 | |
| 243 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa
llbackInfo<v8::Value>& info) | |
| 244 { | |
| 245 if (info.Holder()->HasRealNamedProperty(name)) | |
| 246 return; | |
| 247 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) | |
| 248 return; | |
| 249 | |
| 250 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio
nsIdentifierRaisesException::toNative(info.Holder()); | |
| 251 AtomicString propertyName = toCoreAtomicString(name); | |
| 252 v8::String::Utf8Value namedProperty(name); | |
| 253 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolat
e()); | |
| 254 RefPtr<TestInterfaceEmpty> result = impl->namedItem(propertyName, exceptionS
tate); | |
| 255 if (exceptionState.throwIfNeeded()) | |
| 256 return; | |
| 257 if (!result) | |
| 258 return; | |
| 259 v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl); | |
| 260 } | |
| 261 | |
| 262 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr
opertyCallbackInfo<v8::Value>& info) | |
| 263 { | |
| 264 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | |
| 265 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertyGette
r(name, info); | |
| 266 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
| 267 } | |
| 268 | |
| 269 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value>
v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) | |
| 270 { | |
| 271 if (info.Holder()->HasRealNamedProperty(name)) | |
| 272 return; | |
| 273 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) | |
| 274 return; | |
| 275 | |
| 276 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio
nsIdentifierRaisesException::toNative(info.Holder()); | |
| 277 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name)
; | |
| 278 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyValue, v8Va
lue); | |
| 279 v8::String::Utf8Value namedProperty(name); | |
| 280 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty,
"TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolat
e()); | |
| 281 bool result = impl->setNamedItem(propertyName, propertyValue, exceptionState
); | |
| 282 if (exceptionState.throwIfNeeded()) | |
| 283 return; | |
| 284 if (!result) | |
| 285 return; | |
| 286 v8SetReturnValue(info, v8Value); | |
| 287 } | |
| 288 | |
| 289 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8
::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) | |
| 290 { | |
| 291 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | |
| 292 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertySette
r(name, v8Value, info); | |
| 293 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
| 294 } | |
| 295 | |
| 296 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) | |
| 297 { | |
| 298 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio
nsIdentifierRaisesException::toNative(info.Holder()); | |
| 299 AtomicString propertyName = toCoreAtomicString(name); | |
| 300 v8::String::Utf8Value namedProperty(name); | |
| 301 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolat
e()); | |
| 302 bool result = impl->namedPropertyQuery(propertyName, exceptionState); | |
| 303 if (exceptionState.throwIfNeeded()) | |
| 304 return; | |
| 305 if (!result) | |
| 306 return; | |
| 307 v8SetReturnValueInt(info, v8::None); | |
| 308 } | |
| 309 | |
| 310 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) | |
| 311 { | |
| 312 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | |
| 313 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertyQuery
(name, info); | |
| 314 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
| 315 } | |
| 316 | |
| 317 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyC
allbackInfo<v8::Boolean>& info) | |
| 318 { | |
| 319 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio
nsIdentifierRaisesException::toNative(info.Holder()); | |
| 320 AtomicString propertyName = toCoreAtomicString(name); | |
| 321 v8::String::Utf8Value namedProperty(name); | |
| 322 ExceptionState exceptionState(ExceptionState::DeletionContext, *namedPropert
y, "TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsol
ate()); | |
| 323 DeleteResult result = impl->deleteNamedItem(propertyName, exceptionState); | |
| 324 if (exceptionState.throwIfNeeded()) | |
| 325 return; | |
| 326 if (result != DeleteUnknownProperty) | |
| 327 return v8SetReturnValueBool(info, result == DeleteSuccess); | |
| 328 } | |
| 329 | |
| 330 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::P
ropertyCallbackInfo<v8::Boolean>& info) | |
| 331 { | |
| 332 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | |
| 333 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertyDelet
er(name, info); | |
| 334 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
| 335 } | |
| 336 | |
| 337 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) | |
| 338 { | |
| 339 TestSpecialOperationsIdentifierRaisesException* impl = V8TestSpecialOperatio
nsIdentifierRaisesException::toNative(info.Holder()); | |
| 340 v8::Isolate* isolate = info.GetIsolate(); | |
| 341 Vector<String> names; | |
| 342 ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestSpeci
alOperationsIdentifierRaisesException", info.Holder(), isolate); | |
| 343 impl->namedPropertyEnumerator(names, exceptionState); | |
| 344 if (exceptionState.throwIfNeeded()) | |
| 345 return; | |
| 346 v8::Handle<v8::Array> v8names = v8::Array::New(isolate, names.size()); | |
| 347 for (size_t i = 0; i < names.size(); ++i) | |
| 348 v8names->Set(v8::Integer::New(isolate, i), v8String(isolate, names[i])); | |
| 349 v8SetReturnValue(info, v8names); | |
| 350 } | |
| 351 | |
| 352 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) | |
| 353 { | |
| 354 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | |
| 355 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertyEnume
rator(info); | |
| 356 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
| 357 } | |
| 358 | |
| 359 } // namespace TestSpecialOperationsIdentifierRaisesExceptionV8Internal | |
| 360 | |
| 361 static const V8DOMConfiguration::MethodConfiguration V8TestSpecialOperationsIden
tifierRaisesExceptionMethods[] = { | |
| 362 {"item", TestSpecialOperationsIdentifierRaisesExceptionV8Internal::itemMetho
dCallback, 0, 1}, | |
| 363 {"setItem", TestSpecialOperationsIdentifierRaisesExceptionV8Internal::setIte
mMethodCallback, 0, 2}, | |
| 364 {"deleteItem", TestSpecialOperationsIdentifierRaisesExceptionV8Internal::del
eteItemMethodCallback, 0, 1}, | |
| 365 {"namedItem", TestSpecialOperationsIdentifierRaisesExceptionV8Internal::name
dItemMethodCallback, 0, 1}, | |
| 366 {"setNamedItem", TestSpecialOperationsIdentifierRaisesExceptionV8Internal::s
etNamedItemMethodCallback, 0, 2}, | |
| 367 {"deleteNamedItem", TestSpecialOperationsIdentifierRaisesExceptionV8Internal
::deleteNamedItemMethodCallback, 0, 1}, | |
| 368 }; | |
| 369 | |
| 370 static void configureV8TestSpecialOperationsIdentifierRaisesExceptionTemplate(v8
::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate) | |
| 371 { | |
| 372 functionTemplate->ReadOnlyPrototype(); | |
| 373 | |
| 374 v8::Local<v8::Signature> defaultSignature; | |
| 375 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestSpecialOperationsIdentifierRaisesException", v8::Local<v8::FunctionTem
plate>(), V8TestSpecialOperationsIdentifierRaisesException::internalFieldCount, | |
| 376 0, 0, | |
| 377 0, 0, | |
| 378 V8TestSpecialOperationsIdentifierRaisesExceptionMethods, WTF_ARRAY_LENGT
H(V8TestSpecialOperationsIdentifierRaisesExceptionMethods), | |
| 379 isolate); | |
| 380 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | |
| 381 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | |
| 382 functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestSpecialO
perationsIdentifierRaisesExceptionV8Internal::indexedPropertyGetterCallback, Tes
tSpecialOperationsIdentifierRaisesExceptionV8Internal::indexedPropertySetterCall
back, 0, TestSpecialOperationsIdentifierRaisesExceptionV8Internal::indexedProper
tyDeleterCallback, indexedPropertyEnumerator<TestSpecialOperationsIdentifierRais
esException>); | |
| 383 functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestSpecialOpe
rationsIdentifierRaisesExceptionV8Internal::namedPropertyGetterCallback, TestSpe
cialOperationsIdentifierRaisesExceptionV8Internal::namedPropertySetterCallback,
TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertyQueryCall
back, TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertyDel
eterCallback, TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPro
pertyEnumeratorCallback); | |
| 384 | |
| 385 // Custom toString template | |
| 386 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); | |
| 387 } | |
| 388 | |
| 389 v8::Handle<v8::FunctionTemplate> V8TestSpecialOperationsIdentifierRaisesExceptio
n::domTemplate(v8::Isolate* isolate) | |
| 390 { | |
| 391 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | |
| 392 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(const_cas
t<WrapperTypeInfo*>(&wrapperTypeInfo)); | |
| 393 if (!result.IsEmpty()) | |
| 394 return result; | |
| 395 | |
| 396 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | |
| 397 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons
tructorMode); | |
| 398 configureV8TestSpecialOperationsIdentifierRaisesExceptionTemplate(result, is
olate); | |
| 399 data->setDOMTemplate(const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), result)
; | |
| 400 return result; | |
| 401 } | |
| 402 | |
| 403 bool V8TestSpecialOperationsIdentifierRaisesException::hasInstance(v8::Handle<v8
::Value> v8Value, v8::Isolate* isolate) | |
| 404 { | |
| 405 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu
e); | |
| 406 } | |
| 407 | |
| 408 v8::Handle<v8::Object> V8TestSpecialOperationsIdentifierRaisesException::findIns
tanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) | |
| 409 { | |
| 410 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe
rTypeInfo, v8Value); | |
| 411 } | |
| 412 | |
| 413 TestSpecialOperationsIdentifierRaisesException* V8TestSpecialOperationsIdentifie
rRaisesException::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Val
ue> value) | |
| 414 { | |
| 415 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje
ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) :
0; | |
| 416 } | |
| 417 | |
| 418 v8::Handle<v8::Object> V8TestSpecialOperationsIdentifierRaisesException::createW
rapper(PassRefPtr<TestSpecialOperationsIdentifierRaisesException> impl, v8::Hand
le<v8::Object> creationContext, v8::Isolate* isolate) | |
| 419 { | |
| 420 ASSERT(impl); | |
| 421 ASSERT(!DOMDataStore::containsWrapper<V8TestSpecialOperationsIdentifierRaise
sException>(impl.get(), isolate)); | |
| 422 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | |
| 423 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | |
| 424 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | |
| 425 // the same object de-ref functions, though, so use that as the basis of
the check. | |
| 426 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); | |
| 427 } | |
| 428 | |
| 429 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); | |
| 430 if (UNLIKELY(wrapper.IsEmpty())) | |
| 431 return wrapper; | |
| 432 | |
| 433 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | |
| 434 V8DOMWrapper::associateObjectWithWrapper<V8TestSpecialOperationsIdentifierRa
isesException>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::I
ndependent); | |
| 435 return wrapper; | |
| 436 } | |
| 437 | |
| 438 void V8TestSpecialOperationsIdentifierRaisesException::derefObject(void* object) | |
| 439 { | |
| 440 fromInternalPointer(object)->deref(); | |
| 441 } | |
| 442 | |
| 443 template<> | |
| 444 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsIdentifierRaisesExceptio
n* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) | |
| 445 { | |
| 446 return toV8(impl, creationContext, isolate); | |
| 447 } | |
| 448 | |
| 449 } // namespace WebCore | |
| OLD | NEW |