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

Side by Side Diff: Source/bindings/templates/interface.cpp

Issue 329223004: [DeprecateAs] if call addEventListener or removeEventListener without enough arguments Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Move ext attr to interface Created 6 years, 6 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 {% extends 'interface_base.cpp' %} 1 {% extends 'interface_base.cpp' %}
2 2
3 3
4 {##############################################################################} 4 {##############################################################################}
5 {% macro attribute_configuration(attribute) %} 5 {% macro attribute_configuration(attribute) %}
6 {% set getter_callback = 6 {% set getter_callback =
7 '%sV8Internal::%sAttributeGetterCallback' % 7 '%sV8Internal::%sAttributeGetterCallback' %
8 (cpp_class, attribute.name) 8 (cpp_class, attribute.name)
9 if not attribute.constructor_type else 9 if not attribute.constructor_type else
10 ('%sV8Internal::%sConstructorGetterCallback' % 10 ('%sV8Internal::%sConstructorGetterCallback' %
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 {% endif %} 77 {% endif %}
78 {% endblock %} 78 {% endblock %}
79 79
80 80
81 {##############################################################################} 81 {##############################################################################}
82 {% block replaceable_attribute_setter_and_callback %} 82 {% block replaceable_attribute_setter_and_callback %}
83 {% if has_replaceable_attributes or has_constructor_attributes %} 83 {% if has_replaceable_attributes or has_constructor_attributes %}
84 {# FIXME: rename to ForceSetAttributeOnThis, since also used for Constructors #} 84 {# FIXME: rename to ForceSetAttributeOnThis, since also used for Constructors #}
85 static void {{cpp_class}}ReplaceableAttributeSetter(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) 85 static void {{cpp_class}}ReplaceableAttributeSetter(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
86 { 86 {
87 {% if is_check_security %} 87 {% if is_check_security_for_frame %}
88 {{cpp_class}}* impl = {{v8_class}}::toNative(info.Holder()); 88 {{cpp_class}}* impl = {{v8_class}}::toNative(info.Holder());
89 v8::Isolate* isolate = info.GetIsolate(); 89 v8::Isolate* isolate = info.GetIsolate();
90 v8::String::Utf8Value attributeName(name); 90 v8::String::Utf8Value attributeName(name);
91 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName, "{{interface_name}}", info.Holder(), isolate); 91 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName, "{{interface_name}}", info.Holder(), isolate);
92 if (!BindingSecurity::shouldAllowAccessToFrame(isolate, impl->frame(), excep tionState)) { 92 if (!BindingSecurity::shouldAllowAccessToFrame(isolate, impl->frame(), excep tionState)) {
93 exceptionState.throwIfNeeded(); 93 exceptionState.throwIfNeeded();
94 return; 94 return;
95 } 95 }
96 {% endif %} 96 {% endif %}
97 if (info.This()->IsObject()) 97 if (info.This()->IsObject())
98 v8::Handle<v8::Object>::Cast(info.This())->ForceSet(name, v8Value); 98 v8::Handle<v8::Object>::Cast(info.This())->ForceSet(name, v8Value);
99 } 99 }
100 100
101 {# FIXME: rename to ForceSetAttributeOnThisCallback, since also used for Constru ctors #} 101 {# FIXME: rename to ForceSetAttributeOnThisCallback, since also used for Constru ctors #}
102 static void {{cpp_class}}ReplaceableAttributeSetterCallback(v8::Local<v8::String > name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info ) 102 static void {{cpp_class}}ReplaceableAttributeSetterCallback(v8::Local<v8::String > name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info )
103 { 103 {
104 {{cpp_class}}V8Internal::{{cpp_class}}ReplaceableAttributeSetter(name, v8Val ue, info); 104 {{cpp_class}}V8Internal::{{cpp_class}}ReplaceableAttributeSetter(name, v8Val ue, info);
105 } 105 }
106 106
107 {% endif %} 107 {% endif %}
108 {% endblock %} 108 {% endblock %}
109 109
110 110
111 {##############################################################################} 111 {##############################################################################}
112 {% block security_check_functions %} 112 {% block security_check_functions %}
113 {% if is_check_security and interface_name != 'Window' %} 113 {% if is_check_security_for_frame and interface_name != 'Window' %}
114 bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::Access Type type, v8::Local<v8::Value>) 114 bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::Access Type type, v8::Local<v8::Value>)
115 { 115 {
116 {{cpp_class}}* impl = {{v8_class}}::toNative(host); 116 {{cpp_class}}* impl = {{v8_class}}::toNative(host);
117 return BindingSecurity::shouldAllowAccessToFrame(v8::Isolate::GetCurrent(), impl->frame(), DoNotReportSecurityError); 117 return BindingSecurity::shouldAllowAccessToFrame(v8::Isolate::GetCurrent(), impl->frame(), DoNotReportSecurityError);
118 } 118 }
119 119
120 bool namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8 ::AccessType type, v8::Local<v8::Value>) 120 bool namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8 ::AccessType type, v8::Local<v8::Value>)
121 { 121 {
122 {{cpp_class}}* impl = {{v8_class}}::toNative(host); 122 {{cpp_class}}* impl = {{v8_class}}::toNative(host);
123 return BindingSecurity::shouldAllowAccessToFrame(v8::Isolate::GetCurrent(), impl->frame(), DoNotReportSecurityError); 123 return BindingSecurity::shouldAllowAccessToFrame(v8::Isolate::GetCurrent(), impl->frame(), DoNotReportSecurityError);
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 {{methods_name}}, {{methods_length}}, 911 {{methods_name}}, {{methods_length}},
912 isolate); 912 isolate);
913 {% endfilter %} 913 {% endfilter %}
914 914
915 {% if constructors or has_custom_constructor or has_event_constructor %} 915 {% if constructors or has_custom_constructor or has_event_constructor %}
916 functionTemplate->SetCallHandler({{v8_class}}::constructorCallback); 916 functionTemplate->SetCallHandler({{v8_class}}::constructorCallback);
917 functionTemplate->SetLength({{interface_length}}); 917 functionTemplate->SetLength({{interface_length}});
918 {% endif %} 918 {% endif %}
919 v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTempla te->InstanceTemplate(); 919 v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTempla te->InstanceTemplate();
920 v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTempl ate->PrototypeTemplate(); 920 v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTempl ate->PrototypeTemplate();
921 {% if is_check_security and interface_name != 'Window' %} 921 {% if is_check_security_for_frame and interface_name != 'Window' %}
922 instanceTemplate->SetAccessCheckCallbacks({{cpp_class}}V8Internal::namedSecu rityCheck, {{cpp_class}}V8Internal::indexedSecurityCheck, v8::External::New(isol ate, const_cast<WrapperTypeInfo*>(&{{v8_class}}::wrapperTypeInfo))); 922 instanceTemplate->SetAccessCheckCallbacks({{cpp_class}}V8Internal::namedSecu rityCheck, {{cpp_class}}V8Internal::indexedSecurityCheck, v8::External::New(isol ate, const_cast<WrapperTypeInfo*>(&{{v8_class}}::wrapperTypeInfo)));
923 {% endif %} 923 {% endif %}
924 {% for attribute in attributes 924 {% for attribute in attributes
925 if attribute.runtime_enabled_function and 925 if attribute.runtime_enabled_function and
926 not attribute.per_context_enabled_function and 926 not attribute.per_context_enabled_function and
927 not attribute.is_static %} 927 not attribute.is_static %}
928 {% filter conditional(attribute.conditional_string) %} 928 {% filter conditional(attribute.conditional_string) %}
929 if ({{attribute.runtime_enabled_function}}()) { 929 if ({{attribute.runtime_enabled_function}}()) {
930 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\ 930 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\
931 {{attribute_configuration(attribute)}}; 931 {{attribute_configuration(attribute)}};
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
1335 {% endif %} 1335 {% endif %}
1336 } 1336 }
1337 1337
1338 template<> 1338 template<>
1339 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) 1339 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
1340 { 1340 {
1341 return toV8(impl, creationContext, isolate); 1341 return toV8(impl, creationContext, isolate);
1342 } 1342 }
1343 1343
1344 {% endblock %} 1344 {% endblock %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698