| 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 %} |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 {% elif attribute.cpp_value_original %} | 70 {% elif attribute.cpp_value_original %} |
| 71 {{attribute.cpp_type}} {{attribute.cpp_value}}({{attribute.cpp_value_origina
l}}); | 71 {{attribute.cpp_type}} {{attribute.cpp_value}}({{attribute.cpp_value_origina
l}}); |
| 72 {% endif %} | 72 {% endif %} |
| 73 {# Checks #} | 73 {# Checks #} |
| 74 {% if attribute.is_getter_raises_exception %} | 74 {% if attribute.is_getter_raises_exception %} |
| 75 if (UNLIKELY(exceptionState.throwIfNeeded())) | 75 if (UNLIKELY(exceptionState.throwIfNeeded())) |
| 76 return; | 76 return; |
| 77 {% endif %} | 77 {% endif %} |
| 78 {# Security checks #} | 78 {# Security checks #} |
| 79 {% if not attribute.is_data_type_property %} | 79 {% if not attribute.is_data_type_property %} |
| 80 {% if attribute.is_check_security_for_window %} | 80 {% if attribute.is_check_security_for_window or |
| 81 if (LocalDOMWindow* window = impl->toDOMWindow()) { | 81 attribute.is_check_security_for_frame or |
| 82 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), callin
gDOMWindow(info.GetIsolate()), window->frame(), exceptionState)) { | 82 attribute.is_check_security_for_node %} |
| 83 v8SetReturnValueNull(info); | 83 if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindo
w(info.GetIsolate()), {{attribute.cpp_value if attribute.is_check_security_for_n
ode else 'impl'}}, exceptionState)) { |
| 84 exceptionState.throwIfNeeded(); | |
| 85 return; | |
| 86 } | |
| 87 if (!window->document()) | |
| 88 return; | |
| 89 } | |
| 90 {% elif attribute.is_check_security_for_frame %} | |
| 91 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), callingDOM
Window(info.GetIsolate()), impl->frame(), exceptionState)) { | |
| 92 v8SetReturnValueNull(info); | 84 v8SetReturnValueNull(info); |
| 93 exceptionState.throwIfNeeded(); | 85 exceptionState.throwIfNeeded(); |
| 94 return; | 86 return; |
| 95 } | 87 } |
| 96 {% endif %} | 88 {% endif %} |
| 97 {% endif %} | 89 {% endif %} |
| 98 {% if attribute.is_check_security_for_node %} | |
| 99 if (!BindingSecurity::shouldAllowAccessToNode(info.GetIsolate(), callingDOMW
indow(info.GetIsolate()), {{attribute.cpp_value}}, exceptionState)) { | |
| 100 v8SetReturnValueNull(info); | |
| 101 exceptionState.throwIfNeeded(); | |
| 102 return; | |
| 103 } | |
| 104 {% endif %} | |
| 105 {% if attribute.reflect_only %} | 90 {% if attribute.reflect_only %} |
| 106 {{release_only_check(attribute.reflect_only, attribute.reflect_missing, | 91 {{release_only_check(attribute.reflect_only, attribute.reflect_missing, |
| 107 attribute.reflect_invalid, attribute.reflect_empty, | 92 attribute.reflect_invalid, attribute.reflect_empty, |
| 108 attribute.cpp_value) | 93 attribute.cpp_value) |
| 109 | indent}} | 94 | indent}} |
| 110 {% endif %} | 95 {% endif %} |
| 111 {% if attribute.is_explicit_nullable %} | 96 {% if attribute.is_explicit_nullable %} |
| 112 if (isNull) { | 97 if (isNull) { |
| 113 v8SetReturnValueNull(info); | 98 v8SetReturnValueNull(info); |
| 114 return; | 99 return; |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); | 276 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); |
| 292 {% endif %} | 277 {% endif %} |
| 293 {% if attribute.idl_type == 'EventHandler' and interface_name == 'Window' %} | 278 {% if attribute.idl_type == 'EventHandler' and interface_name == 'Window' %} |
| 294 if (!impl->document()) | 279 if (!impl->document()) |
| 295 return; | 280 return; |
| 296 {% endif %} | 281 {% endif %} |
| 297 {# Security checks #} | 282 {# Security checks #} |
| 298 {% if not attribute.is_replaceable and | 283 {% if not attribute.is_replaceable and |
| 299 not attribute.constructor_type %} | 284 not attribute.constructor_type %} |
| 300 {% if not attribute.is_data_type_property %} | 285 {% if not attribute.is_data_type_property %} |
| 301 {% if attribute.is_check_security_for_window %} | 286 {% if attribute.is_check_security_for_window or |
| 302 if (LocalDOMWindow* window = impl->toDOMWindow()) { | 287 attribute.is_check_security_for_frame or |
| 303 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), callin
gDOMWindow(info.GetIsolate()), window->frame(), exceptionState)) { | 288 attribute.is_check_security_for_node %} |
| 304 v8SetReturnValue(info, v8Value); | 289 if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindo
w(info.GetIsolate()), {{attribute.cpp_value if attribute.is_check_security_for_n
ode else 'impl'}}, exceptionState)) { |
| 305 exceptionState.throwIfNeeded(); | |
| 306 return; | |
| 307 } | |
| 308 if (!window->document()) | |
| 309 return; | |
| 310 } | |
| 311 {% elif attribute.is_check_security_for_frame %} | |
| 312 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), callingDOM
Window(info.GetIsolate()), impl->frame(), exceptionState)) { | |
| 313 v8SetReturnValue(info, v8Value); | 290 v8SetReturnValue(info, v8Value); |
| 314 exceptionState.throwIfNeeded(); | 291 exceptionState.throwIfNeeded(); |
| 315 return; | 292 return; |
| 316 } | 293 } |
| 317 {% endif %} | 294 {% endif %} |
| 318 {% endif %} | 295 {% endif %} |
| 319 {% if attribute.is_check_security_for_node %} | |
| 320 if (!BindingSecurity::shouldAllowAccessToNode(info.GetIsolate(), callingDOMW
indow(info.GetIsolate()), {{attribute.cpp_value}}, exceptionState)) { | |
| 321 v8SetReturnValue(info, v8Value); | |
| 322 exceptionState.throwIfNeeded(); | |
| 323 return; | |
| 324 } | |
| 325 {% endif %} | |
| 326 {% endif %}{# not attribute.is_replaceable and | 296 {% endif %}{# not attribute.is_replaceable and |
| 327 not attribute.constructor_type #} | 297 not attribute.constructor_type #} |
| 328 {# Convert JS value to C++ value #} | 298 {# Convert JS value to C++ value #} |
| 329 {% if attribute.idl_type != 'EventHandler' %} | 299 {% if attribute.idl_type != 'EventHandler' %} |
| 330 {% if v8_value_to_local_cpp_value(attribute) %} | 300 {% if v8_value_to_local_cpp_value(attribute) %} |
| 331 {{v8_value_to_local_cpp_value(attribute) | indent}} | 301 {{v8_value_to_local_cpp_value(attribute) | indent}} |
| 332 {% endif %} | 302 {% endif %} |
| 333 {% elif not is_node %}{# EventHandler hack #} | 303 {% elif not is_node %}{# EventHandler hack #} |
| 334 moveEventListenerToNewWrapper(info.GetIsolate(), holder, {{attribute.event_h
andler_getter_expression}}, v8Value, {{v8_class}}::eventListenerCacheIndex); | 304 moveEventListenerToNewWrapper(info.GetIsolate(), holder, {{attribute.event_h
andler_getter_expression}}, v8Value, {{v8_class}}::eventListenerCacheIndex); |
| 335 {% endif %} | 305 {% endif %} |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 setter_callback_for_main_world, | 508 setter_callback_for_main_world, |
| 539 wrapper_type_info, | 509 wrapper_type_info, |
| 540 access_control, | 510 access_control, |
| 541 property_attribute, | 511 property_attribute, |
| 542 only_exposed_to_private_script, | 512 only_exposed_to_private_script, |
| 543 property_location(attribute), | 513 property_location(attribute), |
| 544 holder_check, | 514 holder_check, |
| 545 ] %} | 515 ] %} |
| 546 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} | 516 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} |
| 547 {%- endmacro %} | 517 {%- endmacro %} |
| OLD | NEW |