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

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

Issue 329053002: Throw TypeError when addEventListener or removeEventListener are called without enough arguments (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased 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
« no previous file with comments | « Source/bindings/scripts/v8_types.py ('k') | Source/bindings/templates/methods.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
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 static void {{cpp_class}}ForceSetAttributeOnThis(v8::Local<v8::String> name, v8: :Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) 84 static void {{cpp_class}}ForceSetAttributeOnThis(v8::Local<v8::String> name, v8: :Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
85 { 85 {
86 {% if is_check_security %} 86 {% if is_check_security_for_frame %}
87 {{cpp_class}}* impl = {{v8_class}}::toNative(info.Holder()); 87 {{cpp_class}}* impl = {{v8_class}}::toNative(info.Holder());
88 v8::Isolate* isolate = info.GetIsolate(); 88 v8::Isolate* isolate = info.GetIsolate();
89 v8::String::Utf8Value attributeName(name); 89 v8::String::Utf8Value attributeName(name);
90 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName, "{{interface_name}}", info.Holder(), isolate); 90 ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName, "{{interface_name}}", info.Holder(), isolate);
91 if (!BindingSecurity::shouldAllowAccessToFrame(isolate, impl->frame(), excep tionState)) { 91 if (!BindingSecurity::shouldAllowAccessToFrame(isolate, impl->frame(), excep tionState)) {
92 exceptionState.throwIfNeeded(); 92 exceptionState.throwIfNeeded();
93 return; 93 return;
94 } 94 }
95 {% endif %} 95 {% endif %}
96 if (info.This()->IsObject()) 96 if (info.This()->IsObject())
97 v8::Handle<v8::Object>::Cast(info.This())->ForceSet(name, v8Value); 97 v8::Handle<v8::Object>::Cast(info.This())->ForceSet(name, v8Value);
98 } 98 }
99 99
100 static void {{cpp_class}}ForceSetAttributeOnThisCallback(v8::Local<v8::String> n ame, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) 100 static void {{cpp_class}}ForceSetAttributeOnThisCallback(v8::Local<v8::String> n ame, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
101 { 101 {
102 {{cpp_class}}V8Internal::{{cpp_class}}ForceSetAttributeOnThis(name, v8Value, info); 102 {{cpp_class}}V8Internal::{{cpp_class}}ForceSetAttributeOnThis(name, v8Value, info);
103 } 103 }
104 104
105 {% endif %} 105 {% endif %}
106 {% endblock %} 106 {% endblock %}
107 107
108 108
109 {##############################################################################} 109 {##############################################################################}
110 {% block security_check_functions %} 110 {% block security_check_functions %}
111 {% if is_check_security and interface_name != 'Window' %} 111 {% if is_check_security_for_frame and interface_name != 'Window' %}
112 bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::Access Type type, v8::Local<v8::Value>) 112 bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::Access Type type, v8::Local<v8::Value>)
113 { 113 {
114 {{cpp_class}}* impl = {{v8_class}}::toNative(host); 114 {{cpp_class}}* impl = {{v8_class}}::toNative(host);
115 return BindingSecurity::shouldAllowAccessToFrame(v8::Isolate::GetCurrent(), impl->frame(), DoNotReportSecurityError); 115 return BindingSecurity::shouldAllowAccessToFrame(v8::Isolate::GetCurrent(), impl->frame(), DoNotReportSecurityError);
116 } 116 }
117 117
118 bool namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8 ::AccessType type, v8::Local<v8::Value>) 118 bool namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8 ::AccessType type, v8::Local<v8::Value>)
119 { 119 {
120 {{cpp_class}}* impl = {{v8_class}}::toNative(host); 120 {{cpp_class}}* impl = {{v8_class}}::toNative(host);
121 return BindingSecurity::shouldAllowAccessToFrame(v8::Isolate::GetCurrent(), impl->frame(), DoNotReportSecurityError); 121 return BindingSecurity::shouldAllowAccessToFrame(v8::Isolate::GetCurrent(), impl->frame(), DoNotReportSecurityError);
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 {{methods_name}}, {{methods_length}}, 914 {{methods_name}}, {{methods_length}},
915 isolate); 915 isolate);
916 {% endfilter %} 916 {% endfilter %}
917 917
918 {% if constructors or has_custom_constructor or has_event_constructor %} 918 {% if constructors or has_custom_constructor or has_event_constructor %}
919 functionTemplate->SetCallHandler({{v8_class}}::constructorCallback); 919 functionTemplate->SetCallHandler({{v8_class}}::constructorCallback);
920 functionTemplate->SetLength({{interface_length}}); 920 functionTemplate->SetLength({{interface_length}});
921 {% endif %} 921 {% endif %}
922 v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTempla te->InstanceTemplate(); 922 v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTempla te->InstanceTemplate();
923 v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTempl ate->PrototypeTemplate(); 923 v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTempl ate->PrototypeTemplate();
924 {% if is_check_security and interface_name != 'Window' %} 924 {% if is_check_security_for_frame and interface_name != 'Window' %}
925 instanceTemplate->SetAccessCheckCallbacks({{cpp_class}}V8Internal::namedSecu rityCheck, {{cpp_class}}V8Internal::indexedSecurityCheck, v8::External::New(isol ate, const_cast<WrapperTypeInfo*>(&{{v8_class}}::wrapperTypeInfo))); 925 instanceTemplate->SetAccessCheckCallbacks({{cpp_class}}V8Internal::namedSecu rityCheck, {{cpp_class}}V8Internal::indexedSecurityCheck, v8::External::New(isol ate, const_cast<WrapperTypeInfo*>(&{{v8_class}}::wrapperTypeInfo)));
926 {% endif %} 926 {% endif %}
927 {% for attribute in attributes 927 {% for attribute in attributes
928 if attribute.runtime_enabled_function and 928 if attribute.runtime_enabled_function and
929 not attribute.per_context_enabled_function and 929 not attribute.per_context_enabled_function and
930 not attribute.is_static %} 930 not attribute.is_static %}
931 {% filter conditional(attribute.conditional_string) %} 931 {% filter conditional(attribute.conditional_string) %}
932 if ({{attribute.runtime_enabled_function}}()) { 932 if ({{attribute.runtime_enabled_function}}()) {
933 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\ 933 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\
934 {{attribute_configuration(attribute)}}; 934 {{attribute_configuration(attribute)}};
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 {% endif %} 1332 {% endif %}
1333 } 1333 }
1334 1334
1335 template<> 1335 template<>
1336 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) 1336 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
1337 { 1337 {
1338 return toV8(impl, creationContext, isolate); 1338 return toV8(impl, creationContext, isolate);
1339 } 1339 }
1340 1340
1341 {% endblock %} 1341 {% endblock %}
OLDNEW
« no previous file with comments | « Source/bindings/scripts/v8_types.py ('k') | Source/bindings/templates/methods.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698