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

Unified Diff: third_party/WebKit/Source/bindings/templates/interface.cpp

Issue 1993593003: binding: Check the type of property names in FooCallback instead of Foo. (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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/templates/interface.cpp
diff --git a/third_party/WebKit/Source/bindings/templates/interface.cpp b/third_party/WebKit/Source/bindings/templates/interface.cpp
index 932323f1dcaf0db75111af367d0b1a14328bf758..e0ca8512646fb09544c82d6e206f5ce0aafbb673 100644
--- a/third_party/WebKit/Source/bindings/templates/interface.cpp
+++ b/third_party/WebKit/Source/bindings/templates/interface.cpp
@@ -167,8 +167,6 @@ static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal
{% set getter = named_property_getter %}
static void namedPropertyGetter(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
- if (!name->IsString())
- return;
auto nameString = name.As<v8::String>();
{{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
AtomicString propertyName = toCoreAtomicString(nameString);
@@ -204,6 +202,8 @@ static void namedPropertyGetter(v8::Local<v8::Name> name, const v8::PropertyCall
{% set getter = named_property_getter %}
static void namedPropertyGetterCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
+ if (!name->IsString())
+ return;
{% if getter.is_custom %}
{{v8_class}}::namedPropertyGetterCustom(name, info);
{% else %}
@@ -222,8 +222,6 @@ static void namedPropertyGetterCallback(v8::Local<v8::Name> name, const v8::Prop
{% set setter = named_property_setter %}
static void namedPropertySetter(v8::Local<v8::Name> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
{
- if (!name->IsString())
- return;
auto nameString = name.As<v8::String>();
{% if setter.has_exception_state %}
v8::String::Utf8Value namedProperty(nameString);
@@ -275,6 +273,8 @@ static void namedPropertySetter(v8::Local<v8::Name> name, v8::Local<v8::Value> v
{% set setter = named_property_setter %}
static void namedPropertySetterCallback(v8::Local<v8::Name> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
{
+ if (!name->IsString())
+ return;
{% if setter.is_custom %}
{{v8_class}}::namedPropertySetterCustom(name, v8Value, info);
{% else %}
@@ -295,8 +295,6 @@ static void namedPropertySetterCallback(v8::Local<v8::Name> name, v8::Local<v8::
communicate property attributes. #}
static void namedPropertyQuery(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Integer>& info)
{
- if (!name->IsString())
- return;
{{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
AtomicString propertyName = toCoreAtomicString(name.As<v8::String>());
v8::String::Utf8Value namedProperty(name);
@@ -324,6 +322,8 @@ static void namedPropertyQuery(v8::Local<v8::Name> name, const v8::PropertyCallb
{% set getter = named_property_getter %}
static void namedPropertyQueryCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Integer>& info)
{
+ if (!name->IsString())
+ return;
{% if getter.is_custom_property_query %}
{{v8_class}}::namedPropertyQueryCustom(name, info);
{% else %}
@@ -341,8 +341,6 @@ static void namedPropertyQueryCallback(v8::Local<v8::Name> name, const v8::Prope
{% set deleter = named_property_deleter %}
static void namedPropertyDeleter(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Boolean>& info)
{
- if (!name->IsString())
- return;
{{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
AtomicString propertyName = toCoreAtomicString(name.As<v8::String>());
{% if deleter.is_raises_exception %}
@@ -379,6 +377,8 @@ static void namedPropertyDeleter(v8::Local<v8::Name> name, const v8::PropertyCal
{% set deleter = named_property_deleter %}
static void namedPropertyDeleterCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Boolean>& info)
{
+ if (!name->IsString())
+ return;
{% if deleter.is_custom %}
{{v8_class}}::namedPropertyDeleterCustom(name, info);
{% else %}

Powered by Google App Engine
This is Rietveld 408576698