Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Side by Side Diff: Source/bindings/tests/results/V8TestSpecialOperationsIdentifierRaisesException.cpp

Issue 163883006: Add context to generated named and indexed property operations. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Ugh. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
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* imp = V8TestSpecialOperation sIdentifierRaisesException::toNative(info.Holder()); 217 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation sIdentifierRaisesException::toNative(info.Holder());
218 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); 218 ExceptionState exceptionState(ExceptionState::IndexedGetterContext, "TestSpe cialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolate());
219 RefPtr<TestInterfaceEmpty> result = imp->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 (!result) 222 if (!result)
223 return; 223 return;
224 v8SetReturnValueFast(info, result.release(), imp); 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* imp = V8TestSpecialOperation sIdentifierRaisesException::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(ExceptionState::IndexedSetterContext, "TestSpe cialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolate());
239 bool result = imp->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* imp = V8TestSpecialOperation sIdentifierRaisesException::toNative(info.Holder()); 256 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation sIdentifierRaisesException::toNative(info.Holder());
257 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); 257 ExceptionState exceptionState(ExceptionState::IndexedDeletionContext, "TestS pecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolate());
258 DeleteResult result = imp->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()->HasRealNamedProperty(name)) 274 if (info.Holder()->HasRealNamedProperty(name))
275 return; 275 return;
276 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) 276 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
277 return; 277 return;
278 278
279 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation sIdentifierRaisesException::toNative(info.Holder()); 279 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation sIdentifierRaisesException::toNative(info.Holder());
280 AtomicString propertyName = toCoreAtomicString(name); 280 AtomicString propertyName = toCoreAtomicString(name);
281 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); 281 v8::String::Utf8Value namedProperty(name);
282 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolat e());
282 RefPtr<TestInterfaceEmpty> result = imp->namedItem(propertyName, exceptionSt ate); 283 RefPtr<TestInterfaceEmpty> result = imp->namedItem(propertyName, exceptionSt ate);
283 if (exceptionState.throwIfNeeded()) 284 if (exceptionState.throwIfNeeded())
284 return; 285 return;
285 if (!result) 286 if (!result)
286 return; 287 return;
287 v8SetReturnValueFast(info, result.release(), imp); 288 v8SetReturnValueFast(info, result.release(), imp);
288 } 289 }
289 290
290 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr opertyCallbackInfo<v8::Value>& info) 291 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr opertyCallbackInfo<v8::Value>& info)
291 { 292 {
292 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); 293 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
293 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertyGette r(name, info); 294 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertyGette r(name, info);
294 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 295 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
295 } 296 }
296 297
297 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) 298 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info)
298 { 299 {
299 if (info.Holder()->HasRealNamedProperty(name)) 300 if (info.Holder()->HasRealNamedProperty(name))
300 return; 301 return;
301 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) 302 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
302 return; 303 return;
303 304
304 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation sIdentifierRaisesException::toNative(info.Holder()); 305 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation sIdentifierRaisesException::toNative(info.Holder());
305 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name) ; 306 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name) ;
306 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyValue, jsVa lue); 307 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyValue, jsVa lue);
307 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); 308 v8::String::Utf8Value namedProperty(name);
309 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty, "TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolat e());
308 bool result = imp->setNamedItem(propertyName, propertyValue, exceptionState) ; 310 bool result = imp->setNamedItem(propertyName, propertyValue, exceptionState) ;
309 if (exceptionState.throwIfNeeded()) 311 if (exceptionState.throwIfNeeded())
310 return; 312 return;
311 if (!result) 313 if (!result)
312 return; 314 return;
313 v8SetReturnValue(info, jsValue); 315 v8SetReturnValue(info, jsValue);
314 } 316 }
315 317
316 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8 ::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) 318 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8 ::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info)
317 { 319 {
318 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); 320 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
319 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertySette r(name, jsValue, info); 321 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertySette r(name, jsValue, info);
320 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 322 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
321 } 323 }
322 324
323 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal lbackInfo<v8::Integer>& info) 325 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal lbackInfo<v8::Integer>& info)
324 { 326 {
325 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation sIdentifierRaisesException::toNative(info.Holder()); 327 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation sIdentifierRaisesException::toNative(info.Holder());
326 AtomicString propertyName = toCoreAtomicString(name); 328 AtomicString propertyName = toCoreAtomicString(name);
327 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); 329 v8::String::Utf8Value namedProperty(name);
330 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsolat e());
328 bool result = imp->namedPropertyQuery(propertyName, exceptionState); 331 bool result = imp->namedPropertyQuery(propertyName, exceptionState);
329 if (exceptionState.throwIfNeeded()) 332 if (exceptionState.throwIfNeeded())
330 return; 333 return;
331 if (!result) 334 if (!result)
332 return; 335 return;
333 v8SetReturnValueInt(info, v8::None); 336 v8SetReturnValueInt(info, v8::None);
334 } 337 }
335 338
336 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro pertyCallbackInfo<v8::Integer>& info) 339 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro pertyCallbackInfo<v8::Integer>& info)
337 { 340 {
338 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); 341 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
339 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertyQuery (name, info); 342 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertyQuery (name, info);
340 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 343 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
341 } 344 }
342 345
343 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyC allbackInfo<v8::Boolean>& info) 346 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyC allbackInfo<v8::Boolean>& info)
344 { 347 {
345 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation sIdentifierRaisesException::toNative(info.Holder()); 348 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation sIdentifierRaisesException::toNative(info.Holder());
346 AtomicString propertyName = toCoreAtomicString(name); 349 AtomicString propertyName = toCoreAtomicString(name);
347 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); 350 v8::String::Utf8Value namedProperty(name);
351 ExceptionState exceptionState(ExceptionState::DeletionContext, *namedPropert y, "TestSpecialOperationsIdentifierRaisesException", info.Holder(), info.GetIsol ate());
348 DeleteResult result = imp->deleteNamedItem(propertyName, exceptionState); 352 DeleteResult result = imp->deleteNamedItem(propertyName, exceptionState);
349 if (exceptionState.throwIfNeeded()) 353 if (exceptionState.throwIfNeeded())
350 return; 354 return;
351 if (result != DeleteUnknownProperty) 355 if (result != DeleteUnknownProperty)
352 return v8SetReturnValueBool(info, result == DeleteSuccess); 356 return v8SetReturnValueBool(info, result == DeleteSuccess);
353 } 357 }
354 358
355 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)
356 { 360 {
357 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); 361 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
358 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertyDelet er(name, info); 362 TestSpecialOperationsIdentifierRaisesExceptionV8Internal::namedPropertyDelet er(name, info);
359 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 363 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
360 } 364 }
361 365
362 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i nfo) 366 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i nfo)
363 { 367 {
364 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation sIdentifierRaisesException::toNative(info.Holder()); 368 TestSpecialOperationsIdentifierRaisesException* imp = V8TestSpecialOperation sIdentifierRaisesException::toNative(info.Holder());
365 Vector<String> names; 369 Vector<String> names;
366 ExceptionState exceptionState(info.Holder(), info.GetIsolate()); 370 ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestSpeci alOperationsIdentifierRaisesException", info.Holder(), info.GetIsolate());
367 imp->namedPropertyEnumerator(names, exceptionState); 371 imp->namedPropertyEnumerator(names, exceptionState);
368 if (exceptionState.throwIfNeeded()) 372 if (exceptionState.throwIfNeeded())
369 return; 373 return;
370 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 ());
371 for (size_t i = 0; i < names.size(); ++i) 375 for (size_t i = 0; i < names.size(); ++i)
372 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]));
373 v8SetReturnValue(info, v8names); 377 v8SetReturnValue(info, v8names);
374 } 378 }
375 379
376 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A rray>& info) 380 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A rray>& info)
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 fromInternalPointer(object)->deref(); 465 fromInternalPointer(object)->deref();
462 } 466 }
463 467
464 template<> 468 template<>
465 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsIdentifierRaisesExceptio n* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) 469 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsIdentifierRaisesExceptio n* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
466 { 470 {
467 return toV8(impl, creationContext, isolate); 471 return toV8(impl, creationContext, isolate);
468 } 472 }
469 473
470 } // namespace WebCore 474 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698