| OLD | NEW |
| 1 {% from 'utilities.cpp.tmpl' import declare_enum_validation_variable, v8_value_t
o_local_cpp_value %} | 1 {% from 'utilities.cpp.tmpl' import declare_enum_validation_variable, v8_value_t
o_local_cpp_value %} |
| 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 %}) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 { | 36 { |
| 37 v8::Local<v8::Value> v8Value = privateSameObject.get(info.GetIsolate()->GetC
urrentContext(), holder); | 37 v8::Local<v8::Value> v8Value = privateSameObject.get(info.GetIsolate()->GetC
urrentContext(), holder); |
| 38 if (!v8Value.IsEmpty()) { | 38 if (!v8Value.IsEmpty()) { |
| 39 v8SetReturnValue(info, v8Value); | 39 v8SetReturnValue(info, v8Value); |
| 40 return; | 40 return; |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 {% endif %} | 43 {% endif %} |
| 44 | 44 |
| 45 {% if not attribute.is_static %} | 45 {% if not attribute.is_static %} |
| 46 {% if interface_name == 'Window' and not attribute.has_cross_origin_getter %} |
| 47 // Same-origin attribute getters are never exposed via the cross-origin |
| 48 // interceptors. Since same-origin access requires a LocalDOMWindow, it is |
| 49 // safe to downcast here. |
| 50 LocalDOMWindow* impl = toLocalDOMWindow({{v8_class}}::toImpl(holder)); |
| 51 {% else %} |
| 46 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); | 52 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); |
| 47 {% endif %} | 53 {% endif %} |
| 54 {% endif %} |
| 48 | 55 |
| 49 {% if attribute.cached_attribute_validation_method %} | 56 {% if attribute.cached_attribute_validation_method %} |
| 50 // [CachedAttribute] | 57 // [CachedAttribute] |
| 51 v8::Local<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "{{attr
ibute.name}}"); | 58 v8::Local<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "{{attr
ibute.name}}"); |
| 52 if (!impl->{{attribute.cached_attribute_validation_method}}()) { | 59 if (!impl->{{attribute.cached_attribute_validation_method}}()) { |
| 53 v8::Local<v8::Value> v8Value = V8HiddenValue::getHiddenValue(ScriptState::fo
rFunctionObject(info), holder, propertyName); | 60 v8::Local<v8::Value> v8Value = V8HiddenValue::getHiddenValue(ScriptState::fo
rFunctionObject(info), holder, propertyName); |
| 54 if (!v8Value.IsEmpty() && !v8Value->IsUndefined()) { | 61 if (!v8Value.IsEmpty() && !v8Value->IsUndefined()) { |
| 55 v8SetReturnValue(info, v8Value); | 62 v8SetReturnValue(info, v8Value); |
| 56 return; | 63 return; |
| 57 } | 64 } |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 {% endif %} | 282 {% endif %} |
| 276 | 283 |
| 277 {% if not attribute.is_static and not attribute.is_replaceable %} | 284 {% if not attribute.is_static and not attribute.is_replaceable %} |
| 278 v8::Local<v8::Object> holder = info.Holder(); | 285 v8::Local<v8::Object> holder = info.Holder(); |
| 279 {% if attribute.is_put_forwards %} | 286 {% if attribute.is_put_forwards %} |
| 280 {{cpp_class}}* proxyImpl = {{v8_class}}::toImpl(holder); | 287 {{cpp_class}}* proxyImpl = {{v8_class}}::toImpl(holder); |
| 281 {{attribute.cpp_type}} impl = WTF::getPtr(proxyImpl->{{attribute.name}}()); | 288 {{attribute.cpp_type}} impl = WTF::getPtr(proxyImpl->{{attribute.name}}()); |
| 282 if (!impl) | 289 if (!impl) |
| 283 return; | 290 return; |
| 284 {% else %} | 291 {% else %} |
| 292 {% if interface_name == 'Window' and not attribute.has_cross_origin_setter %} |
| 293 // Same-origin attribute setters are never exposed via the cross-origin |
| 294 // interceptors. Since same-origin access requires a LocalDOMWindow, it is |
| 295 // safe to downcast here. |
| 296 LocalDOMWindow* impl = toLocalDOMWindow({{v8_class}}::toImpl(holder)); |
| 297 {% else %} |
| 285 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); | 298 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); |
| 286 {% endif %} | 299 {% endif %} |
| 287 {% endif %} | 300 {% endif %} |
| 301 {% endif %} |
| 288 | 302 |
| 289 {% if attribute.is_check_security_for_receiver and not attribute.is_data_type_
property %} | 303 {% if attribute.is_check_security_for_receiver and not attribute.is_data_type_
property %} |
| 290 // Perform a security check for the receiver object. | 304 // Perform a security check for the receiver object. |
| 291 {{define_exception_state}} | 305 {{define_exception_state}} |
| 292 if (!BindingSecurity::shouldAllowAccessTo(currentDOMWindow(info.GetIsolate()),
impl, exceptionState)) { | 306 if (!BindingSecurity::shouldAllowAccessTo(currentDOMWindow(info.GetIsolate()),
impl, exceptionState)) { |
| 293 v8SetReturnValue(info, v8Value); | 307 v8SetReturnValue(info, v8Value); |
| 294 return; | 308 return; |
| 295 } | 309 } |
| 296 {% endif %} | 310 {% endif %} |
| 297 | 311 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 getter_callback_for_main_world, | 473 getter_callback_for_main_world, |
| 460 setter_callback_for_main_world, | 474 setter_callback_for_main_world, |
| 461 cached_accessor_callback, | 475 cached_accessor_callback, |
| 462 wrapper_type_info, | 476 wrapper_type_info, |
| 463 property_attribute, | 477 property_attribute, |
| 464 property_location(attribute), | 478 property_location(attribute), |
| 465 holder_check, | 479 holder_check, |
| 466 ] %} | 480 ] %} |
| 467 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} | 481 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} |
| 468 {%- endmacro %} | 482 {%- endmacro %} |
| OLD | NEW |