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

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

Issue 143943020: Replace [TreatNullAs=functionName] with [StrictTypeChecking] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update tests, Python, and IDLExtendedAttributes.txt 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 {% 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 '{0}V8Internal::{0}ConstructorGetter'.format(interface_name) %} 10 '{0}V8Internal::{0}ConstructorGetter'.format(interface_name) %}
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 135
136 136
137 {##############################################################################} 137 {##############################################################################}
138 {% block indexed_property_setter %} 138 {% block indexed_property_setter %}
139 {% if indexed_property_setter and not indexed_property_setter.is_custom %} 139 {% if indexed_property_setter and not indexed_property_setter.is_custom %}
140 {% set setter = indexed_property_setter %} 140 {% set setter = indexed_property_setter %}
141 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info) 141 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info)
142 { 142 {
143 {{cpp_class}}* collection = {{v8_class}}::toNative(info.Holder()); 143 {{cpp_class}}* collection = {{v8_class}}::toNative(info.Holder());
144 {{setter.v8_value_to_local_cpp_value}}; 144 {{setter.v8_value_to_local_cpp_value}};
145 {% if setter.has_strict_type_checking %}
146 {# Type checking for interface types (if interface not implemented, throw
147 TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #}
148 if (!isUndefinedOrNull(jsValue) && !V8{{setter.idl_type}}::hasInstance(jsVal ue, info.GetIsolate())) {
149 exceptionState.throwTypeError("The provided value is not of type '{{sett er.idl_type}}'.");
150 exceptionState.throwIfNeeded();
151 return;
152 }
153 {% endif %}
145 {% set setter_name = setter.name or 'anonymousIndexedSetter' %} 154 {% set setter_name = setter.name or 'anonymousIndexedSetter' %}
146 bool result = collection->{{setter_name}}(index, propertyValue); 155 bool result = collection->{{setter_name}}(index, propertyValue);
147 if (!result) 156 if (!result)
148 return; 157 return;
149 v8SetReturnValue(info, jsValue); 158 v8SetReturnValue(info, jsValue);
150 } 159 }
151 160
152 {% endif %} 161 {% endif %}
153 {% endblock %} 162 {% endblock %}
154 163
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 fromInternalPointer(object)->deref(); 1116 fromInternalPointer(object)->deref();
1108 } 1117 }
1109 1118
1110 template<> 1119 template<>
1111 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) 1120 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
1112 { 1121 {
1113 return toV8(impl, creationContext, isolate); 1122 return toV8(impl, creationContext, isolate);
1114 } 1123 }
1115 1124
1116 {% endblock %} 1125 {% endblock %}
OLDNEW
« no previous file with comments | « Source/bindings/scripts/unstable/v8_interface.py ('k') | Source/bindings/tests/idls/TestEventTarget.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698