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

Side by Side Diff: third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface2.cpp

Issue 1967453002: Always check that a Name is a String before converting it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
6 6
7 #include "V8TestInterface2.h" 7 #include "V8TestInterface2.h"
8 8
9 #include "bindings/core/v8/ExceptionState.h" 9 #include "bindings/core/v8/ExceptionState.h"
10 #include "bindings/core/v8/ScriptState.h" 10 #include "bindings/core/v8/ScriptState.h"
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 return v8SetReturnValueBool(info, result == DeleteSuccess); 441 return v8SetReturnValueBool(info, result == DeleteSuccess);
442 } 442 }
443 443
444 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal lbackInfo<v8::Boolean>& info) 444 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal lbackInfo<v8::Boolean>& info)
445 { 445 {
446 TestInterface2V8Internal::indexedPropertyDeleter(index, info); 446 TestInterface2V8Internal::indexedPropertyDeleter(index, info);
447 } 447 }
448 448
449 static void namedPropertyGetter(v8::Local<v8::Name> name, const v8::PropertyCall backInfo<v8::Value>& info) 449 static void namedPropertyGetter(v8::Local<v8::Name> name, const v8::PropertyCall backInfo<v8::Value>& info)
450 { 450 {
451 if (!name->IsString())
452 return;
451 auto nameString = name.As<v8::String>(); 453 auto nameString = name.As<v8::String>();
452 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); 454 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
453 AtomicString propertyName = toCoreAtomicString(nameString); 455 AtomicString propertyName = toCoreAtomicString(nameString);
454 v8::String::Utf8Value namedProperty(nameString); 456 v8::String::Utf8Value namedProperty(nameString);
455 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestInterface2", info.Holder(), info.GetIsolate()); 457 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestInterface2", info.Holder(), info.GetIsolate());
456 TestInterfaceEmpty* result = impl->namedItem(propertyName, exceptionState); 458 TestInterfaceEmpty* result = impl->namedItem(propertyName, exceptionState);
457 if (exceptionState.throwIfNeeded()) 459 if (exceptionState.throwIfNeeded())
458 return; 460 return;
459 if (!result) 461 if (!result)
460 return; 462 return;
461 v8SetReturnValueFast(info, result, impl); 463 v8SetReturnValueFast(info, result, impl);
462 } 464 }
463 465
464 static void namedPropertyGetterCallback(v8::Local<v8::Name> name, const v8::Prop ertyCallbackInfo<v8::Value>& info) 466 static void namedPropertyGetterCallback(v8::Local<v8::Name> name, const v8::Prop ertyCallbackInfo<v8::Value>& info)
465 { 467 {
466 TestInterface2V8Internal::namedPropertyGetter(name, info); 468 TestInterface2V8Internal::namedPropertyGetter(name, info);
467 } 469 }
468 470
469 static void namedPropertySetter(v8::Local<v8::Name> name, v8::Local<v8::Value> v 8Value, const v8::PropertyCallbackInfo<v8::Value>& info) 471 static void namedPropertySetter(v8::Local<v8::Name> name, v8::Local<v8::Value> v 8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
470 { 472 {
473 if (!name->IsString())
474 return;
471 auto nameString = name.As<v8::String>(); 475 auto nameString = name.As<v8::String>();
472 v8::String::Utf8Value namedProperty(nameString); 476 v8::String::Utf8Value namedProperty(nameString);
473 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty, "TestInterface2", info.Holder(), info.GetIsolate()); 477 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty, "TestInterface2", info.Holder(), info.GetIsolate());
474 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); 478 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
475 V8StringResource<> propertyName(nameString); 479 V8StringResource<> propertyName(nameString);
476 if (!propertyName.prepare()) 480 if (!propertyName.prepare())
477 return; 481 return;
478 TestInterfaceEmpty* propertyValue = V8TestInterfaceEmpty::toImplWithTypeChec k(info.GetIsolate(), v8Value); 482 TestInterfaceEmpty* propertyValue = V8TestInterfaceEmpty::toImplWithTypeChec k(info.GetIsolate(), v8Value);
479 if (!propertyValue && !isUndefinedOrNull(v8Value)) { 483 if (!propertyValue && !isUndefinedOrNull(v8Value)) {
480 exceptionState.throwTypeError("The provided value is not of type 'TestIn terfaceEmpty'."); 484 exceptionState.throwTypeError("The provided value is not of type 'TestIn terfaceEmpty'.");
481 exceptionState.throwIfNeeded(); 485 exceptionState.throwIfNeeded();
482 return; 486 return;
483 } 487 }
484 bool result = impl->setNamedItem(propertyName, propertyValue, exceptionState ); 488 bool result = impl->setNamedItem(propertyName, propertyValue, exceptionState );
485 if (exceptionState.throwIfNeeded()) 489 if (exceptionState.throwIfNeeded())
486 return; 490 return;
487 if (!result) 491 if (!result)
488 return; 492 return;
489 v8SetReturnValue(info, v8Value); 493 v8SetReturnValue(info, v8Value);
490 } 494 }
491 495
492 static void namedPropertySetterCallback(v8::Local<v8::Name> name, v8::Local<v8:: Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) 496 static void namedPropertySetterCallback(v8::Local<v8::Name> name, v8::Local<v8:: Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
493 { 497 {
494 TestInterface2V8Internal::namedPropertySetter(name, v8Value, info); 498 TestInterface2V8Internal::namedPropertySetter(name, v8Value, info);
495 } 499 }
496 500
497 static void namedPropertyQuery(v8::Local<v8::Name> name, const v8::PropertyCallb ackInfo<v8::Integer>& info) 501 static void namedPropertyQuery(v8::Local<v8::Name> name, const v8::PropertyCallb ackInfo<v8::Integer>& info)
498 { 502 {
503 if (!name->IsString())
504 return;
499 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); 505 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
500 AtomicString propertyName = toCoreAtomicString(name.As<v8::String>()); 506 AtomicString propertyName = toCoreAtomicString(name.As<v8::String>());
501 v8::String::Utf8Value namedProperty(name); 507 v8::String::Utf8Value namedProperty(name);
502 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestInterface2", info.Holder(), info.GetIsolate()); 508 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestInterface2", info.Holder(), info.GetIsolate());
503 bool result = impl->namedPropertyQuery(propertyName, exceptionState); 509 bool result = impl->namedPropertyQuery(propertyName, exceptionState);
504 if (exceptionState.throwIfNeeded()) 510 if (exceptionState.throwIfNeeded())
505 return; 511 return;
506 if (!result) 512 if (!result)
507 return; 513 return;
508 v8SetReturnValueInt(info, v8::None); 514 v8SetReturnValueInt(info, v8::None);
509 } 515 }
510 516
511 static void namedPropertyQueryCallback(v8::Local<v8::Name> name, const v8::Prope rtyCallbackInfo<v8::Integer>& info) 517 static void namedPropertyQueryCallback(v8::Local<v8::Name> name, const v8::Prope rtyCallbackInfo<v8::Integer>& info)
512 { 518 {
513 TestInterface2V8Internal::namedPropertyQuery(name, info); 519 TestInterface2V8Internal::namedPropertyQuery(name, info);
514 } 520 }
515 521
516 static void namedPropertyDeleter(v8::Local<v8::Name> name, const v8::PropertyCal lbackInfo<v8::Boolean>& info) 522 static void namedPropertyDeleter(v8::Local<v8::Name> name, const v8::PropertyCal lbackInfo<v8::Boolean>& info)
517 { 523 {
524 if (!name->IsString())
525 return;
518 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder()); 526 TestInterface2* impl = V8TestInterface2::toImpl(info.Holder());
519 AtomicString propertyName = toCoreAtomicString(name.As<v8::String>()); 527 AtomicString propertyName = toCoreAtomicString(name.As<v8::String>());
520 v8::String::Utf8Value namedProperty(name); 528 v8::String::Utf8Value namedProperty(name);
521 ExceptionState exceptionState(ExceptionState::DeletionContext, *namedPropert y, "TestInterface2", info.Holder(), info.GetIsolate()); 529 ExceptionState exceptionState(ExceptionState::DeletionContext, *namedPropert y, "TestInterface2", info.Holder(), info.GetIsolate());
522 DeleteResult result = impl->deleteNamedItem(propertyName, exceptionState); 530 DeleteResult result = impl->deleteNamedItem(propertyName, exceptionState);
523 if (exceptionState.throwIfNeeded()) 531 if (exceptionState.throwIfNeeded())
524 return; 532 return;
525 if (result != DeleteUnknownProperty) 533 if (result != DeleteUnknownProperty)
526 return v8SetReturnValueBool(info, result == DeleteSuccess); 534 return v8SetReturnValueBool(info, result == DeleteSuccess);
527 } 535 }
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 InstallTemplateFunction V8TestInterface2::installV8TestInterface2TemplateFunctio n = (InstallTemplateFunction)&V8TestInterface2::installV8TestInterface2Template; 664 InstallTemplateFunction V8TestInterface2::installV8TestInterface2TemplateFunctio n = (InstallTemplateFunction)&V8TestInterface2::installV8TestInterface2Template;
657 665
658 void V8TestInterface2::updateWrapperTypeInfo(InstallTemplateFunction installTemp lateFunction, PreparePrototypeAndInterfaceObjectFunction preparePrototypeAndInte rfaceObjectFunction) 666 void V8TestInterface2::updateWrapperTypeInfo(InstallTemplateFunction installTemp lateFunction, PreparePrototypeAndInterfaceObjectFunction preparePrototypeAndInte rfaceObjectFunction)
659 { 667 {
660 V8TestInterface2::installV8TestInterface2TemplateFunction = installTemplateF unction; 668 V8TestInterface2::installV8TestInterface2TemplateFunction = installTemplateF unction;
661 if (preparePrototypeAndInterfaceObjectFunction) 669 if (preparePrototypeAndInterfaceObjectFunction)
662 V8TestInterface2::wrapperTypeInfo.preparePrototypeAndInterfaceObjectFunc tion = preparePrototypeAndInterfaceObjectFunction; 670 V8TestInterface2::wrapperTypeInfo.preparePrototypeAndInterfaceObjectFunc tion = preparePrototypeAndInterfaceObjectFunction;
663 } 671 }
664 672
665 } // namespace blink 673 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698