OLD | NEW |
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 Loading... |
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 Loading... |
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 %} |
OLD | NEW |