| OLD | NEW |
| 1 {% from 'conversions.cpp' import declare_enum_validation_variable, v8_value_to_l
ocal_cpp_value %} | 1 {% from 'conversions.cpp' import declare_enum_validation_variable, v8_value_to_l
ocal_cpp_value %} |
| 2 | 2 |
| 3 | 3 |
| 4 {##############################################################################} | 4 {##############################################################################} |
| 5 {% macro attribute_getter(attribute, world_suffix) %} | 5 {% macro attribute_getter(attribute, world_suffix) %} |
| 6 {% filter conditional(attribute.conditional_string) %} | 6 {% filter conditional(attribute.conditional_string) %} |
| 7 static void {{attribute.name}}AttributeGetter{{world_suffix}}( | 7 static void {{attribute.name}}AttributeGetter{{world_suffix}}( |
| 8 {%- if attribute.is_data_type_property %} | 8 {%- if attribute.is_data_type_property %} |
| 9 const v8::PropertyCallbackInfo<v8::Value>& info | 9 const v8::PropertyCallbackInfo<v8::Value>& info |
| 10 {%- else %} | 10 {%- else %} |
| 11 const v8::FunctionCallbackInfo<v8::Value>& info | 11 const v8::FunctionCallbackInfo<v8::Value>& info |
| 12 {%- endif %}) | 12 {%- endif %}) |
| 13 { | 13 { |
| 14 {% if attribute.is_reflect and not attribute.is_url | 14 {% if attribute.is_reflect and not attribute.is_url |
| 15 and attribute.idl_type == 'DOMString' and is_node | 15 and attribute.idl_type == 'DOMString' and is_node |
| 16 and not attribute.is_implemented_in_private_script %} | 16 and not attribute.is_implemented_in_private_script %} |
| 17 {% set cpp_class, v8_class = 'Element', 'V8Element' %} | 17 {% set cpp_class, v8_class = 'Element', 'V8Element' %} |
| 18 {% endif %} | 18 {% endif %} |
| 19 {# holder #} | 19 {# holder #} |
| 20 {% if not attribute.is_static %} | 20 {% if not attribute.is_static %} |
| 21 {% if attribute.is_lenient_this %} | 21 {% if attribute.is_lenient_this %} |
| 22 v8::Local<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(in
fo.This(), info.GetIsolate()); | 22 {# Make sure that info.Holder() really points to an instance if [LenientThis
]. #} |
| 23 if (holder.IsEmpty()) | 23 if (!{{v8_class}}::hasInstance(info.Holder(), info.GetIsolate())) |
| 24 return; // Return silently because of [LenientThis]. | 24 return; // Return silently because of [LenientThis]. |
| 25 // Note that it's okay to use |holder|, but |info.Holder()| is still unsafe | 25 {% endif %} |
| 26 // and must not be used. | |
| 27 {% else %} | |
| 28 v8::Local<v8::Object> holder = info.Holder(); | 26 v8::Local<v8::Object> holder = info.Holder(); |
| 29 {% endif %} | 27 {% endif %} |
| 30 {% endif %} | |
| 31 {# impl #} | 28 {# impl #} |
| 32 {% if attribute.cached_attribute_validation_method %} | 29 {% if attribute.cached_attribute_validation_method %} |
| 33 v8::Local<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "{{at
tribute.name}}"); | 30 v8::Local<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "{{at
tribute.name}}"); |
| 34 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); | 31 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); |
| 35 if (!impl->{{attribute.cached_attribute_validation_method}}()) { | 32 if (!impl->{{attribute.cached_attribute_validation_method}}()) { |
| 36 v8::Local<v8::Value> v8Value = V8HiddenValue::getHiddenValue(info.GetIso
late(), holder, propertyName); | 33 v8::Local<v8::Value> v8Value = V8HiddenValue::getHiddenValue(info.GetIso
late(), holder, propertyName); |
| 37 if (!v8Value.IsEmpty()) { | 34 if (!v8Value.IsEmpty()) { |
| 38 v8SetReturnValue(info, v8Value); | 35 v8SetReturnValue(info, v8Value); |
| 39 return; | 36 return; |
| 40 } | 37 } |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 {% set raise_exception = 1 %} | 253 {% set raise_exception = 1 %} |
| 257 {% else %} | 254 {% else %} |
| 258 {% set raise_exception = 0 %} | 255 {% set raise_exception = 0 %} |
| 259 {% endif %} | 256 {% endif %} |
| 260 {# Local variables #} | 257 {# Local variables #} |
| 261 {% if (not attribute.is_static and | 258 {% if (not attribute.is_static and |
| 262 not attribute.is_replaceable and | 259 not attribute.is_replaceable and |
| 263 not attribute.constructor_type) or | 260 not attribute.constructor_type) or |
| 264 raise_exception %} | 261 raise_exception %} |
| 265 {% if attribute.is_lenient_this %} | 262 {% if attribute.is_lenient_this %} |
| 266 v8::Local<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(in
fo.This(), info.GetIsolate()); | 263 {# Make sure that info.Holder() really points to an instance if [LenientThis
]. #} |
| 267 if (holder.IsEmpty()) | 264 if (!{{v8_class}}::hasInstance(info.Holder(), info.GetIsolate())) |
| 268 return; // Return silently because of [LenientThis]. | 265 return; // Return silently because of [LenientThis]. |
| 269 // Note that it's okay to use |holder|, but |info.Holder()| is still unsafe | 266 {% endif %} |
| 270 // and must not be used. | |
| 271 {% else %} | |
| 272 v8::Local<v8::Object> holder = info.Holder(); | 267 v8::Local<v8::Object> holder = info.Holder(); |
| 273 {% endif %} | 268 {% endif %} |
| 274 {% endif %} | |
| 275 {% if raise_exception %} | 269 {% if raise_exception %} |
| 276 ExceptionState exceptionState(ExceptionState::SetterContext, "{{attribute.na
me}}", "{{interface_name}}", holder, info.GetIsolate()); | 270 ExceptionState exceptionState(ExceptionState::SetterContext, "{{attribute.na
me}}", "{{interface_name}}", holder, info.GetIsolate()); |
| 277 {% endif %} | 271 {% endif %} |
| 278 {% if attribute.is_replaceable or | 272 {% if attribute.is_replaceable or |
| 279 attribute.constructor_type %} | 273 attribute.constructor_type %} |
| 280 v8::Local<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "{{at
tribute.name}}"); | 274 v8::Local<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "{{at
tribute.name}}"); |
| 281 {% endif %} | 275 {% endif %} |
| 282 {# impl #} | 276 {# impl #} |
| 283 {% if attribute.is_put_forwards %} | 277 {% if attribute.is_put_forwards %} |
| 284 {{cpp_class}}* proxyImpl = {{v8_class}}::toImpl(holder); | 278 {{cpp_class}}* proxyImpl = {{v8_class}}::toImpl(holder); |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 setter_callback_for_main_world, | 532 setter_callback_for_main_world, |
| 539 wrapper_type_info, | 533 wrapper_type_info, |
| 540 access_control, | 534 access_control, |
| 541 property_attribute, | 535 property_attribute, |
| 542 only_exposed_to_private_script, | 536 only_exposed_to_private_script, |
| 543 property_location(attribute), | 537 property_location(attribute), |
| 544 holder_check, | 538 holder_check, |
| 545 ] %} | 539 ] %} |
| 546 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} | 540 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} |
| 547 {%- endmacro %} | 541 {%- endmacro %} |
| OLD | NEW |