| 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 %}) { |
| 11 {% filter format_remove_duplicates(['ExceptionState exceptionState']) %} | 11 {% filter format_remove_duplicates(['ExceptionState exceptionState']) %} |
| 12 {% set define_exception_state -%} | 12 {% set define_exception_state -%} |
| 13 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::GetterContext
, "{{interface_name}}", "{{attribute.name}}"); | 13 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kGetterContex
t, "{{interface_name}}", "{{attribute.name}}"); |
| 14 {%- endset %} | 14 {%- endset %} |
| 15 | 15 |
| 16 {% if attribute.is_lenient_this %} | 16 {% if attribute.is_lenient_this %} |
| 17 // [LenientThis] | 17 // [LenientThis] |
| 18 // Make sure that info.Holder() really points to an instance if [LenientThis]. | 18 // Make sure that info.Holder() really points to an instance if [LenientThis]. |
| 19 if (!{{v8_class}}::hasInstance(info.Holder(), info.GetIsolate())) | 19 if (!{{v8_class}}::hasInstance(info.Holder(), info.GetIsolate())) |
| 20 return; // Return silently because of [LenientThis]. | 20 return; // Return silently because of [LenientThis]. |
| 21 {% endif %} | 21 {% endif %} |
| 22 | 22 |
| 23 {% if not attribute.is_static %} | 23 {% if not attribute.is_static %} |
| 24 v8::Local<v8::Object> holder = info.Holder(); | 24 v8::Local<v8::Object> holder = info.Holder(); |
| 25 {% endif %} | 25 {% endif %} |
| 26 | 26 |
| 27 {% if attribute.is_save_same_object %} | 27 {% if attribute.is_save_same_object %} |
| 28 // [SaveSameObject] | 28 // [SaveSameObject] |
| 29 {% set same_object_private_key = interface_name + attribute.name[0]|capitalize
+ attribute.name[1:] %} | 29 {% set same_object_private_key = interface_name + attribute.name[0]|capitalize
+ attribute.name[1:] %} |
| 30 // If you see a compile error that | 30 // If you see a compile error that |
| 31 // V8PrivateProperty::getSameObject{{same_object_private_key}} | 31 // V8PrivateProperty::GetSameObject{{same_object_private_key}} |
| 32 // is not defined, then you need to register your attribute at | 32 // is not defined, then you need to register your attribute at |
| 33 // V8_PRIVATE_PROPERTY_FOR_EACH defined in V8PrivateProperty.h as | 33 // V8_PRIVATE_PROPERTY_FOR_EACH defined in V8PrivateProperty.h as |
| 34 // X(SameObject, {{same_object_private_key}}) | 34 // X(SameObject, {{same_object_private_key}}) |
| 35 auto privateSameObject = V8PrivateProperty::getSameObject{{same_object_private
_key}}(info.GetIsolate()); | 35 auto privateSameObject = V8PrivateProperty::GetSameObject{{same_object_private
_key}}(info.GetIsolate()); |
| 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 {% set local_dom_window_only = interface_name == 'Window' and not attribute.ha
s_cross_origin_getter %} | 46 {% set local_dom_window_only = interface_name == 'Window' and not attribute.ha
s_cross_origin_getter %} |
| 47 {% if local_dom_window_only %} | 47 {% if local_dom_window_only %} |
| 48 {% if attribute.is_check_security_for_receiver %} | 48 {% if attribute.is_check_security_for_receiver %} |
| 49 {{cpp_class}}* uncheckedImpl = {{v8_class}}::toImpl(holder); | 49 {{cpp_class}}* uncheckedImpl = {{v8_class}}::toImpl(holder); |
| 50 {% else %} | 50 {% else %} |
| 51 // Same-origin attribute getters are never exposed via the cross-origin | 51 // Same-origin attribute getters are never exposed via the cross-origin |
| 52 // interceptors. Since same-origin access requires a LocalDOMWindow, it is | 52 // interceptors. Since same-origin access requires a LocalDOMWindow, it is |
| 53 // safe to downcast here. | 53 // safe to downcast here. |
| 54 LocalDOMWindow* impl = toLocalDOMWindow({{v8_class}}::toImpl(holder)); | 54 LocalDOMWindow* impl = ToLocalDOMWindow({{v8_class}}::toImpl(holder)); |
| 55 {% endif %}{# attribute.is_check_security_for_receiver #} | 55 {% endif %}{# attribute.is_check_security_for_receiver #} |
| 56 {% else %} | 56 {% else %} |
| 57 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); | 57 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); |
| 58 {% endif %}{# local_dom_window_only #} | 58 {% endif %}{# local_dom_window_only #} |
| 59 {% endif %}{# not attribute.is_static #} | 59 {% endif %}{# not attribute.is_static #} |
| 60 | 60 |
| 61 {% if attribute.cached_attribute_validation_method %} | 61 {% if attribute.cached_attribute_validation_method %} |
| 62 // [CachedAttribute] | 62 // [CachedAttribute] |
| 63 v8::Local<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "{{attr
ibute.name}}"); | 63 v8::Local<v8::String> propertyName = V8AtomicString(info.GetIsolate(), "{{attr
ibute.name}}"); |
| 64 if (!impl->{{attribute.cached_attribute_validation_method}}()) { | 64 if (!impl->{{attribute.cached_attribute_validation_method}}()) { |
| 65 v8::Local<v8::Value> v8Value = V8HiddenValue::getHiddenValue(ScriptState::fo
rFunctionObject(info), holder, propertyName); | 65 v8::Local<v8::Value> v8Value = V8HiddenValue::GetHiddenValue(ScriptState::Fo
rFunctionObject(info), holder, propertyName); |
| 66 if (!v8Value.IsEmpty() && !v8Value->IsUndefined()) { | 66 if (!v8Value.IsEmpty() && !v8Value->IsUndefined()) { |
| 67 v8SetReturnValue(info, v8Value); | 67 V8SetReturnValue(info, v8Value); |
| 68 return; | 68 return; |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 {% endif %} | 71 {% endif %} |
| 72 | 72 |
| 73 {% if attribute.is_check_security_for_receiver and not attribute.is_data_type_
property %} | 73 {% if attribute.is_check_security_for_receiver and not attribute.is_data_type_
property %} |
| 74 // Perform a security check for the receiver object. | 74 // Perform a security check for the receiver object. |
| 75 {{define_exception_state}} | 75 {{define_exception_state}} |
| 76 {% if local_dom_window_only %} | 76 {% if local_dom_window_only %} |
| 77 if (!BindingSecurity::shouldAllowAccessTo(currentDOMWindow(info.GetIsolate()),
uncheckedImpl, exceptionState)) { | 77 if (!BindingSecurity::ShouldAllowAccessTo(CurrentDOMWindow(info.GetIsolate()),
uncheckedImpl, exceptionState)) { |
| 78 {% else %} | 78 {% else %} |
| 79 if (!BindingSecurity::shouldAllowAccessTo(currentDOMWindow(info.GetIsolate()),
impl, exceptionState)) { | 79 if (!BindingSecurity::ShouldAllowAccessTo(CurrentDOMWindow(info.GetIsolate()),
impl, exceptionState)) { |
| 80 {% endif %}{# local_dom_window_only #} | 80 {% endif %}{# local_dom_window_only #} |
| 81 v8SetReturnValueNull(info); | 81 V8SetReturnValueNull(info); |
| 82 return; | 82 return; |
| 83 } | 83 } |
| 84 {% if local_dom_window_only %} | 84 {% if local_dom_window_only %} |
| 85 LocalDOMWindow* impl = toLocalDOMWindow(uncheckedImpl); | 85 LocalDOMWindow* impl = ToLocalDOMWindow(uncheckedImpl); |
| 86 {% endif %}{# local_dom_window_only #} | 86 {% endif %}{# local_dom_window_only #} |
| 87 {% endif %} | 87 {% endif %} |
| 88 | 88 |
| 89 {% if attribute.is_check_security_for_return_value %} | 89 {% if attribute.is_check_security_for_return_value %} |
| 90 // Perform a security check for the returned object. | 90 // Perform a security check for the returned object. |
| 91 {{define_exception_state}} | 91 {{define_exception_state}} |
| 92 if (!BindingSecurity::shouldAllowAccessTo(currentDOMWindow(info.GetIsolate()),
{{attribute.cpp_value}}, exceptionState)) { | 92 if (!BindingSecurity::ShouldAllowAccessTo(CurrentDOMWindow(info.GetIsolate()),
{{attribute.cpp_value}}, exceptionState)) { |
| 93 v8SetReturnValueNull(info); | 93 V8SetReturnValueNull(info); |
| 94 return; | 94 return; |
| 95 } | 95 } |
| 96 {% endif %} | 96 {% endif %} |
| 97 | 97 |
| 98 {% if attribute.is_call_with_execution_context %} | 98 {% if attribute.is_call_with_execution_context %} |
| 99 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()
); | 99 ExecutionContext* executionContext = CurrentExecutionContext(info.GetIsolate()
); |
| 100 {% endif %} | 100 {% endif %} |
| 101 {% if attribute.is_call_with_script_state %} | 101 {% if attribute.is_call_with_script_state %} |
| 102 {% if attribute.is_static %} | 102 {% if attribute.is_static %} |
| 103 ScriptState* scriptState = ScriptState::forFunctionObject(info); | 103 ScriptState* scriptState = ScriptState::ForFunctionObject(info); |
| 104 {% else %} | 104 {% else %} |
| 105 ScriptState* scriptState = ScriptState::forReceiverObject(info); | 105 ScriptState* scriptState = ScriptState::ForReceiverObject(info); |
| 106 {% endif %} | 106 {% endif %} |
| 107 {% endif %} | 107 {% endif %} |
| 108 {% if attribute.is_getter_raises_exception %} | 108 {% if attribute.is_getter_raises_exception %} |
| 109 {{define_exception_state}} | 109 {{define_exception_state}} |
| 110 {% endif %} | 110 {% endif %} |
| 111 {% if attribute.is_explicit_nullable %} | 111 {% if attribute.is_explicit_nullable %} |
| 112 bool isNull = false; | 112 bool isNull = false; |
| 113 {% endif %} | 113 {% endif %} |
| 114 | 114 |
| 115 {% if attribute.cpp_value_original %} | 115 {% if attribute.cpp_value_original %} |
| 116 {{attribute.cpp_type}} {{attribute.cpp_value}}({{attribute.cpp_value_original}
}); | 116 {{attribute.cpp_type}} {{attribute.cpp_value}}({{attribute.cpp_value_original}
}); |
| 117 {% endif %} | 117 {% endif %} |
| 118 | 118 |
| 119 {% if attribute.use_output_parameter_for_result %} | 119 {% if attribute.use_output_parameter_for_result %} |
| 120 {{attribute.cpp_type}} result; | 120 {{attribute.cpp_type}} result; |
| 121 {{attribute.cpp_value}}; | 121 {{attribute.cpp_value}}; |
| 122 {% endif %} | 122 {% endif %} |
| 123 | 123 |
| 124 {% if attribute.is_getter_raises_exception %} | 124 {% if attribute.is_getter_raises_exception %} |
| 125 if (UNLIKELY(exceptionState.hadException())) | 125 if (UNLIKELY(exceptionState.HadException())) |
| 126 return; | 126 return; |
| 127 {% endif %} | 127 {% endif %} |
| 128 | 128 |
| 129 {% if attribute.reflect_only %} | 129 {% if attribute.reflect_only %} |
| 130 {{release_only_check(attribute.reflect_only, attribute.reflect_missing, | 130 {{release_only_check(attribute.reflect_only, attribute.reflect_missing, |
| 131 attribute.reflect_invalid, attribute.reflect_empty, | 131 attribute.reflect_invalid, attribute.reflect_empty, |
| 132 attribute.cpp_value) | 132 attribute.cpp_value) |
| 133 | indent(2)}} | 133 | indent(2)}} |
| 134 {% endif %} | 134 {% endif %} |
| 135 | 135 |
| 136 {% if attribute.cached_attribute_validation_method %} | 136 {% if attribute.cached_attribute_validation_method %} |
| 137 // [CachedAttribute] | 137 // [CachedAttribute] |
| 138 v8::Local<v8::Value> v8Value({{attribute.cpp_value_to_v8_value}}); | 138 v8::Local<v8::Value> v8Value({{attribute.cpp_value_to_v8_value}}); |
| 139 V8HiddenValue::setHiddenValue(ScriptState::forFunctionObject(info), holder, pr
opertyName, v8Value); | 139 V8HiddenValue::SetHiddenValue(ScriptState::ForFunctionObject(info), holder, pr
opertyName, v8Value); |
| 140 {% endif %} | 140 {% endif %} |
| 141 | 141 |
| 142 {% if attribute.is_explicit_nullable %} | 142 {% if attribute.is_explicit_nullable %} |
| 143 if (isNull) { | 143 if (isNull) { |
| 144 v8SetReturnValueNull(info); | 144 V8SetReturnValueNull(info); |
| 145 return; | 145 return; |
| 146 } | 146 } |
| 147 {% endif %} | 147 {% endif %} |
| 148 | 148 |
| 149 {% if attribute.is_keep_alive_for_gc %} | 149 {% if attribute.is_keep_alive_for_gc %} |
| 150 // Keep the wrapper object for the return value alive as long as |this| | 150 // Keep the wrapper object for the return value alive as long as |this| |
| 151 // object is alive in order to save creation time of the wrapper object. | 151 // object is alive in order to save creation time of the wrapper object. |
| 152 if ({{attribute.cpp_value}} && DOMDataStore::setReturnValue{{world_suffix}}(in
fo.GetReturnValue(), {{attribute.cpp_value}})) | 152 if ({{attribute.cpp_value}} && DOMDataStore::SetReturnValue{{world_suffix}}(in
fo.GetReturnValue(), {{attribute.cpp_value}})) |
| 153 return; | 153 return; |
| 154 v8::Local<v8::Value> v8Value(ToV8({{attribute.cpp_value}}, holder, info.GetIso
late())); | 154 v8::Local<v8::Value> v8Value(ToV8({{attribute.cpp_value}}, holder, info.GetIso
late())); |
| 155 const char kKeepAliveKey[] = "KeepAlive#{{interface_name}}#{{attribute.name}}"
; | 155 const char kKeepAliveKey[] = "KeepAlive#{{interface_name}}#{{attribute.name}}"
; |
| 156 V8HiddenValue::setHiddenValue(ScriptState::current(info.GetIsolate()), holder,
v8AtomicString(info.GetIsolate(), StringView(kKeepAliveKey, sizeof kKeepAliveKe
y)), v8Value); | 156 V8HiddenValue::SetHiddenValue(ScriptState::Current(info.GetIsolate()), holder,
V8AtomicString(info.GetIsolate(), StringView(kKeepAliveKey, sizeof kKeepAliveKe
y)), v8Value); |
| 157 {% endif %} | 157 {% endif %} |
| 158 | 158 |
| 159 {% if world_suffix %} | 159 {% if world_suffix %} |
| 160 {{attribute.v8_set_return_value_for_main_world}}; | 160 {{attribute.v8_set_return_value_for_main_world}}; |
| 161 {% else %} | 161 {% else %} |
| 162 {{attribute.v8_set_return_value}}; | 162 {{attribute.v8_set_return_value}}; |
| 163 {% endif %} | 163 {% endif %} |
| 164 | 164 |
| 165 {% if attribute.is_save_same_object %} | 165 {% if attribute.is_save_same_object %} |
| 166 // [SaveSameObject] | 166 // [SaveSameObject] |
| 167 privateSameObject.set(info.GetIsolate()->GetCurrentContext(), holder, info.Get
ReturnValue().Get()); | 167 privateSameObject.Set(info.GetIsolate()->GetCurrentContext(), holder, info.Get
ReturnValue().Get()); |
| 168 {% endif %} | 168 {% endif %} |
| 169 {% endfilter %}{# format_remove_duplicates #} | 169 {% endfilter %}{# format_remove_duplicates #} |
| 170 } | 170 } |
| 171 {% endmacro %} | 171 {% endmacro %} |
| 172 | 172 |
| 173 | 173 |
| 174 {######################################} | 174 {######################################} |
| 175 {% macro release_only_check(reflect_only_values, reflect_missing, | 175 {% macro release_only_check(reflect_only_values, reflect_missing, |
| 176 reflect_invalid, reflect_empty, cpp_value) %} | 176 reflect_invalid, reflect_empty, cpp_value) %} |
| 177 {# Attribute is limited to only known values: check that the attribute value is | 177 {# Attribute is limited to only known values: check that the attribute value is |
| 178 one of those. If not, set it to the empty string. | 178 one of those. If not, set it to the empty string. |
| 179 http://www.whatwg.org/specs/web-apps/current-work/#limited-to-only-known-valu
es #} | 179 http://www.whatwg.org/specs/web-apps/current-work/#limited-to-only-known-valu
es #} |
| 180 {% if reflect_empty %} | 180 {% if reflect_empty %} |
| 181 if ({{cpp_value}}.isNull()) { | 181 if ({{cpp_value}}.IsNull()) { |
| 182 {% if reflect_missing %} | 182 {% if reflect_missing %} |
| 183 {{cpp_value}} = "{{reflect_missing}}"; | 183 {{cpp_value}} = "{{reflect_missing}}"; |
| 184 {% else %} | 184 {% else %} |
| 185 ; | 185 ; |
| 186 {% endif %} | 186 {% endif %} |
| 187 } else if ({{cpp_value}}.isEmpty()) { | 187 } else if ({{cpp_value}}.IsEmpty()) { |
| 188 {{cpp_value}} = "{{reflect_empty}}"; | 188 {{cpp_value}} = "{{reflect_empty}}"; |
| 189 {% else %} | 189 {% else %} |
| 190 if ({{cpp_value}}.isEmpty()) { | 190 if ({{cpp_value}}.IsEmpty()) { |
| 191 {# FIXME: should use [ReflectEmpty] instead; need to change IDL files #} | 191 {# FIXME: should use [ReflectEmpty] instead; need to change IDL files #} |
| 192 {% if reflect_missing %} | 192 {% if reflect_missing %} |
| 193 {{cpp_value}} = "{{reflect_missing}}"; | 193 {{cpp_value}} = "{{reflect_missing}}"; |
| 194 {% else %} | 194 {% else %} |
| 195 ; | 195 ; |
| 196 {% endif %} | 196 {% endif %} |
| 197 {% endif %} | 197 {% endif %} |
| 198 {% for value in reflect_only_values %} | 198 {% for value in reflect_only_values %} |
| 199 } else if (equalIgnoringASCIICase({{cpp_value}}, "{{value}}")) { | 199 } else if (EqualIgnoringASCIICase({{cpp_value}}, "{{value}}")) { |
| 200 {{cpp_value}} = "{{value}}"; | 200 {{cpp_value}} = "{{value}}"; |
| 201 {% endfor %} | 201 {% endfor %} |
| 202 } else { | 202 } else { |
| 203 {{cpp_value}} = "{{reflect_invalid}}"; | 203 {{cpp_value}} = "{{reflect_invalid}}"; |
| 204 } | 204 } |
| 205 {% endmacro %} | 205 {% endmacro %} |
| 206 | 206 |
| 207 | 207 |
| 208 {##############################################################################} | 208 {##############################################################################} |
| 209 {% macro attribute_getter_callback(attribute, world_suffix) %} | 209 {% macro attribute_getter_callback(attribute, world_suffix) %} |
| 210 void {{v8_class_or_partial}}::{{attribute.name}}AttributeGetterCallback{{world_s
uffix}}( | 210 void {{v8_class_or_partial}}::{{attribute.name}}AttributeGetterCallback{{world_s
uffix}}( |
| 211 {%- if attribute.is_data_type_property %} | 211 {%- if attribute.is_data_type_property %} |
| 212 v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info | 212 v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info |
| 213 {%- else %} | 213 {%- else %} |
| 214 const v8::FunctionCallbackInfo<v8::Value>& info | 214 const v8::FunctionCallbackInfo<v8::Value>& info |
| 215 {%- endif %}) { | 215 {%- endif %}) { |
| 216 {% if attribute.deprecate_as %} | 216 {% if attribute.deprecate_as %} |
| 217 Deprecation::countDeprecation(currentExecutionContext(info.GetIsolate()), UseC
ounter::{{attribute.deprecate_as}}); | 217 Deprecation::CountDeprecation(CurrentExecutionContext(info.GetIsolate()), UseC
ounter::k{{attribute.deprecate_as}}); |
| 218 {% endif %} | 218 {% endif %} |
| 219 | 219 |
| 220 {% if attribute.measure_as %} | 220 {% if attribute.measure_as %} |
| 221 UseCounter::count(currentExecutionContext(info.GetIsolate()), UseCounter::{{at
tribute.measure_as('AttributeGetter')}}); | 221 UseCounter::Count(CurrentExecutionContext(info.GetIsolate()), UseCounter::k{{a
ttribute.measure_as('AttributeGetter')}}); |
| 222 {% endif %} | 222 {% endif %} |
| 223 | 223 |
| 224 {% if world_suffix in attribute.activity_logging_world_list_for_getter %} | 224 {% if world_suffix in attribute.activity_logging_world_list_for_getter %} |
| 225 {% if attribute.is_static %} | 225 {% if attribute.is_static %} |
| 226 ScriptState* scriptState = ScriptState::forFunctionObject(info); | 226 ScriptState* scriptState = ScriptState::ForFunctionObject(info); |
| 227 {% else %} | 227 {% else %} |
| 228 ScriptState* scriptState = ScriptState::forReceiverObject(info); | 228 ScriptState* scriptState = ScriptState::ForReceiverObject(info); |
| 229 {% endif %} | 229 {% endif %} |
| 230 V8PerContextData* contextData = scriptState->perContextData(); | 230 V8PerContextData* contextData = scriptState->PerContextData(); |
| 231 if ( | 231 if ( |
| 232 {%- if attribute.activity_logging_world_check -%} | 232 {%- if attribute.activity_logging_world_check -%} |
| 233 scriptState->world().isIsolatedWorld() && {# one space at the end #} | 233 scriptState->World().IsIsolatedWorld() && {# one space at the end #} |
| 234 {%- endif -%} | 234 {%- endif -%} |
| 235 contextData && contextData->activityLogger()) { | 235 contextData && contextData->ActivityLogger()) { |
| 236 contextData->activityLogger()->logGetter("{{interface_name}}.{{attribute.nam
e}}"); | 236 contextData->ActivityLogger()->LogGetter("{{interface_name}}.{{attribute.nam
e}}"); |
| 237 } | 237 } |
| 238 {% endif %} | 238 {% endif %} |
| 239 | 239 |
| 240 {% if attribute.has_custom_getter %} | 240 {% if attribute.has_custom_getter %} |
| 241 {{v8_class}}::{{attribute.name}}AttributeGetterCustom(info); | 241 {{v8_class}}::{{attribute.name}}AttributeGetterCustom(info); |
| 242 {% else %} | 242 {% else %} |
| 243 {{cpp_class_or_partial}}V8Internal::{{attribute.name}}AttributeGetter{{world_s
uffix}}(info); | 243 {{cpp_class_or_partial}}V8Internal::{{attribute.name}}AttributeGetter{{world_s
uffix}}(info); |
| 244 {% endif %} | 244 {% endif %} |
| 245 } | 245 } |
| 246 {% endmacro %} | 246 {% endmacro %} |
| 247 | 247 |
| 248 | 248 |
| 249 {##############################################################################} | 249 {##############################################################################} |
| 250 {% macro attribute_cache_property_callback(attribute) %} | 250 {% macro attribute_cache_property_callback(attribute) %} |
| 251 v8::Local<v8::Private> {{v8_class_or_partial}}::{{attribute.name}}CachedAccessor
Callback(v8::Isolate* isolate) | 251 v8::Local<v8::Private> {{v8_class_or_partial}}::{{attribute.name}}CachedAccessor
Callback(v8::Isolate* isolate) |
| 252 { | 252 { |
| 253 return V8PrivateProperty::get{{attribute.cached_accessor_name}}(isolate).get
Private(); | 253 return V8PrivateProperty::Get{{attribute.cached_accessor_name}}(isolate).Get
Private(); |
| 254 } | 254 } |
| 255 {% endmacro %} | 255 {% endmacro %} |
| 256 | 256 |
| 257 | 257 |
| 258 {##############################################################################} | 258 {##############################################################################} |
| 259 {% macro constructor_getter_callback(attribute, world_suffix) %} | 259 {% macro constructor_getter_callback(attribute, world_suffix) %} |
| 260 void {{v8_class_or_partial}}::{{attribute.name}}ConstructorGetterCallback{{world
_suffix}}(v8::Local<v8::Name> property, const v8::PropertyCallbackInfo<v8::Value
>& info) { | 260 void {{v8_class_or_partial}}::{{attribute.name}}ConstructorGetterCallback{{world
_suffix}}(v8::Local<v8::Name> property, const v8::PropertyCallbackInfo<v8::Value
>& info) { |
| 261 {% if attribute.deprecate_as %} | 261 {% if attribute.deprecate_as %} |
| 262 Deprecation::countDeprecation(currentExecutionContext(info.GetIsolate()), UseC
ounter::{{attribute.deprecate_as}}); | 262 Deprecation::CountDeprecation(CurrentExecutionContext(info.GetIsolate()), UseC
ounter::k{{attribute.deprecate_as}}); |
| 263 {% endif %} | 263 {% endif %} |
| 264 | 264 |
| 265 {% if attribute.measure_as %} | 265 {% if attribute.measure_as %} |
| 266 UseCounter::count(currentExecutionContext(info.GetIsolate()), UseCounter::{{at
tribute.measure_as('ConstructorGetter')}}); | 266 UseCounter::Count(CurrentExecutionContext(info.GetIsolate()), UseCounter::k{{a
ttribute.measure_as('ConstructorGetter')}}); |
| 267 {% endif %} | 267 {% endif %} |
| 268 | 268 |
| 269 v8ConstructorAttributeGetter(property, info); | 269 V8ConstructorAttributeGetter(property, info); |
| 270 } | 270 } |
| 271 {% endmacro %} | 271 {% endmacro %} |
| 272 | 272 |
| 273 | 273 |
| 274 {##############################################################################} | 274 {##############################################################################} |
| 275 {% macro attribute_setter(attribute, world_suffix) %} | 275 {% macro attribute_setter(attribute, world_suffix) %} |
| 276 static void {{attribute.name}}AttributeSetter{{world_suffix}}( | 276 static void {{attribute.name}}AttributeSetter{{world_suffix}}( |
| 277 {%- if attribute.has_cross_origin_setter %} | 277 {%- if attribute.has_cross_origin_setter %} |
| 278 v8::Local<v8::Value> v8Value, const V8CrossOriginSetterInfo& info | 278 v8::Local<v8::Value> v8Value, const V8CrossOriginSetterInfo& info |
| 279 {%- elif attribute.is_data_type_property %} | 279 {%- elif attribute.is_data_type_property %} |
| 280 v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info | 280 v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info |
| 281 {%- else %} | 281 {%- else %} |
| 282 v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info | 282 v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info |
| 283 {%- endif %}) { | 283 {%- endif %}) { |
| 284 {% filter format_remove_duplicates(['ExceptionState exceptionState']) %} | 284 {% filter format_remove_duplicates(['ExceptionState exceptionState']) %} |
| 285 {% set define_exception_state -%} | 285 {% set define_exception_state -%} |
| 286 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::SetterContext
, "{{interface_name}}", "{{attribute.name}}"); | 286 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kSetterContex
t, "{{interface_name}}", "{{attribute.name}}"); |
| 287 {%- endset %} | 287 {%- endset %} |
| 288 | 288 |
| 289 {% if attribute.is_lenient_this %} | 289 {% if attribute.is_lenient_this %} |
| 290 // [LenientThis] | 290 // [LenientThis] |
| 291 // Make sure that info.Holder() really points to an instance if [LenientThis]. | 291 // Make sure that info.Holder() really points to an instance if [LenientThis]. |
| 292 if (!{{v8_class}}::hasInstance(info.Holder(), info.GetIsolate())) | 292 if (!{{v8_class}}::hasInstance(info.Holder(), info.GetIsolate())) |
| 293 return; // Return silently because of [LenientThis]. | 293 return; // Return silently because of [LenientThis]. |
| 294 {% endif %} | 294 {% endif %} |
| 295 | 295 |
| 296 {% if not attribute.is_static and not attribute.is_replaceable %} | 296 {% if not attribute.is_static and not attribute.is_replaceable %} |
| 297 v8::Local<v8::Object> holder = info.Holder(); | 297 v8::Local<v8::Object> holder = info.Holder(); |
| 298 {% if attribute.is_put_forwards %} | 298 {% if attribute.is_put_forwards %} |
| 299 {{cpp_class}}* proxyImpl = {{v8_class}}::toImpl(holder); | 299 {{cpp_class}}* proxyImpl = {{v8_class}}::toImpl(holder); |
| 300 {{attribute.cpp_type}} impl = WTF::getPtr(proxyImpl->{{attribute.name}}()); | 300 {{attribute.cpp_type}} impl = WTF::GetPtr(proxyImpl->{{attribute.name}}()); |
| 301 if (!impl) | 301 if (!impl) |
| 302 return; | 302 return; |
| 303 {% else %} | 303 {% else %} |
| 304 {% set local_dom_window_only = interface_name == 'Window' and not attribute.ha
s_cross_origin_setter %} | 304 {% set local_dom_window_only = interface_name == 'Window' and not attribute.ha
s_cross_origin_setter %} |
| 305 {% if local_dom_window_only %} | 305 {% if local_dom_window_only %} |
| 306 {% if attribute.is_check_security_for_receiver %} | 306 {% if attribute.is_check_security_for_receiver %} |
| 307 {{cpp_class}}* uncheckedImpl = {{v8_class}}::toImpl(holder); | 307 {{cpp_class}}* uncheckedImpl = {{v8_class}}::toImpl(holder); |
| 308 {% else %} | 308 {% else %} |
| 309 // Same-origin attributes setters are never exposed via the cross-origin | 309 // Same-origin attributes setters are never exposed via the cross-origin |
| 310 // interceptors. Since same-origin access requires a LocalDOMWindow, it is | 310 // interceptors. Since same-origin access requires a LocalDOMWindow, it is |
| 311 // safe to downcast here. | 311 // safe to downcast here. |
| 312 LocalDOMWindow* impl = toLocalDOMWindow({{v8_class}}::toImpl(holder)); | 312 LocalDOMWindow* impl = ToLocalDOMWindow({{v8_class}}::toImpl(holder)); |
| 313 {% endif %}{# attribute.is_check_security_for_receiver #} | 313 {% endif %}{# attribute.is_check_security_for_receiver #} |
| 314 {% else %} | 314 {% else %} |
| 315 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); | 315 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); |
| 316 {% endif %}{# local_dom_window_only #} | 316 {% endif %}{# local_dom_window_only #} |
| 317 {% endif %} | 317 {% endif %} |
| 318 {% endif %} | 318 {% endif %} |
| 319 | 319 |
| 320 {% if attribute.is_check_security_for_receiver and not attribute.is_data_type_
property %} | 320 {% if attribute.is_check_security_for_receiver and not attribute.is_data_type_
property %} |
| 321 // Perform a security check for the receiver object. | 321 // Perform a security check for the receiver object. |
| 322 {{define_exception_state}} | 322 {{define_exception_state}} |
| 323 {% if local_dom_window_only %} | 323 {% if local_dom_window_only %} |
| 324 if (!BindingSecurity::shouldAllowAccessTo(currentDOMWindow(info.GetIsolate()),
uncheckedImpl, exceptionState)) { | 324 if (!BindingSecurity::ShouldAllowAccessTo(CurrentDOMWindow(info.GetIsolate()),
uncheckedImpl, exceptionState)) { |
| 325 {% else %} | 325 {% else %} |
| 326 if (!BindingSecurity::shouldAllowAccessTo(currentDOMWindow(info.GetIsolate()),
impl, exceptionState)) { | 326 if (!BindingSecurity::ShouldAllowAccessTo(CurrentDOMWindow(info.GetIsolate()),
impl, exceptionState)) { |
| 327 {% endif %}{# local_dom_window_only #} | 327 {% endif %}{# local_dom_window_only #} |
| 328 v8SetReturnValue(info, v8Value); | 328 V8SetReturnValue(info, v8Value); |
| 329 return; | 329 return; |
| 330 } | 330 } |
| 331 {% if local_dom_window_only %} | 331 {% if local_dom_window_only %} |
| 332 LocalDOMWindow* impl = toLocalDOMWindow(uncheckedImpl); | 332 LocalDOMWindow* impl = ToLocalDOMWindow(uncheckedImpl); |
| 333 {% endif %}{# local_dom_window_only #} | 333 {% endif %}{# local_dom_window_only #} |
| 334 {% endif %} | 334 {% endif %} |
| 335 | 335 |
| 336 {% if attribute.is_check_security_for_return_value %} | 336 {% if attribute.is_check_security_for_return_value %} |
| 337 #error Attribute setter with the security check for the return value is not supp
orted. Since the return value is the given value to be set, it\'s meaningless t
o perform the security check for the return value. | 337 #error Attribute setter with the security check for the return value is not supp
orted. Since the return value is the given value to be set, it\'s meaningless t
o perform the security check for the return value. |
| 338 {% endif %} | 338 {% endif %} |
| 339 | 339 |
| 340 {% if attribute.is_custom_element_callbacks or | 340 {% if attribute.is_custom_element_callbacks or |
| 341 (attribute.is_reflect and not (attribute.idl_type == 'DOMString' and is_
node)) %} | 341 (attribute.is_reflect and not (attribute.idl_type == 'DOMString' and is_
node)) %} |
| 342 // Skip on compact node DOMString getters. | 342 // Skip on compact node DOMString getters. |
| 343 V0CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; | 343 V0CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; |
| 344 {% endif %} | 344 {% endif %} |
| 345 | 345 |
| 346 {% if attribute.has_setter_exception_state %} | 346 {% if attribute.has_setter_exception_state %} |
| 347 {{define_exception_state}} | 347 {{define_exception_state}} |
| 348 {% endif %} | 348 {% endif %} |
| 349 | 349 |
| 350 // Prepare the value to be set. | 350 // Prepare the value to be set. |
| 351 {% if attribute.idl_type == 'EventHandler' %} | 351 {% if attribute.idl_type == 'EventHandler' %} |
| 352 {% if not is_node %} | 352 {% if not is_node %} |
| 353 moveEventListenerToNewWrapper(info.GetIsolate(), holder, {{attribute.event_han
dler_getter_expression}}, v8Value, {{v8_class}}::eventListenerCacheIndex); | 353 MoveEventListenerToNewWrapper(info.GetIsolate(), holder, {{attribute.event_han
dler_getter_expression}}, v8Value, {{v8_class}}::eventListenerCacheIndex); |
| 354 {% endif %} | 354 {% endif %} |
| 355 {% else %}{# not EventHandler #} | 355 {% else %}{# not EventHandler #} |
| 356 {{v8_value_to_local_cpp_value(attribute) | indent(2)}} | 356 {{v8_value_to_local_cpp_value(attribute) | indent(2)}} |
| 357 {% endif %} | 357 {% endif %} |
| 358 | 358 |
| 359 {% if attribute.has_type_checking_interface %} | 359 {% if attribute.has_type_checking_interface %} |
| 360 // Type check per: http://heycam.github.io/webidl/#es-interface | 360 // Type check per: http://heycam.github.io/webidl/#es-interface |
| 361 if (!cppValue{% if attribute.is_nullable %} && !isUndefinedOrNull(v8Value){% e
ndif %}) { | 361 if (!cppValue{% if attribute.is_nullable %} && !IsUndefinedOrNull(v8Value){% e
ndif %}) { |
| 362 exceptionState.throwTypeError("The provided value is not of type '{{attribut
e.idl_type}}'."); | 362 exceptionState.ThrowTypeError("The provided value is not of type '{{attribut
e.idl_type}}'."); |
| 363 return; | 363 return; |
| 364 } | 364 } |
| 365 {% endif %} | 365 {% endif %} |
| 366 | 366 |
| 367 {% if attribute.enum_values %} | 367 {% if attribute.enum_values %} |
| 368 // Type check per: http://heycam.github.io/webidl/#dfn-attribute-setter | 368 // Type check per: http://heycam.github.io/webidl/#dfn-attribute-setter |
| 369 // Returns undefined without setting the value if the value is invalid. | 369 // Returns undefined without setting the value if the value is invalid. |
| 370 DummyExceptionStateForTesting dummyExceptionState; | 370 DummyExceptionStateForTesting dummyExceptionState; |
| 371 {{declare_enum_validation_variable(attribute.enum_values) | indent(2)}} | 371 {{declare_enum_validation_variable(attribute.enum_values) | indent(2)}} |
| 372 if (!isValidEnum(cppValue, validValues, WTF_ARRAY_LENGTH(validValues), "{{attr
ibute.enum_type}}", dummyExceptionState)) { | 372 if (!IsValidEnum(cppValue, validValues, WTF_ARRAY_LENGTH(validValues), "{{attr
ibute.enum_type}}", dummyExceptionState)) { |
| 373 currentExecutionContext(info.GetIsolate())->addConsoleMessage(ConsoleMessage
::create(JSMessageSource, WarningMessageLevel, dummyExceptionState.message())); | 373 CurrentExecutionContext(info.GetIsolate())->AddConsoleMessage(ConsoleMessage
::Create(kJSMessageSource, kWarningMessageLevel, dummyExceptionState.Message()))
; |
| 374 return; | 374 return; |
| 375 } | 375 } |
| 376 {% endif %} | 376 {% endif %} |
| 377 | 377 |
| 378 {% if attribute.is_call_with_execution_context or attribute.is_setter_call_wit
h_execution_context %} | 378 {% if attribute.is_call_with_execution_context or attribute.is_setter_call_wit
h_execution_context %} |
| 379 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()
); | 379 ExecutionContext* executionContext = CurrentExecutionContext(info.GetIsolate()
); |
| 380 {% endif %} | 380 {% endif %} |
| 381 | 381 |
| 382 {% if attribute.is_call_with_script_state %} | 382 {% if attribute.is_call_with_script_state %} |
| 383 {% if attribute.is_static %} | 383 {% if attribute.is_static %} |
| 384 ScriptState* scriptState = ScriptState::forFunctionObject(info); | 384 ScriptState* scriptState = ScriptState::ForFunctionObject(info); |
| 385 {% else %} | 385 {% else %} |
| 386 ScriptState* scriptState = ScriptState::forReceiverObject(info); | 386 ScriptState* scriptState = ScriptState::ForReceiverObject(info); |
| 387 {% endif %} | 387 {% endif %} |
| 388 {% endif %} | 388 {% endif %} |
| 389 | 389 |
| 390 {% if attribute.is_replaceable %} | 390 {% if attribute.is_replaceable %} |
| 391 v8::Local<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "{{attr
ibute.name}}"); | 391 v8::Local<v8::String> propertyName = V8AtomicString(info.GetIsolate(), "{{attr
ibute.name}}"); |
| 392 {% endif %} | 392 {% endif %} |
| 393 {{attribute.cpp_setter}}; | 393 {{attribute.cpp_setter}}; |
| 394 | 394 |
| 395 {% if attribute.cached_attribute_validation_method %} | 395 {% if attribute.cached_attribute_validation_method %} |
| 396 // [CachedAttribute] | 396 // [CachedAttribute] |
| 397 // Invalidate the cached value. | 397 // Invalidate the cached value. |
| 398 V8HiddenValue::deleteHiddenValue(ScriptState::forFunctionObject(info), holder,
v8AtomicString(info.GetIsolate(), "{{attribute.name}}")); | 398 V8HiddenValue::DeleteHiddenValue(ScriptState::ForFunctionObject(info), holder,
V8AtomicString(info.GetIsolate(), "{{attribute.name}}")); |
| 399 {% endif %} | 399 {% endif %} |
| 400 } | 400 } |
| 401 {% endfilter %}{# format_remove_duplicates #} | 401 {% endfilter %}{# format_remove_duplicates #} |
| 402 {% endmacro %} | 402 {% endmacro %} |
| 403 | 403 |
| 404 | 404 |
| 405 {##############################################################################} | 405 {##############################################################################} |
| 406 {% macro attribute_setter_callback(attribute, world_suffix) %} | 406 {% macro attribute_setter_callback(attribute, world_suffix) %} |
| 407 void {{v8_class_or_partial}}::{{attribute.name}}AttributeSetterCallback{{world_s
uffix}}( | 407 void {{v8_class_or_partial}}::{{attribute.name}}AttributeSetterCallback{{world_s
uffix}}( |
| 408 {%- if attribute.is_data_type_property %} | 408 {%- if attribute.is_data_type_property %} |
| 409 v8::Local<v8::Name>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInf
o<void>& info | 409 v8::Local<v8::Name>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInf
o<void>& info |
| 410 {%- else %} | 410 {%- else %} |
| 411 const v8::FunctionCallbackInfo<v8::Value>& info | 411 const v8::FunctionCallbackInfo<v8::Value>& info |
| 412 {%- endif %}) { | 412 {%- endif %}) { |
| 413 {% if not attribute.is_data_type_property %} | 413 {% if not attribute.is_data_type_property %} |
| 414 v8::Local<v8::Value> v8Value = info[0]; | 414 v8::Local<v8::Value> v8Value = info[0]; |
| 415 {% endif %} | 415 {% endif %} |
| 416 | 416 |
| 417 {% if attribute.deprecate_as %} | 417 {% if attribute.deprecate_as %} |
| 418 Deprecation::countDeprecation(currentExecutionContext(info.GetIsolate()), UseC
ounter::{{attribute.deprecate_as}}); | 418 Deprecation::CountDeprecation(CurrentExecutionContext(info.GetIsolate()), UseC
ounter::k{{attribute.deprecate_as}}); |
| 419 {% endif %} | 419 {% endif %} |
| 420 | 420 |
| 421 {% if attribute.measure_as %} | 421 {% if attribute.measure_as %} |
| 422 UseCounter::count(currentExecutionContext(info.GetIsolate()), UseCounter::{{at
tribute.measure_as('AttributeSetter')}}); | 422 UseCounter::Count(CurrentExecutionContext(info.GetIsolate()), UseCounter::k{{a
ttribute.measure_as('AttributeSetter')}}); |
| 423 {% endif %} | 423 {% endif %} |
| 424 | 424 |
| 425 {% if world_suffix in attribute.activity_logging_world_list_for_setter %} | 425 {% if world_suffix in attribute.activity_logging_world_list_for_setter %} |
| 426 {% if attribute.is_static %} | 426 {% if attribute.is_static %} |
| 427 ScriptState* scriptState = ScriptState::forFunctionObject(info); | 427 ScriptState* scriptState = ScriptState::ForFunctionObject(info); |
| 428 {% else %} | 428 {% else %} |
| 429 ScriptState* scriptState = ScriptState::forReceiverObject(info); | 429 ScriptState* scriptState = ScriptState::ForReceiverObject(info); |
| 430 {% endif %} | 430 {% endif %} |
| 431 V8PerContextData* contextData = scriptState->perContextData(); | 431 V8PerContextData* contextData = scriptState->PerContextData(); |
| 432 if ( | 432 if ( |
| 433 {%- if attribute.activity_logging_world_check -%} | 433 {%- if attribute.activity_logging_world_check -%} |
| 434 scriptState->world().isIsolatedWorld() && {# one space at the end #} | 434 scriptState->World().IsIsolatedWorld() && {# one space at the end #} |
| 435 {%- endif -%} | 435 {%- endif -%} |
| 436 contextData && contextData->activityLogger()) { | 436 contextData && contextData->ActivityLogger()) { |
| 437 contextData->activityLogger()->logSetter("{{interface_name}}.{{attribute.nam
e}}", v8Value); | 437 contextData->ActivityLogger()->LogSetter("{{interface_name}}.{{attribute.nam
e}}", v8Value); |
| 438 } | 438 } |
| 439 {% endif %} | 439 {% endif %} |
| 440 | 440 |
| 441 {% if attribute.is_ce_reactions %} | 441 {% if attribute.is_ce_reactions %} |
| 442 CEReactionsScope ceReactionsScope; | 442 CEReactionsScope ceReactionsScope; |
| 443 {% endif %} | 443 {% endif %} |
| 444 | 444 |
| 445 {% if attribute.is_custom_element_callbacks or attribute.is_reflect %} | 445 {% if attribute.is_custom_element_callbacks or attribute.is_reflect %} |
| 446 V0CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; | 446 V0CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; |
| 447 {% endif %} | 447 {% endif %} |
| 448 | 448 |
| 449 {% if attribute.has_custom_setter %} | 449 {% if attribute.has_custom_setter %} |
| 450 {{v8_class}}::{{attribute.name}}AttributeSetterCustom(v8Value, info); | 450 {{v8_class}}::{{attribute.name}}AttributeSetterCustom(v8Value, info); |
| 451 {% elif attribute.has_cross_origin_setter %} | 451 {% elif attribute.has_cross_origin_setter %} |
| 452 {{cpp_class_or_partial}}V8Internal::{{attribute.name}}AttributeSetter(v8Value,
V8CrossOriginSetterInfo(info.GetIsolate(), info.Holder())); | 452 {{cpp_class_or_partial}}V8Internal::{{attribute.name}}AttributeSetter(v8Value,
V8CrossOriginSetterInfo(info.GetIsolate(), info.Holder())); |
| 453 {% else %} | 453 {% else %} |
| 454 {{cpp_class_or_partial}}V8Internal::{{attribute.name}}AttributeSetter{{world_s
uffix}}(v8Value, info); | 454 {{cpp_class_or_partial}}V8Internal::{{attribute.name}}AttributeSetter{{world_s
uffix}}(v8Value, info); |
| 455 {% endif %} | 455 {% endif %} |
| 456 } | 456 } |
| 457 {% endmacro %} | 457 {% endmacro %} |
| 458 | 458 |
| 459 | 459 |
| 460 {##############################################################################} | 460 {##############################################################################} |
| 461 {% macro attribute_configuration(attribute) %} | 461 {% macro attribute_configuration(attribute) %} |
| 462 {% from 'utilities.cpp.tmpl' import property_location %} | 462 {% from 'utilities.cpp.tmpl' import property_location %} |
| 463 {% if attribute.constructor_type %} | 463 {% if attribute.constructor_type %} |
| 464 {% set getter_callback = | 464 {% set getter_callback = |
| 465 '%s::%sConstructorGetterCallback' % (v8_class_or_partial, attribute.name) | 465 '%s::%sConstructorGetterCallback' % (v8_class_or_partial, attribute.name) |
| 466 if attribute.needs_constructor_getter_callback else | 466 if attribute.needs_constructor_getter_callback else |
| 467 'v8ConstructorAttributeGetter' %} | 467 'V8ConstructorAttributeGetter' %} |
| 468 {% set setter_callback = 'nullptr' %} | 468 {% set setter_callback = 'nullptr' %} |
| 469 {% else %}{# regular attributes #} | 469 {% else %}{# regular attributes #} |
| 470 {% set getter_callback = '%s::%sAttributeGetterCallback' % | 470 {% set getter_callback = '%s::%sAttributeGetterCallback' % |
| 471 (v8_class_or_partial, attribute.name) %} | 471 (v8_class_or_partial, attribute.name) %} |
| 472 {% set setter_callback = '%s::%sAttributeSetterCallback' % | 472 {% set setter_callback = '%s::%sAttributeSetterCallback' % |
| 473 (v8_class_or_partial, attribute.name) | 473 (v8_class_or_partial, attribute.name) |
| 474 if attribute.has_setter else 'nullptr' %} | 474 if attribute.has_setter else 'nullptr' %} |
| 475 {% endif %} | 475 {% endif %} |
| 476 {% set getter_callback_for_main_world = | 476 {% set getter_callback_for_main_world = |
| 477 '%sForMainWorld' % getter_callback | 477 '%sForMainWorld' % getter_callback |
| 478 if attribute.is_per_world_bindings else 'nullptr' %} | 478 if attribute.is_per_world_bindings else 'nullptr' %} |
| 479 {% set setter_callback_for_main_world = | 479 {% set setter_callback_for_main_world = |
| 480 '%sForMainWorld' % setter_callback | 480 '%sForMainWorld' % setter_callback |
| 481 if attribute.is_per_world_bindings and attribute.has_setter else 'nullptr
' %} | 481 if attribute.is_per_world_bindings and attribute.has_setter else 'nullptr
' %} |
| 482 {% set wrapper_type_info = | 482 {% set wrapper_type_info = |
| 483 'const_cast<WrapperTypeInfo*>(&V8%s::wrapperTypeInfo)' % attribute.constr
uctor_type | 483 'const_cast<WrapperTypeInfo*>(&V8%s::wrapperTypeInfo)' % attribute.constr
uctor_type |
| 484 if attribute.constructor_type else 'nullptr' %} | 484 if attribute.constructor_type else 'nullptr' %} |
| 485 {% set property_attribute = 'static_cast<v8::PropertyAttribute>(%s)' % | 485 {% set property_attribute = 'static_cast<v8::PropertyAttribute>(%s)' % |
| 486 ' | '.join(attribute.property_attributes) %} | 486 ' | '.join(attribute.property_attributes) %} |
| 487 {% set cached_accessor_callback = | 487 {% set cached_accessor_callback = |
| 488 '%s::%sCachedAccessorCallback' % (v8_class_or_partial, attribute.name) | 488 '%s::%sCachedAccessorCallback' % (v8_class_or_partial, attribute.name) |
| 489 if attribute.is_cached_accessor else | 489 if attribute.is_cached_accessor else |
| 490 'nullptr' %} | 490 'nullptr' %} |
| 491 {% set holder_check = 'V8DOMConfiguration::DoNotCheckHolder' | 491 {% set holder_check = 'V8DOMConfiguration::kDoNotCheckHolder' |
| 492 if attribute.is_lenient_this else 'V8DOMConfiguration::CheckHolder' %} | 492 if attribute.is_lenient_this else 'V8DOMConfiguration::kCheckHolder' %} |
| 493 {% set attribute_configuration_list = [ | 493 {% set attribute_configuration_list = [ |
| 494 '"%s"' % attribute.name, | 494 '"%s"' % attribute.name, |
| 495 getter_callback, | 495 getter_callback, |
| 496 setter_callback, | 496 setter_callback, |
| 497 getter_callback_for_main_world, | 497 getter_callback_for_main_world, |
| 498 setter_callback_for_main_world, | 498 setter_callback_for_main_world, |
| 499 cached_accessor_callback, | 499 cached_accessor_callback, |
| 500 wrapper_type_info, | 500 wrapper_type_info, |
| 501 property_attribute, | 501 property_attribute, |
| 502 property_location(attribute), | 502 property_location(attribute), |
| 503 holder_check, | 503 holder_check, |
| 504 ] %} | 504 ] %} |
| 505 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} | 505 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} |
| 506 {%- endmacro %} | 506 {%- endmacro %} |
| OLD | NEW |