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 27 matching lines...) Expand all Loading... |
38 {% if attribute.is_call_with_execution_context %} | 38 {% if attribute.is_call_with_execution_context %} |
39 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate
()); | 39 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate
()); |
40 {% endif %} | 40 {% endif %} |
41 {% if attribute.is_call_with_script_state %} | 41 {% if attribute.is_call_with_script_state %} |
42 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); | 42 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); |
43 {% endif %} | 43 {% endif %} |
44 {% if attribute.is_check_security_for_node or | 44 {% if attribute.is_check_security_for_node or |
45 attribute.is_getter_raises_exception %} | 45 attribute.is_getter_raises_exception %} |
46 ExceptionState exceptionState(ExceptionState::GetterContext, "{{attribute.na
me}}", "{{interface_name}}", holder, info.GetIsolate()); | 46 ExceptionState exceptionState(ExceptionState::GetterContext, "{{attribute.na
me}}", "{{interface_name}}", holder, info.GetIsolate()); |
47 {% endif %} | 47 {% endif %} |
48 {% if attribute.is_nullable and not attribute.is_nullable_simple %} | 48 {% if attribute.is_explicit_nullable %} |
49 bool isNull = false; | 49 bool isNull = false; |
50 {% endif %} | 50 {% endif %} |
51 {% if attribute.is_implemented_in_private_script %} | 51 {% if attribute.is_implemented_in_private_script %} |
52 {{attribute.cpp_type}} result; | 52 {{attribute.cpp_type}} result; |
53 if (!{{attribute.cpp_value_original}}) | 53 if (!{{attribute.cpp_value_original}}) |
54 return; | 54 return; |
55 {% elif attribute.cpp_value_original %} | 55 {% elif attribute.cpp_value_original %} |
56 {{attribute.cpp_type}} {{attribute.cpp_value}}({{attribute.cpp_value_origina
l}}); | 56 {{attribute.cpp_type}} {{attribute.cpp_value}}({{attribute.cpp_value_origina
l}}); |
57 {% endif %} | 57 {% endif %} |
58 {# Checks #} | 58 {# Checks #} |
59 {% if attribute.is_getter_raises_exception %} | 59 {% if attribute.is_getter_raises_exception %} |
60 if (UNLIKELY(exceptionState.throwIfNeeded())) | 60 if (UNLIKELY(exceptionState.throwIfNeeded())) |
61 return; | 61 return; |
62 {% endif %} | 62 {% endif %} |
63 {% if attribute.is_check_security_for_node %} | 63 {% if attribute.is_check_security_for_node %} |
64 if (!BindingSecurity::shouldAllowAccessToNode(info.GetIsolate(), {{attribute
.cpp_value}}, exceptionState)) { | 64 if (!BindingSecurity::shouldAllowAccessToNode(info.GetIsolate(), {{attribute
.cpp_value}}, exceptionState)) { |
65 v8SetReturnValueNull(info); | 65 v8SetReturnValueNull(info); |
66 exceptionState.throwIfNeeded(); | 66 exceptionState.throwIfNeeded(); |
67 return; | 67 return; |
68 } | 68 } |
69 {% endif %} | 69 {% endif %} |
70 {% if attribute.reflect_only %} | 70 {% if attribute.reflect_only %} |
71 {{release_only_check(attribute.reflect_only, attribute.reflect_missing, | 71 {{release_only_check(attribute.reflect_only, attribute.reflect_missing, |
72 attribute.reflect_invalid, attribute.reflect_empty, | 72 attribute.reflect_invalid, attribute.reflect_empty, |
73 attribute.cpp_value) | 73 attribute.cpp_value) |
74 | indent}} | 74 | indent}} |
75 {% endif %} | 75 {% endif %} |
76 {% if attribute.is_nullable and not attribute.is_nullable_simple %} | 76 {% if attribute.is_explicit_nullable %} |
77 if (isNull) { | 77 if (isNull) { |
78 v8SetReturnValueNull(info); | 78 v8SetReturnValueNull(info); |
79 return; | 79 return; |
80 } | 80 } |
81 {% endif %} | 81 {% endif %} |
82 {% if attribute.cached_attribute_validation_method %} | 82 {% if attribute.cached_attribute_validation_method %} |
83 V8HiddenValue::setHiddenValue(info.GetIsolate(), holder, propertyName, {{att
ribute.cpp_value_to_v8_value}}); | 83 V8HiddenValue::setHiddenValue(info.GetIsolate(), holder, propertyName, {{att
ribute.cpp_value_to_v8_value}}); |
84 {% endif %} | 84 {% endif %} |
85 {# v8SetReturnValue #} | 85 {# v8SetReturnValue #} |
86 {% if attribute.is_keep_alive_for_gc %} | 86 {% if attribute.is_keep_alive_for_gc %} |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Glob
al(), scriptState->isolate()); | 385 v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Glob
al(), scriptState->isolate()); |
386 | 386 |
387 // FIXME: Support exceptions thrown from Blink-in-JS. | 387 // FIXME: Support exceptions thrown from Blink-in-JS. |
388 v8::TryCatch block; | 388 v8::TryCatch block; |
389 PrivateScriptRunner::runDOMAttributeSetter(scriptState, "{{cpp_class}}", "{{
attribute.name}}", holder, {{attribute.private_script_cpp_value_to_v8_value}}); | 389 PrivateScriptRunner::runDOMAttributeSetter(scriptState, "{{cpp_class}}", "{{
attribute.name}}", holder, {{attribute.private_script_cpp_value_to_v8_value}}); |
390 if (block.HasCaught()) | 390 if (block.HasCaught()) |
391 return false; | 391 return false; |
392 return true; | 392 return true; |
393 } | 393 } |
394 {% endmacro %} | 394 {% endmacro %} |
OLD | NEW |