| 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 %}) |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 {% endif %} | 111 {% endif %} |
| 112 {% if attribute.cached_attribute_validation_method %} | 112 {% if attribute.cached_attribute_validation_method %} |
| 113 v8::Local<v8::Value> v8Value({{attribute.cpp_value_to_v8_value}}); | 113 v8::Local<v8::Value> v8Value({{attribute.cpp_value_to_v8_value}}); |
| 114 V8HiddenValue::setHiddenValue(ScriptState::current(info.GetIsolate()), holde
r, propertyName, v8Value); | 114 V8HiddenValue::setHiddenValue(ScriptState::current(info.GetIsolate()), holde
r, propertyName, v8Value); |
| 115 {% endif %} | 115 {% endif %} |
| 116 {# v8SetReturnValue #} | 116 {# v8SetReturnValue #} |
| 117 {% if attribute.is_keep_alive_for_gc %} | 117 {% if attribute.is_keep_alive_for_gc %} |
| 118 if ({{attribute.cpp_value}} && DOMDataStore::setReturnValue{{world_suffix}}(
info.GetReturnValue(), {{attribute.cpp_value}})) | 118 if ({{attribute.cpp_value}} && DOMDataStore::setReturnValue{{world_suffix}}(
info.GetReturnValue(), {{attribute.cpp_value}})) |
| 119 return; | 119 return; |
| 120 v8::Local<v8::Value> v8Value(toV8({{attribute.cpp_value}}, holder, info.GetI
solate())); | 120 v8::Local<v8::Value> v8Value(toV8({{attribute.cpp_value}}, holder, info.GetI
solate())); |
| 121 if (!v8Value.IsEmpty()) { | 121 V8HiddenValue::setHiddenValue(ScriptState::current(info.GetIsolate()), holde
r, v8AtomicString(info.GetIsolate(), "{{attribute.name}}"), v8Value); |
| 122 V8HiddenValue::setHiddenValue(ScriptState::current(info.GetIsolate()), h
older, v8AtomicString(info.GetIsolate(), "{{attribute.name}}"), v8Value); | 122 {{attribute.v8_set_return_value}}; |
| 123 {{attribute.v8_set_return_value}}; | |
| 124 } | |
| 125 {% elif world_suffix %} | 123 {% elif world_suffix %} |
| 126 {{attribute.v8_set_return_value_for_main_world}}; | 124 {{attribute.v8_set_return_value_for_main_world}}; |
| 127 {% else %} | 125 {% else %} |
| 128 {% if attribute.use_output_parameter_for_result %} | 126 {% if attribute.use_output_parameter_for_result %} |
| 129 {{attribute.cpp_type}} result; | 127 {{attribute.cpp_type}} result; |
| 130 {{attribute.cpp_value}}; | 128 {{attribute.cpp_value}}; |
| 131 {% endif %} | 129 {% endif %} |
| 132 {{attribute.v8_set_return_value}}; | 130 {{attribute.v8_set_return_value}}; |
| 133 {% endif %} | 131 {% endif %} |
| 134 {% if attribute.is_save_same_object %} | 132 {% if attribute.is_save_same_object %} |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 ScriptForbiddenScope::AllowUserAgentScript script; | 410 ScriptForbiddenScope::AllowUserAgentScript script; |
| 413 ScriptState* scriptState = ScriptState::forWorld(frame, DOMWrapperWorld::pri
vateScriptIsolatedWorld()); | 411 ScriptState* scriptState = ScriptState::forWorld(frame, DOMWrapperWorld::pri
vateScriptIsolatedWorld()); |
| 414 if (!scriptState) | 412 if (!scriptState) |
| 415 return false; | 413 return false; |
| 416 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); | 414 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); |
| 417 if (!scriptStateInUserScript) | 415 if (!scriptStateInUserScript) |
| 418 return false; | 416 return false; |
| 419 | 417 |
| 420 ScriptState::Scope scope(scriptState); | 418 ScriptState::Scope scope(scriptState); |
| 421 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa
l(), scriptState->isolate()); | 419 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa
l(), scriptState->isolate()); |
| 422 if (holder.IsEmpty()) | |
| 423 return false; | |
| 424 | |
| 425 | |
| 426 ExceptionState exceptionState(ExceptionState::GetterContext, "{{attribute.na
me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate()
); | 420 ExceptionState exceptionState(ExceptionState::GetterContext, "{{attribute.na
me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate()
); |
| 427 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMAttributeGetter(sc
riptState, scriptStateInUserScript, "{{cpp_class}}", "{{attribute.name}}", holde
r); | 421 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMAttributeGetter(sc
riptState, scriptStateInUserScript, "{{cpp_class}}", "{{attribute.name}}", holde
r); |
| 428 if (v8Value.IsEmpty()) | 422 if (v8Value.IsEmpty()) |
| 429 return false; | 423 return false; |
| 430 {{v8_value_to_local_cpp_value(attribute.private_script_v8_value_to_local_cpp
_value) | indent}} | 424 {{v8_value_to_local_cpp_value(attribute.private_script_v8_value_to_local_cpp
_value) | indent}} |
| 431 RELEASE_ASSERT(!exceptionState.hadException()); | 425 RELEASE_ASSERT(!exceptionState.hadException()); |
| 432 *result = cppValue; | 426 *result = cppValue; |
| 433 return true; | 427 return true; |
| 434 } | 428 } |
| 435 {% endmacro %} | 429 {% endmacro %} |
| 436 | 430 |
| 437 | 431 |
| 438 {% macro attribute_setter_implemented_in_private_script(attribute) %} | 432 {% macro attribute_setter_implemented_in_private_script(attribute) %} |
| 439 bool {{v8_class}}::PrivateScript::{{attribute.name}}AttributeSetter(LocalFrame*
frame, {{cpp_class}}* holderImpl, {{attribute.argument_cpp_type}} cppValue) | 433 bool {{v8_class}}::PrivateScript::{{attribute.name}}AttributeSetter(LocalFrame*
frame, {{cpp_class}}* holderImpl, {{attribute.argument_cpp_type}} cppValue) |
| 440 { | 434 { |
| 441 if (!frame) | 435 if (!frame) |
| 442 return false; | 436 return false; |
| 443 v8::HandleScope handleScope(toIsolate(frame)); | 437 v8::HandleScope handleScope(toIsolate(frame)); |
| 444 ScriptForbiddenScope::AllowUserAgentScript script; | 438 ScriptForbiddenScope::AllowUserAgentScript script; |
| 445 ScriptState* scriptState = ScriptState::forWorld(frame, DOMWrapperWorld::pri
vateScriptIsolatedWorld()); | 439 ScriptState* scriptState = ScriptState::forWorld(frame, DOMWrapperWorld::pri
vateScriptIsolatedWorld()); |
| 446 if (!scriptState) | 440 if (!scriptState) |
| 447 return false; | 441 return false; |
| 448 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); | 442 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); |
| 449 if (!scriptStateInUserScript) | 443 if (!scriptStateInUserScript) |
| 450 return false; | 444 return false; |
| 451 | 445 |
| 452 ScriptState::Scope scope(scriptState); | 446 ScriptState::Scope scope(scriptState); |
| 453 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa
l(), scriptState->isolate()); | 447 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa
l(), scriptState->isolate()); |
| 454 if (holder.IsEmpty()) | |
| 455 return false; | |
| 456 | |
| 457 ExceptionState exceptionState(ExceptionState::SetterContext, "{{attribute.na
me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate()
); | 448 ExceptionState exceptionState(ExceptionState::SetterContext, "{{attribute.na
me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate()
); |
| 458 return PrivateScriptRunner::runDOMAttributeSetter(scriptState, scriptStateIn
UserScript, "{{cpp_class}}", "{{attribute.name}}", holder, {{attribute.private_s
cript_cpp_value_to_v8_value}}); | 449 return PrivateScriptRunner::runDOMAttributeSetter(scriptState, scriptStateIn
UserScript, "{{cpp_class}}", "{{attribute.name}}", holder, {{attribute.private_s
cript_cpp_value_to_v8_value}}); |
| 459 } | 450 } |
| 460 {% endmacro %} | 451 {% endmacro %} |
| 461 | 452 |
| 462 | 453 |
| 463 {##############################################################################} | 454 {##############################################################################} |
| 464 {% macro attribute_configuration(attribute) %} | 455 {% macro attribute_configuration(attribute) %} |
| 465 {% from 'utilities.cpp' import property_location %} | 456 {% from 'utilities.cpp' import property_location %} |
| 466 {% if attribute.constructor_type %} | 457 {% if attribute.constructor_type %} |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 setter_callback_for_main_world, | 499 setter_callback_for_main_world, |
| 509 wrapper_type_info, | 500 wrapper_type_info, |
| 510 access_control, | 501 access_control, |
| 511 property_attribute, | 502 property_attribute, |
| 512 only_exposed_to_private_script, | 503 only_exposed_to_private_script, |
| 513 property_location(attribute), | 504 property_location(attribute), |
| 514 holder_check, | 505 holder_check, |
| 515 ] %} | 506 ] %} |
| 516 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} | 507 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} |
| 517 {%- endmacro %} | 508 {%- endmacro %} |
| OLD | NEW |