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 14 matching lines...) Expand all Loading... |
25 if (!imp->{{attribute.cached_attribute_validation_method}}()) { | 25 if (!imp->{{attribute.cached_attribute_validation_method}}()) { |
26 v8::Handle<v8::Value> jsValue = getHiddenValue(info.GetIsolate(), info.H
older(), propertyName); | 26 v8::Handle<v8::Value> jsValue = getHiddenValue(info.GetIsolate(), info.H
older(), propertyName); |
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 %} |
| 36 {{attribute.cpp_type}} {{attribute.cpp_value}} = {{attribute.cpp_value_origi
nal}}; |
| 37 {{release_only_check(attribute.reflect_only) | indent}} |
| 38 {% endif %} |
35 {% if attribute.is_call_with_execution_context %} | 39 {% if attribute.is_call_with_execution_context %} |
36 ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate())
; | 40 ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate())
; |
37 {% endif %} | 41 {% endif %} |
38 {# Special cases #} | 42 {# Special cases #} |
39 {% if attribute.is_check_security_for_node or | 43 {% if attribute.is_check_security_for_node or |
40 attribute.is_getter_raises_exception %} | 44 attribute.is_getter_raises_exception %} |
41 ExceptionState exceptionState(ExceptionState::GetterContext, "{{attribute.na
me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); | 45 ExceptionState exceptionState(ExceptionState::GetterContext, "{{attribute.na
me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); |
42 {% endif %} | 46 {% endif %} |
43 {% if attribute.is_check_security_for_node %} | 47 {% if attribute.is_check_security_for_node %} |
44 {# FIXME: consider using a local variable to not call getter twice #} | 48 {# FIXME: consider using a local variable to not call getter twice #} |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 {% if world_suffix %} | 87 {% if world_suffix %} |
84 {{attribute.v8_set_return_value_for_main_world}}; | 88 {{attribute.v8_set_return_value_for_main_world}}; |
85 {% else %} | 89 {% else %} |
86 {{attribute.v8_set_return_value}}; | 90 {{attribute.v8_set_return_value}}; |
87 {% endif %} | 91 {% endif %} |
88 {% endif %} | 92 {% endif %} |
89 } | 93 } |
90 {% endfilter %} | 94 {% endfilter %} |
91 {% endmacro %} | 95 {% endmacro %} |
92 | 96 |
| 97 {######################################} |
| 98 {% macro release_only_check(reflect_only_values) %} |
| 99 {# 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. |
| 101 http://www.whatwg.org/specs/web-apps/current-work/#limited-to-only-known-valu
es #} |
| 102 if (resultValue.isEmpty()) { |
| 103 ; |
| 104 {% for value in reflect_only_values %} |
| 105 } else if (equalIgnoringCase(resultValue, "{{value}}")) { |
| 106 resultValue = "{{value}}"; |
| 107 {% endfor %} |
| 108 } else { |
| 109 resultValue = ""; |
| 110 } |
| 111 {% endmacro %} |
| 112 |
93 | 113 |
94 {##############################################################################} | 114 {##############################################################################} |
95 {% macro attribute_getter_callback(attribute, world_suffix) %} | 115 {% macro attribute_getter_callback(attribute, world_suffix) %} |
96 {% filter conditional(attribute.conditional_string) %} | 116 {% filter conditional(attribute.conditional_string) %} |
97 static void {{attribute.name}}AttributeGetterCallback{{world_suffix}}( | 117 static void {{attribute.name}}AttributeGetterCallback{{world_suffix}}( |
98 {%- if attribute.is_expose_js_accessors %} | 118 {%- if attribute.is_expose_js_accessors %} |
99 const v8::FunctionCallbackInfo<v8::Value>& info | 119 const v8::FunctionCallbackInfo<v8::Value>& info |
100 {%- else %} | 120 {%- else %} |
101 v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info | 121 v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info |
102 {%- endif %}) | 122 {%- endif %}) |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 {% endif %} | 249 {% endif %} |
230 {% if attribute.has_custom_setter %} | 250 {% if attribute.has_custom_setter %} |
231 {{v8_class}}::{{attribute.name}}AttributeSetterCustom(jsValue, info); | 251 {{v8_class}}::{{attribute.name}}AttributeSetterCustom(jsValue, info); |
232 {% else %} | 252 {% else %} |
233 {{cpp_class}}V8Internal::{{attribute.name}}AttributeSetter{{world_suffix}}(j
sValue, info); | 253 {{cpp_class}}V8Internal::{{attribute.name}}AttributeSetter{{world_suffix}}(j
sValue, info); |
234 {% endif %} | 254 {% endif %} |
235 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 255 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
236 } | 256 } |
237 {% endfilter %} | 257 {% endfilter %} |
238 {% endmacro %} | 258 {% endmacro %} |
OLD | NEW |