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