| OLD | NEW |
| 1 {##############################################################################} | 1 {##############################################################################} |
| 2 {% macro attribute_getter(attribute, world_suffix) %} | 2 {% macro attribute_getter(attribute, world_suffix) %} |
| 3 {% filter conditional(attribute.conditional_string) %} | 3 {% filter conditional(attribute.conditional_string) %} |
| 4 static void {{attribute.name}}AttributeGetter{{world_suffix}}( | 4 static void {{attribute.name}}AttributeGetter{{world_suffix}}( |
| 5 {%- if attribute.is_expose_js_accessors %} | 5 {%- if attribute.is_expose_js_accessors %} |
| 6 const v8::FunctionCallbackInfo<v8::Value>& info | 6 const v8::FunctionCallbackInfo<v8::Value>& info |
| 7 {%- else %} | 7 {%- else %} |
| 8 const v8::PropertyCallbackInfo<v8::Value>& info | 8 const v8::PropertyCallbackInfo<v8::Value>& info |
| 9 {%- endif %}) | 9 {%- endif %}) |
| 10 { | 10 { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 if (!jsValue.IsEmpty()) { | 27 if (!jsValue.IsEmpty()) { |
| 28 v8SetReturnValue(info, jsValue); | 28 v8SetReturnValue(info, jsValue); |
| 29 return; | 29 return; |
| 30 } | 30 } |
| 31 } | 31 } |
| 32 {% elif not (attribute.is_static or attribute.is_unforgeable) %} | 32 {% elif not (attribute.is_static or attribute.is_unforgeable) %} |
| 33 {{cpp_class}}* imp = {{v8_class}}::toNative(info.Holder()); | 33 {{cpp_class}}* imp = {{v8_class}}::toNative(info.Holder()); |
| 34 {% endif %} | 34 {% endif %} |
| 35 {% if attribute.reflect_only %} | 35 {% if attribute.reflect_only %} |
| 36 {{attribute.cpp_type}} {{attribute.cpp_value}} = {{attribute.cpp_value_origi
nal}}; | 36 {{attribute.cpp_type}} {{attribute.cpp_value}} = {{attribute.cpp_value_origi
nal}}; |
| 37 {{release_only_check(attribute.reflect_only) | indent}} | 37 {{release_only_check(attribute.reflect_only, attribute.reflect_missing, |
| 38 attribute.reflect_invalid) | indent}} |
| 38 {% endif %} | 39 {% endif %} |
| 39 {% if attribute.is_call_with_execution_context %} | 40 {% if attribute.is_call_with_execution_context %} |
| 40 ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate())
; | 41 ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate())
; |
| 41 {% endif %} | 42 {% endif %} |
| 42 {# Special cases #} | 43 {# Special cases #} |
| 43 {% if attribute.is_check_security_for_node or | 44 {% if attribute.is_check_security_for_node or |
| 44 attribute.is_getter_raises_exception %} | 45 attribute.is_getter_raises_exception %} |
| 45 ExceptionState exceptionState(ExceptionState::GetterContext, "{{attribute.na
me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); | 46 ExceptionState exceptionState(ExceptionState::GetterContext, "{{attribute.na
me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); |
| 46 {% endif %} | 47 {% endif %} |
| 47 {% if attribute.is_check_security_for_node %} | 48 {% if attribute.is_check_security_for_node %} |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 {{attribute.v8_set_return_value_for_main_world}}; | 89 {{attribute.v8_set_return_value_for_main_world}}; |
| 89 {% else %} | 90 {% else %} |
| 90 {{attribute.v8_set_return_value}}; | 91 {{attribute.v8_set_return_value}}; |
| 91 {% endif %} | 92 {% endif %} |
| 92 {% endif %} | 93 {% endif %} |
| 93 } | 94 } |
| 94 {% endfilter %} | 95 {% endfilter %} |
| 95 {% endmacro %} | 96 {% endmacro %} |
| 96 | 97 |
| 97 {######################################} | 98 {######################################} |
| 98 {% macro release_only_check(reflect_only_values) %} | 99 {% macro release_only_check(reflect_only_values, reflect_missing, |
| 100 reflect_invalid) %} |
| 99 {# Attribute is limited to only known values: check that the attribute value is | 101 {# Attribute is limited to only known values: check that the attribute value is |
| 100 one of those. If not, set it to the empty string. | 102 one of those. If not, set it to the empty string. |
| 101 http://www.whatwg.org/specs/web-apps/current-work/#limited-to-only-known-valu
es #} | 103 http://www.whatwg.org/specs/web-apps/current-work/#limited-to-only-known-valu
es #} |
| 102 if (resultValue.isEmpty()) { | 104 if (resultValue.isEmpty()) { |
| 105 {% if reflect_missing %} |
| 106 resultValue = "{{reflect_missing}}"; |
| 107 {% else %} |
| 103 ; | 108 ; |
| 109 {% endif %} |
| 104 {% for value in reflect_only_values %} | 110 {% for value in reflect_only_values %} |
| 105 } else if (equalIgnoringCase(resultValue, "{{value}}")) { | 111 } else if (equalIgnoringCase(resultValue, "{{value}}")) { |
| 106 resultValue = "{{value}}"; | 112 resultValue = "{{value}}"; |
| 107 {% endfor %} | 113 {% endfor %} |
| 108 } else { | 114 } else { |
| 109 resultValue = ""; | 115 resultValue = "{{reflect_invalid}}"; |
| 110 } | 116 } |
| 111 {% endmacro %} | 117 {% endmacro %} |
| 112 | 118 |
| 113 | 119 |
| 114 {##############################################################################} | 120 {##############################################################################} |
| 115 {% macro attribute_getter_callback(attribute, world_suffix) %} | 121 {% macro attribute_getter_callback(attribute, world_suffix) %} |
| 116 {% filter conditional(attribute.conditional_string) %} | 122 {% filter conditional(attribute.conditional_string) %} |
| 117 static void {{attribute.name}}AttributeGetterCallback{{world_suffix}}( | 123 static void {{attribute.name}}AttributeGetterCallback{{world_suffix}}( |
| 118 {%- if attribute.is_expose_js_accessors %} | 124 {%- if attribute.is_expose_js_accessors %} |
| 119 const v8::FunctionCallbackInfo<v8::Value>& info | 125 const v8::FunctionCallbackInfo<v8::Value>& info |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 {% endif %} | 255 {% endif %} |
| 250 {% if attribute.has_custom_setter %} | 256 {% if attribute.has_custom_setter %} |
| 251 {{v8_class}}::{{attribute.name}}AttributeSetterCustom(jsValue, info); | 257 {{v8_class}}::{{attribute.name}}AttributeSetterCustom(jsValue, info); |
| 252 {% else %} | 258 {% else %} |
| 253 {{cpp_class}}V8Internal::{{attribute.name}}AttributeSetter{{world_suffix}}(j
sValue, info); | 259 {{cpp_class}}V8Internal::{{attribute.name}}AttributeSetter{{world_suffix}}(j
sValue, info); |
| 254 {% endif %} | 260 {% endif %} |
| 255 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 261 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 256 } | 262 } |
| 257 {% endfilter %} | 263 {% endfilter %} |
| 258 {% endmacro %} | 264 {% endmacro %} |
| OLD | NEW |