| OLD | NEW |
| 1 {% from 'utilities.cpp' import declare_enum_validation_variable, v8_value_to_loc
al_cpp_value %} | 1 {% from 'utilities.cpp' import declare_enum_validation_variable, v8_value_to_loc
al_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 { | 11 { |
| 12 {% if attribute.is_reflect and not attribute.is_url | |
| 13 and attribute.idl_type == 'DOMString' and is_node | |
| 14 and not attribute.is_implemented_in_private_script %} | |
| 15 {% set cpp_class, v8_class = 'Element', 'V8Element' %} | |
| 16 {% endif %} | |
| 17 {# holder #} | 12 {# holder #} |
| 18 {% if not attribute.is_static %} | 13 {% if not attribute.is_static %} |
| 19 {% if attribute.is_lenient_this %} | 14 {% if attribute.is_lenient_this %} |
| 20 {# Make sure that info.Holder() really points to an instance if [LenientThis
]. #} | 15 {# Make sure that info.Holder() really points to an instance if [LenientThis
]. #} |
| 21 if (!{{v8_class}}::hasInstance(info.Holder(), info.GetIsolate())) | 16 if (!{{v8_class}}::hasInstance(info.Holder(), info.GetIsolate())) |
| 22 return; // Return silently because of [LenientThis]. | 17 return; // Return silently because of [LenientThis]. |
| 23 {% endif %} | 18 {% endif %} |
| 24 v8::Local<v8::Object> holder = info.Holder(); | 19 v8::Local<v8::Object> holder = info.Holder(); |
| 25 {% endif %} | 20 {% endif %} |
| 26 {# impl #} | 21 {# impl #} |
| (...skipping 19 matching lines...) Expand all Loading... |
| 46 {% if attribute.cached_attribute_validation_method %} | 41 {% if attribute.cached_attribute_validation_method %} |
| 47 v8::Local<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "{{at
tribute.name}}"); | 42 v8::Local<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "{{at
tribute.name}}"); |
| 48 if (!impl->{{attribute.cached_attribute_validation_method}}()) { | 43 if (!impl->{{attribute.cached_attribute_validation_method}}()) { |
| 49 v8::Local<v8::Value> v8Value = V8HiddenValue::getHiddenValue(ScriptState
::current(info.GetIsolate()), holder, propertyName); | 44 v8::Local<v8::Value> v8Value = V8HiddenValue::getHiddenValue(ScriptState
::current(info.GetIsolate()), holder, propertyName); |
| 50 if (!v8Value.IsEmpty() && !v8Value->IsUndefined()) { | 45 if (!v8Value.IsEmpty() && !v8Value->IsUndefined()) { |
| 51 v8SetReturnValue(info, v8Value); | 46 v8SetReturnValue(info, v8Value); |
| 52 return; | 47 return; |
| 53 } | 48 } |
| 54 } | 49 } |
| 55 {% endif %} | 50 {% endif %} |
| 56 {% if interface_name == 'Window' and attribute.idl_type == 'EventHandler' %} | |
| 57 if (!impl->document()) | |
| 58 return; | |
| 59 {% endif %} | |
| 60 {# Local variables #} | 51 {# Local variables #} |
| 61 {% if attribute.is_call_with_execution_context %} | 52 {% if attribute.is_call_with_execution_context %} |
| 62 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate
()); | 53 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate
()); |
| 63 {% endif %} | 54 {% endif %} |
| 64 {% if attribute.is_call_with_script_state %} | 55 {% if attribute.is_call_with_script_state %} |
| 65 {% if attribute.is_static %} | 56 {% if attribute.is_static %} |
| 66 ScriptState* scriptState = ScriptState::forFunctionObject(info); | 57 ScriptState* scriptState = ScriptState::forFunctionObject(info); |
| 67 {% else %} | 58 {% else %} |
| 68 ScriptState* scriptState = ScriptState::forReceiverObject(info); | 59 ScriptState* scriptState = ScriptState::forReceiverObject(info); |
| 69 {% endif %} | 60 {% endif %} |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 | 227 |
| 237 {##############################################################################} | 228 {##############################################################################} |
| 238 {% macro attribute_setter(attribute, world_suffix) %} | 229 {% macro attribute_setter(attribute, world_suffix) %} |
| 239 static void {{attribute.name}}AttributeSetter{{world_suffix}}( | 230 static void {{attribute.name}}AttributeSetter{{world_suffix}}( |
| 240 {%- if attribute.is_data_type_property %} | 231 {%- if attribute.is_data_type_property %} |
| 241 v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info | 232 v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info |
| 242 {%- else %} | 233 {%- else %} |
| 243 v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info | 234 v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info |
| 244 {%- endif %}) | 235 {%- endif %}) |
| 245 { | 236 { |
| 246 {% if attribute.is_reflect and attribute.idl_type == 'DOMString' | |
| 247 and is_node and not attribute.is_implemented_in_private_script %} | |
| 248 {% set cpp_class, v8_class = 'Element', 'V8Element' %} | |
| 249 {% endif %} | |
| 250 {% if attribute.has_setter_exception_state or | 237 {% if attribute.has_setter_exception_state or |
| 251 ((not attribute.is_replaceable and | 238 ((not attribute.is_replaceable and |
| 252 not attribute.constructor_type and | 239 not attribute.constructor_type and |
| 253 not attribute.is_data_type_property) and | 240 not attribute.is_data_type_property) and |
| 254 (attribute.is_check_security_for_receiver or | 241 (attribute.is_check_security_for_receiver or |
| 255 attribute.is_check_security_for_return_value)) %} | 242 attribute.is_check_security_for_return_value)) %} |
| 256 {% set raise_exception = 1 %} | 243 {% set raise_exception = 1 %} |
| 257 {% else %} | 244 {% else %} |
| 258 {% set raise_exception = 0 %} | 245 {% set raise_exception = 0 %} |
| 259 {% endif %} | 246 {% endif %} |
| (...skipping 20 matching lines...) Expand all Loading... |
| 280 {% if attribute.is_put_forwards %} | 267 {% if attribute.is_put_forwards %} |
| 281 {{cpp_class}}* proxyImpl = {{v8_class}}::toImpl(holder); | 268 {{cpp_class}}* proxyImpl = {{v8_class}}::toImpl(holder); |
| 282 {{attribute.cpp_type}} impl = WTF::getPtr(proxyImpl->{{attribute.name}}()); | 269 {{attribute.cpp_type}} impl = WTF::getPtr(proxyImpl->{{attribute.name}}()); |
| 283 if (!impl) | 270 if (!impl) |
| 284 return; | 271 return; |
| 285 {% elif not attribute.is_static and | 272 {% elif not attribute.is_static and |
| 286 not attribute.is_replaceable and | 273 not attribute.is_replaceable and |
| 287 not attribute.constructor_type %} | 274 not attribute.constructor_type %} |
| 288 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); | 275 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); |
| 289 {% endif %} | 276 {% endif %} |
| 290 {% if attribute.idl_type == 'EventHandler' and interface_name == 'Window' %} | |
| 291 if (!impl->document()) | |
| 292 return; | |
| 293 {% endif %} | |
| 294 {# Security checks #} | 277 {# Security checks #} |
| 295 {% if not attribute.is_replaceable and | 278 {% if not attribute.is_replaceable and |
| 296 not attribute.constructor_type %} | 279 not attribute.constructor_type %} |
| 297 {% if not attribute.is_data_type_property %} | 280 {% if not attribute.is_data_type_property %} |
| 298 {% if attribute.is_check_security_for_receiver %} | 281 {% if attribute.is_check_security_for_receiver %} |
| 299 if (!BindingSecurity::shouldAllowAccessTo(currentDOMWindow(info.GetIsolate()
), impl, exceptionState)) { | 282 if (!BindingSecurity::shouldAllowAccessTo(currentDOMWindow(info.GetIsolate()
), impl, exceptionState)) { |
| 300 v8SetReturnValue(info, v8Value); | 283 v8SetReturnValue(info, v8Value); |
| 301 exceptionState.throwIfNeeded(); | 284 exceptionState.throwIfNeeded(); |
| 302 return; | 285 return; |
| 303 } | 286 } |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 setter_callback_for_main_world, | 508 setter_callback_for_main_world, |
| 526 wrapper_type_info, | 509 wrapper_type_info, |
| 527 access_control, | 510 access_control, |
| 528 property_attribute, | 511 property_attribute, |
| 529 only_exposed_to_private_script, | 512 only_exposed_to_private_script, |
| 530 property_location(attribute), | 513 property_location(attribute), |
| 531 holder_check, | 514 holder_check, |
| 532 ] %} | 515 ] %} |
| 533 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} | 516 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} |
| 534 {%- endmacro %} | 517 {%- endmacro %} |
| OLD | NEW |