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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 207 |
208 static void deleteNamedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Val
ue>& info) | 208 static void deleteNamedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Val
ue>& info) |
209 { | 209 { |
210 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); | 210 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); |
211 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::deleteNamedItemMet
hod(info); | 211 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::deleteNamedItemMet
hod(info); |
212 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 212 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
213 } | 213 } |
214 | 214 |
215 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo
<v8::Value>& info) | 215 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo
<v8::Value>& info) |
216 { | 216 { |
217 TestSpecialOperationsIdentifierRaisesException* collection = V8TestSpecialOp
erationsIdentifierRaisesException::toNative(info.Holder()); | 217 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation
sIdentifierRaisesException::toNative(info.Holder()); |
218 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 218 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
219 RefPtr<TestInterfaceEmpty> element = collection->item(index, exceptionState)
; | 219 RefPtr<TestInterfaceEmpty> result = imp->item(index, exceptionState); |
220 if (exceptionState.throwIfNeeded()) | 220 if (exceptionState.throwIfNeeded()) |
221 return; | 221 return; |
222 if (!element) | 222 if (!result) |
223 return; | 223 return; |
224 v8SetReturnValueFast(info, element.release(), collection); | 224 v8SetReturnValueFast(info, result.release(), imp); |
225 } | 225 } |
226 | 226 |
227 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCall
backInfo<v8::Value>& info) | 227 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCall
backInfo<v8::Value>& info) |
228 { | 228 { |
229 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); | 229 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); |
230 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::indexedPropertyGet
ter(index, info); | 230 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::indexedPropertyGet
ter(index, info); |
231 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 231 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
232 } | 232 } |
233 | 233 |
234 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> jsValue,
const v8::PropertyCallbackInfo<v8::Value>& info) | 234 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> jsValue,
const v8::PropertyCallbackInfo<v8::Value>& info) |
235 { | 235 { |
236 TestSpecialOperationsIdentifierRaisesException* collection = V8TestSpecialOp
erationsIdentifierRaisesException::toNative(info.Holder()); | 236 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation
sIdentifierRaisesException::toNative(info.Holder()); |
237 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyValue, jsVa
lue); | 237 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyValue, jsVa
lue); |
238 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 238 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
239 bool result = collection->setItem(index, propertyValue, exceptionState); | 239 bool result = imp->setItem(index, propertyValue, exceptionState); |
240 if (exceptionState.throwIfNeeded()) | 240 if (exceptionState.throwIfNeeded()) |
241 return; | 241 return; |
242 if (!result) | 242 if (!result) |
243 return; | 243 return; |
244 v8SetReturnValue(info, jsValue); | 244 v8SetReturnValue(info, jsValue); |
245 } | 245 } |
246 | 246 |
247 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> j
sValue, const v8::PropertyCallbackInfo<v8::Value>& info) | 247 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> j
sValue, const v8::PropertyCallbackInfo<v8::Value>& info) |
248 { | 248 { |
249 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); | 249 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); |
250 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::indexedPropertySet
ter(index, jsValue, info); | 250 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::indexedPropertySet
ter(index, jsValue, info); |
251 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 251 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
252 } | 252 } |
253 | 253 |
254 static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInf
o<v8::Boolean>& info) | 254 static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInf
o<v8::Boolean>& info) |
255 { | 255 { |
256 TestSpecialOperationsIdentifierRaisesException* collection = V8TestSpecialOp
erationsIdentifierRaisesException::toNative(info.Holder()); | 256 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation
sIdentifierRaisesException::toNative(info.Holder()); |
257 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 257 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
258 DeleteResult result = collection->deleteItem(index, exceptionState); | 258 DeleteResult result = imp->deleteItem(index, exceptionState); |
259 if (exceptionState.throwIfNeeded()) | 259 if (exceptionState.throwIfNeeded()) |
260 return; | 260 return; |
261 if (result != DeleteUnknownProperty) | 261 if (result != DeleteUnknownProperty) |
262 return v8SetReturnValueBool(info, result == DeleteSuccess); | 262 return v8SetReturnValueBool(info, result == DeleteSuccess); |
263 } | 263 } |
264 | 264 |
265 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal
lbackInfo<v8::Boolean>& info) | 265 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal
lbackInfo<v8::Boolean>& info) |
266 { | 266 { |
267 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); | 267 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); |
268 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::indexedPropertyDel
eter(index, info); | 268 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::indexedPropertyDel
eter(index, info); |
269 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 269 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
270 } | 270 } |
271 | 271 |
272 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa
llbackInfo<v8::Value>& info) | 272 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa
llbackInfo<v8::Value>& info) |
273 { | 273 { |
274 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) | 274 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) |
275 return; | 275 return; |
276 if (info.Holder()->HasRealNamedCallbackProperty(name)) | 276 if (info.Holder()->HasRealNamedCallbackProperty(name)) |
277 return; | 277 return; |
278 if (info.Holder()->HasRealNamedProperty(name)) | 278 if (info.Holder()->HasRealNamedProperty(name)) |
279 return; | 279 return; |
280 | 280 |
281 TestSpecialOperationsIdentifierRaisesException* collection = V8TestSpecialOp
erationsIdentifierRaisesException::toNative(info.Holder()); | 281 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation
sIdentifierRaisesException::toNative(info.Holder()); |
282 AtomicString propertyName = toCoreAtomicString(name); | 282 AtomicString propertyName = toCoreAtomicString(name); |
283 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 283 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
284 RefPtr<TestInterfaceEmpty> element = collection->namedItem(propertyName, exc
eptionState); | 284 RefPtr<TestInterfaceEmpty> result = imp->namedItem(propertyName, exceptionSt
ate); |
285 if (exceptionState.throwIfNeeded()) | 285 if (exceptionState.throwIfNeeded()) |
286 return; | 286 return; |
287 if (!element) | 287 if (!result) |
288 return; | 288 return; |
289 v8SetReturnValueFast(info, element.release(), collection); | 289 v8SetReturnValueFast(info, result.release(), imp); |
290 } | 290 } |
291 | 291 |
292 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr
opertyCallbackInfo<v8::Value>& info) | 292 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr
opertyCallbackInfo<v8::Value>& info) |
293 { | 293 { |
294 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 294 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
295 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertyGette
r(name, info); | 295 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertyGette
r(name, info); |
296 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 296 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
297 } | 297 } |
298 | 298 |
299 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value>
jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) | 299 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value>
jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) |
300 { | 300 { |
301 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) | 301 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) |
302 return; | 302 return; |
303 if (info.Holder()->HasRealNamedCallbackProperty(name)) | 303 if (info.Holder()->HasRealNamedCallbackProperty(name)) |
304 return; | 304 return; |
305 if (info.Holder()->HasRealNamedProperty(name)) | 305 if (info.Holder()->HasRealNamedProperty(name)) |
306 return; | 306 return; |
307 | 307 |
308 TestSpecialOperationsIdentifierRaisesException* collection = V8TestSpecialOp
erationsIdentifierRaisesException::toNative(info.Holder()); | 308 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation
sIdentifierRaisesException::toNative(info.Holder()); |
309 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name)
; | 309 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name)
; |
310 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyValue, jsVa
lue); | 310 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyValue, jsVa
lue); |
311 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 311 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
312 bool result = collection->setNamedItem(propertyName, propertyValue, exceptio
nState); | 312 bool result = imp->setNamedItem(propertyName, propertyValue, exceptionState)
; |
313 if (exceptionState.throwIfNeeded()) | 313 if (exceptionState.throwIfNeeded()) |
314 return; | 314 return; |
315 if (!result) | 315 if (!result) |
316 return; | 316 return; |
317 v8SetReturnValue(info, jsValue); | 317 v8SetReturnValue(info, jsValue); |
318 } | 318 } |
319 | 319 |
320 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8
::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) | 320 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8
::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) |
321 { | 321 { |
322 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 322 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
323 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertySette
r(name, jsValue, info); | 323 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertySette
r(name, jsValue, info); |
324 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 324 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
325 } | 325 } |
326 | 326 |
327 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) | 327 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) |
328 { | 328 { |
329 TestSpecialOperationsIdentifierRaisesException* collection = V8TestSpecialOp
erationsIdentifierRaisesException::toNative(info.Holder()); | 329 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation
sIdentifierRaisesException::toNative(info.Holder()); |
330 AtomicString propertyName = toCoreAtomicString(name); | 330 AtomicString propertyName = toCoreAtomicString(name); |
331 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 331 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
332 bool result = collection->namedPropertyQuery(propertyName, exceptionState); | 332 bool result = imp->namedPropertyQuery(propertyName, exceptionState); |
333 if (exceptionState.throwIfNeeded()) | 333 if (exceptionState.throwIfNeeded()) |
334 return; | 334 return; |
335 if (!result) | 335 if (!result) |
336 return; | 336 return; |
337 v8SetReturnValueInt(info, v8::None); | 337 v8SetReturnValueInt(info, v8::None); |
338 } | 338 } |
339 | 339 |
340 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) | 340 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) |
341 { | 341 { |
342 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 342 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
343 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertyQuery
(name, info); | 343 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertyQuery
(name, info); |
344 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 344 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
345 } | 345 } |
346 | 346 |
347 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyC
allbackInfo<v8::Boolean>& info) | 347 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyC
allbackInfo<v8::Boolean>& info) |
348 { | 348 { |
349 TestSpecialOperationsIdentifierRaisesException* collection = V8TestSpecialOp
erationsIdentifierRaisesException::toNative(info.Holder()); | 349 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation
sIdentifierRaisesException::toNative(info.Holder()); |
350 AtomicString propertyName = toCoreAtomicString(name); | 350 AtomicString propertyName = toCoreAtomicString(name); |
351 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 351 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
352 DeleteResult result = collection->deleteNamedItem(propertyName, exceptionSta
te); | 352 DeleteResult result = imp->deleteNamedItem(propertyName, exceptionState); |
353 if (exceptionState.throwIfNeeded()) | 353 if (exceptionState.throwIfNeeded()) |
354 return; | 354 return; |
355 if (result != DeleteUnknownProperty) | 355 if (result != DeleteUnknownProperty) |
356 return v8SetReturnValueBool(info, result == DeleteSuccess); | 356 return v8SetReturnValueBool(info, result == DeleteSuccess); |
357 } | 357 } |
358 | 358 |
359 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::P
ropertyCallbackInfo<v8::Boolean>& info) | 359 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::P
ropertyCallbackInfo<v8::Boolean>& info) |
360 { | 360 { |
361 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | 361 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); |
362 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertyDelet
er(name, info); | 362 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertyDelet
er(name, info); |
363 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 363 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
364 } | 364 } |
365 | 365 |
366 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) | 366 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) |
367 { | 367 { |
368 TestSpecialOperationsIdentifierRaisesException* collection = V8TestSpecialOp
erationsIdentifierRaisesException::toNative(info.Holder()); | 368 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation
sIdentifierRaisesException::toNative(info.Holder()); |
369 Vector<String> names; | 369 Vector<String> names; |
370 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); | 370 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); |
371 collection->namedPropertyEnumerator(names, exceptionState); | 371 imp->namedPropertyEnumerator(names, exceptionState); |
372 if (exceptionState.throwIfNeeded()) | 372 if (exceptionState.throwIfNeeded()) |
373 return; | 373 return; |
374 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); | 374 v8::Handle<v8::Array> v8names = v8::Array::New(info.GetIsolate(), names.size
()); |
375 for (size_t i = 0; i < names.size(); ++i) | 375 for (size_t i = 0; i < names.size(); ++i) |
376 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs
olate(), names[i])); | 376 v8names->Set(v8::Integer::New(info.GetIsolate(), i), v8String(info.GetIs
olate(), names[i])); |
377 v8SetReturnValue(info, v8names); | 377 v8SetReturnValue(info, v8names); |
378 } | 378 } |
379 | 379 |
380 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) | 380 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) |
381 { | 381 { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 fromInternalPointer(object)->deref(); | 460 fromInternalPointer(object)->deref(); |
461 } | 461 } |
462 | 462 |
463 template<> | 463 template<> |
464 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsIdentifierRaisesExceptio
n* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 464 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsIdentifierRaisesExceptio
n* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
465 { | 465 { |
466 return toV8(impl, creationContext, isolate); | 466 return toV8(impl, creationContext, isolate); |
467 } | 467 } |
468 | 468 |
469 } // namespace WebCore | 469 } // namespace WebCore |
OLD | NEW |