| OLD | NEW |
| 1 {% from 'utilities.cpp' import declare_enum_validation_variable, v8_value_to_loc
al_cpp_value, check_origin_trial %} | 1 {% from 'utilities.cpp' import declare_enum_validation_variable, v8_value_to_loc
al_cpp_value, check_origin_trial %} |
| 2 | 2 |
| 3 {##############################################################################} | 3 {##############################################################################} |
| 4 {% macro attribute_getter(attribute, world_suffix) %} | 4 {% macro attribute_getter(attribute, world_suffix) %} |
| 5 static void {{attribute.name}}AttributeGetter{{world_suffix}}( | 5 static void {{attribute.name}}AttributeGetter{{world_suffix}}( |
| 6 {%- if attribute.is_data_type_property %} | 6 {%- if attribute.is_data_type_property %} |
| 7 const v8::PropertyCallbackInfo<v8::Value>& info | 7 const v8::PropertyCallbackInfo<v8::Value>& info |
| 8 {%- else %} | 8 {%- else %} |
| 9 const v8::FunctionCallbackInfo<v8::Value>& info | 9 const v8::FunctionCallbackInfo<v8::Value>& info |
| 10 {%- endif %}) | 10 {%- endif %}) |
| 11 { | 11 { |
| 12 {% if attribute.origin_trial_enabled_function %} | 12 {% if attribute.origin_trial_enabled_function %} |
| 13 {{check_origin_trial(attribute) | indent}} | 13 {{check_origin_trial(attribute) | indent}} |
| 14 {% endif %} | 14 {% endif %} |
| 15 {% if attribute.is_reflect and not attribute.is_url | 15 {% if attribute.is_reflect and not attribute.is_url |
| 16 and attribute.idl_type == 'DOMString' and is_node | 16 and attribute.idl_type == 'DOMString' and is_node |
| 17 and not attribute.is_implemented_in_private_script %} | 17 and not attribute.is_implemented_in_private_script %} |
| 18 {% set cpp_class, v8_class = 'Element', 'V8Element' %} | 18 {% set cpp_class, v8_class = 'Element', 'V8Element' %} |
| 19 {% endif %} | 19 {% endif %} |
| 20 {# holder #} | 20 {# holder #} |
| 21 {% if not attribute.is_static %} | 21 {% if not attribute.is_static %} |
| 22 {% if attribute.is_lenient_this %} | 22 {% if attribute.is_lenient_this %} |
| 23 {# Make sure that info.Holder() really points to an instance if [LenientThis
]. #} | 23 {# Make sure that info.Holder() really points to an instance if [LenientThis
]. #} |
| 24 v8::Local<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(in
fo.This(), info.GetIsolate()); | 24 if (!{{v8_class}}::hasInstance(info.Holder(), info.GetIsolate())) |
| 25 if (holder.IsEmpty()) | |
| 26 return; // Return silently because of [LenientThis]. | 25 return; // Return silently because of [LenientThis]. |
| 27 {% else %} | 26 {% endif %} |
| 28 v8::Local<v8::Object> holder = info.Holder(); | 27 v8::Local<v8::Object> holder = info.Holder(); |
| 29 {% endif %} | 28 {% endif %} |
| 30 {% endif %} | |
| 31 {# impl #} | 29 {# impl #} |
| 32 {% if attribute.cached_attribute_validation_method %} | 30 {% if attribute.cached_attribute_validation_method %} |
| 33 v8::Local<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "{{at
tribute.name}}"); | 31 v8::Local<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "{{at
tribute.name}}"); |
| 34 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); | 32 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); |
| 35 if (!impl->{{attribute.cached_attribute_validation_method}}()) { | 33 if (!impl->{{attribute.cached_attribute_validation_method}}()) { |
| 36 v8::Local<v8::Value> v8Value = V8HiddenValue::getHiddenValue(ScriptState
::current(info.GetIsolate()), holder, propertyName); | 34 v8::Local<v8::Value> v8Value = V8HiddenValue::getHiddenValue(ScriptState
::current(info.GetIsolate()), holder, propertyName); |
| 37 if (!v8Value.IsEmpty() && !v8Value->IsUndefined()) { | 35 if (!v8Value.IsEmpty() && !v8Value->IsUndefined()) { |
| 38 v8SetReturnValue(info, v8Value); | 36 v8SetReturnValue(info, v8Value); |
| 39 return; | 37 return; |
| 40 } | 38 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 71 {% endif %} | 69 {% endif %} |
| 72 {# Checks #} | 70 {# Checks #} |
| 73 {% if attribute.is_getter_raises_exception %} | 71 {% if attribute.is_getter_raises_exception %} |
| 74 if (UNLIKELY(exceptionState.throwIfNeeded())) | 72 if (UNLIKELY(exceptionState.throwIfNeeded())) |
| 75 return; | 73 return; |
| 76 {% endif %} | 74 {% endif %} |
| 77 {# Security checks #} | 75 {# Security checks #} |
| 78 {% if not attribute.is_data_type_property %} | 76 {% if not attribute.is_data_type_property %} |
| 79 {% if attribute.is_check_security_for_receiver %} | 77 {% if attribute.is_check_security_for_receiver %} |
| 80 if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindo
w(info.GetIsolate()), impl, exceptionState)) { | 78 if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindo
w(info.GetIsolate()), impl, exceptionState)) { |
| 81 {{attribute.v8_set_return_value_for_security_failure}}; | 79 v8SetReturnValueNull(info); |
| 82 exceptionState.throwIfNeeded(); | 80 exceptionState.throwIfNeeded(); |
| 83 return; | 81 return; |
| 84 } | 82 } |
| 85 {% endif %} | 83 {% endif %} |
| 86 {% endif %} | 84 {% endif %} |
| 87 {% if attribute.is_check_security_for_return_value %} | 85 {% if attribute.is_check_security_for_return_value %} |
| 88 if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindo
w(info.GetIsolate()), {{attribute.cpp_value}}, exceptionState)) { | 86 if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindo
w(info.GetIsolate()), {{attribute.cpp_value}}, exceptionState)) { |
| 89 {{attribute.v8_set_return_value_for_security_failure}}; | 87 v8SetReturnValueNull(info); |
| 90 exceptionState.throwIfNeeded(); | 88 exceptionState.throwIfNeeded(); |
| 91 return; | 89 return; |
| 92 } | 90 } |
| 93 {% endif %} | 91 {% endif %} |
| 94 {% if attribute.reflect_only %} | 92 {% if attribute.reflect_only %} |
| 95 {{release_only_check(attribute.reflect_only, attribute.reflect_missing, | 93 {{release_only_check(attribute.reflect_only, attribute.reflect_missing, |
| 96 attribute.reflect_invalid, attribute.reflect_empty, | 94 attribute.reflect_invalid, attribute.reflect_empty, |
| 97 attribute.cpp_value) | 95 attribute.cpp_value) |
| 98 | indent}} | 96 | indent}} |
| 99 {% endif %} | 97 {% endif %} |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 {% else %} | 239 {% else %} |
| 242 {% set raise_exception = 0 %} | 240 {% set raise_exception = 0 %} |
| 243 {% endif %} | 241 {% endif %} |
| 244 {# Local variables #} | 242 {# Local variables #} |
| 245 {% if (not attribute.is_static and | 243 {% if (not attribute.is_static and |
| 246 not attribute.is_replaceable and | 244 not attribute.is_replaceable and |
| 247 not attribute.constructor_type) or | 245 not attribute.constructor_type) or |
| 248 raise_exception %} | 246 raise_exception %} |
| 249 {% if attribute.is_lenient_this %} | 247 {% if attribute.is_lenient_this %} |
| 250 {# Make sure that info.Holder() really points to an instance if [LenientThis
]. #} | 248 {# Make sure that info.Holder() really points to an instance if [LenientThis
]. #} |
| 251 v8::Local<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(in
fo.This(), info.GetIsolate()); | 249 if (!{{v8_class}}::hasInstance(info.Holder(), info.GetIsolate())) |
| 252 if (holder.IsEmpty()) | |
| 253 return; // Return silently because of [LenientThis]. | 250 return; // Return silently because of [LenientThis]. |
| 254 {% else %} | 251 {% endif %} |
| 255 v8::Local<v8::Object> holder = info.Holder(); | 252 v8::Local<v8::Object> holder = info.Holder(); |
| 256 {% endif %} | 253 {% endif %} |
| 257 {% endif %} | |
| 258 {% if raise_exception %} | 254 {% if raise_exception %} |
| 259 ExceptionState exceptionState(ExceptionState::SetterContext, "{{attribute.na
me}}", "{{interface_name}}", holder, info.GetIsolate()); | 255 ExceptionState exceptionState(ExceptionState::SetterContext, "{{attribute.na
me}}", "{{interface_name}}", holder, info.GetIsolate()); |
| 260 {% endif %} | 256 {% endif %} |
| 261 {% if attribute.is_replaceable or | 257 {% if attribute.is_replaceable or |
| 262 attribute.constructor_type %} | 258 attribute.constructor_type %} |
| 263 v8::Local<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "{{at
tribute.name}}"); | 259 v8::Local<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "{{at
tribute.name}}"); |
| 264 {% endif %} | 260 {% endif %} |
| 265 {# impl #} | 261 {# impl #} |
| 266 {% if attribute.is_put_forwards %} | 262 {% if attribute.is_put_forwards %} |
| 267 {{cpp_class}}* proxyImpl = {{v8_class}}::toImpl(holder); | 263 {{cpp_class}}* proxyImpl = {{v8_class}}::toImpl(holder); |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 setter_callback_for_main_world, | 499 setter_callback_for_main_world, |
| 504 wrapper_type_info, | 500 wrapper_type_info, |
| 505 access_control, | 501 access_control, |
| 506 property_attribute, | 502 property_attribute, |
| 507 only_exposed_to_private_script, | 503 only_exposed_to_private_script, |
| 508 property_location(attribute), | 504 property_location(attribute), |
| 509 holder_check, | 505 holder_check, |
| 510 ] %} | 506 ] %} |
| 511 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} | 507 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} |
| 512 {%- endmacro %} | 508 {%- endmacro %} |
| OLD | NEW |