| OLD | NEW |
| 1 {##############################################################################} | 1 {##############################################################################} |
| 2 {% macro attribute_getter(attribute, world_suffix) %} | 2 {% macro attribute_getter(attribute, world_suffix) %} |
| 3 {% filter conditional(attribute.conditional_string) %} | 3 {% filter conditional(attribute.conditional_string) %} |
| 4 static void {{attribute.name}}AttributeGetter{{world_suffix}}( | 4 static void {{attribute.name}}AttributeGetter{{world_suffix}}( |
| 5 {%- if attribute.is_expose_js_accessors %} | 5 {%- if attribute.is_expose_js_accessors %} |
| 6 const v8::FunctionCallbackInfo<v8::Value>& info | 6 const v8::FunctionCallbackInfo<v8::Value>& info |
| 7 {%- else %} | 7 {%- else %} |
| 8 const v8::PropertyCallbackInfo<v8::Value>& info | 8 const v8::PropertyCallbackInfo<v8::Value>& info |
| 9 {%- endif %}) | 9 {%- endif %}) |
| 10 { | 10 { |
| 11 {% if attribute.is_reflect and not attribute.is_url | 11 {% if attribute.is_reflect and not attribute.is_url |
| 12 and attribute.idl_type == 'DOMString' and is_node | 12 and attribute.idl_type == 'DOMString' and is_node |
| 13 and not attribute.is_implemented_in_private_script %} | 13 and not attribute.is_implemented_in_private_script %} |
| 14 {% set cpp_class, v8_class = 'Element', 'V8Element' %} | 14 {% set cpp_class, v8_class = 'Element', 'V8Element' %} |
| 15 {% endif %} | 15 {% endif %} |
| 16 {# holder #} | 16 {# holder #} |
| 17 {% if not attribute.is_static %} | 17 {% if not attribute.is_static %} |
| 18 v8::Handle<v8::Object> holder = info.Holder(); | 18 v8::Local<v8::Object> holder = info.Holder(); |
| 19 {% endif %} | 19 {% endif %} |
| 20 {# impl #} | 20 {# impl #} |
| 21 {% if attribute.cached_attribute_validation_method %} | 21 {% if attribute.cached_attribute_validation_method %} |
| 22 v8::Handle<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "{{a
ttribute.name}}"); | 22 v8::Local<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "{{at
tribute.name}}"); |
| 23 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); | 23 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); |
| 24 if (!impl->{{attribute.cached_attribute_validation_method}}()) { | 24 if (!impl->{{attribute.cached_attribute_validation_method}}()) { |
| 25 v8::Handle<v8::Value> v8Value = V8HiddenValue::getHiddenValue(info.GetIs
olate(), holder, propertyName); | 25 v8::Local<v8::Value> v8Value = V8HiddenValue::getHiddenValue(info.GetIso
late(), holder, propertyName); |
| 26 if (!v8Value.IsEmpty()) { | 26 if (!v8Value.IsEmpty()) { |
| 27 v8SetReturnValue(info, v8Value); | 27 v8SetReturnValue(info, v8Value); |
| 28 return; | 28 return; |
| 29 } | 29 } |
| 30 } | 30 } |
| 31 {% elif not attribute.is_static %} | 31 {% elif not attribute.is_static %} |
| 32 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); | 32 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); |
| 33 {% endif %} | 33 {% endif %} |
| 34 {% if interface_name == 'Window' and attribute.idl_type == 'EventHandler' %} | 34 {% if interface_name == 'Window' and attribute.idl_type == 'EventHandler' %} |
| 35 if (!impl->document()) | 35 if (!impl->document()) |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 return; | 80 return; |
| 81 } | 81 } |
| 82 {% endif %} | 82 {% endif %} |
| 83 {% if attribute.cached_attribute_validation_method %} | 83 {% if attribute.cached_attribute_validation_method %} |
| 84 V8HiddenValue::setHiddenValue(info.GetIsolate(), holder, propertyName, {{att
ribute.cpp_value_to_v8_value}}); | 84 V8HiddenValue::setHiddenValue(info.GetIsolate(), holder, propertyName, {{att
ribute.cpp_value_to_v8_value}}); |
| 85 {% endif %} | 85 {% endif %} |
| 86 {# v8SetReturnValue #} | 86 {# v8SetReturnValue #} |
| 87 {% if attribute.is_keep_alive_for_gc %} | 87 {% if attribute.is_keep_alive_for_gc %} |
| 88 if ({{attribute.cpp_value}} && DOMDataStore::setReturnValue{{world_suffix}}(
info.GetReturnValue(), {{attribute.cpp_value}}.get())) | 88 if ({{attribute.cpp_value}} && DOMDataStore::setReturnValue{{world_suffix}}(
info.GetReturnValue(), {{attribute.cpp_value}}.get())) |
| 89 return; | 89 return; |
| 90 v8::Handle<v8::Value> wrapper = toV8({{attribute.cpp_value}}.get(), holder,
info.GetIsolate()); | 90 v8::Local<v8::Value> wrapper = toV8({{attribute.cpp_value}}.get(), holder, i
nfo.GetIsolate()); |
| 91 if (!wrapper.IsEmpty()) { | 91 if (!wrapper.IsEmpty()) { |
| 92 V8HiddenValue::setHiddenValue(info.GetIsolate(), holder, v8AtomicString(
info.GetIsolate(), "{{attribute.name}}"), wrapper); | 92 V8HiddenValue::setHiddenValue(info.GetIsolate(), holder, v8AtomicString(
info.GetIsolate(), "{{attribute.name}}"), wrapper); |
| 93 {{attribute.v8_set_return_value}}; | 93 {{attribute.v8_set_return_value}}; |
| 94 } | 94 } |
| 95 {% elif world_suffix %} | 95 {% elif world_suffix %} |
| 96 {{attribute.v8_set_return_value_for_main_world}}; | 96 {{attribute.v8_set_return_value_for_main_world}}; |
| 97 {% else %} | 97 {% else %} |
| 98 {% if attribute.use_output_parameter_for_result %} | 98 {% if attribute.use_output_parameter_for_result %} |
| 99 {{attribute.cpp_type}} result; | 99 {{attribute.cpp_type}} result; |
| 100 {{attribute.cpp_value}}; | 100 {{attribute.cpp_value}}; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 {%- else %} | 205 {%- else %} |
| 206 v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info | 206 v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info |
| 207 {%- endif %}) | 207 {%- endif %}) |
| 208 { | 208 { |
| 209 {% if attribute.is_reflect and attribute.idl_type == 'DOMString' | 209 {% if attribute.is_reflect and attribute.idl_type == 'DOMString' |
| 210 and is_node and not attribute.is_implemented_in_private_script %} | 210 and is_node and not attribute.is_implemented_in_private_script %} |
| 211 {% set cpp_class, v8_class = 'Element', 'V8Element' %} | 211 {% set cpp_class, v8_class = 'Element', 'V8Element' %} |
| 212 {% endif %} | 212 {% endif %} |
| 213 {# Local variables #} | 213 {# Local variables #} |
| 214 {% if not attribute.is_static %} | 214 {% if not attribute.is_static %} |
| 215 v8::Handle<v8::Object> holder = info.Holder(); | 215 v8::Local<v8::Object> holder = info.Holder(); |
| 216 {% endif %} | 216 {% endif %} |
| 217 {% if attribute.has_setter_exception_state %} | 217 {% if attribute.has_setter_exception_state %} |
| 218 ExceptionState exceptionState(ExceptionState::SetterContext, "{{attribute.na
me}}", "{{interface_name}}", holder, info.GetIsolate()); | 218 ExceptionState exceptionState(ExceptionState::SetterContext, "{{attribute.na
me}}", "{{interface_name}}", holder, info.GetIsolate()); |
| 219 {% endif %} | 219 {% endif %} |
| 220 {% if attribute.use_output_parameter_for_result %} | 220 {% if attribute.use_output_parameter_for_result %} |
| 221 {{attribute.cpp_type}} cppValue; | 221 {{attribute.cpp_type}} cppValue; |
| 222 {% endif %} | 222 {% endif %} |
| 223 {# impl #} | 223 {# impl #} |
| 224 {% if attribute.put_forwards %} | 224 {% if attribute.put_forwards %} |
| 225 {{cpp_class}}* proxyImpl = {{v8_class}}::toImpl(holder); | 225 {{cpp_class}}* proxyImpl = {{v8_class}}::toImpl(holder); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 | 336 |
| 337 | 337 |
| 338 {##############################################################################} | 338 {##############################################################################} |
| 339 {% macro attribute_getter_implemented_in_private_script(attribute) %} | 339 {% macro attribute_getter_implemented_in_private_script(attribute) %} |
| 340 bool {{v8_class}}::PrivateScript::{{attribute.name}}AttributeGetter(LocalFrame*
frame, {{cpp_class}}* holderImpl, {{attribute.cpp_type}}* result) | 340 bool {{v8_class}}::PrivateScript::{{attribute.name}}AttributeGetter(LocalFrame*
frame, {{cpp_class}}* holderImpl, {{attribute.cpp_type}}* result) |
| 341 { | 341 { |
| 342 if (!frame) | 342 if (!frame) |
| 343 return false; | 343 return false; |
| 344 v8::HandleScope handleScope(toIsolate(frame)); | 344 v8::HandleScope handleScope(toIsolate(frame)); |
| 345 ScriptForbiddenScope::AllowUserAgentScript script; | 345 ScriptForbiddenScope::AllowUserAgentScript script; |
| 346 v8::Handle<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrapp
erWorld::privateScriptIsolatedWorld()); | 346 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe
rWorld::privateScriptIsolatedWorld()); |
| 347 if (contextInPrivateScript.IsEmpty()) | 347 if (contextInPrivateScript.IsEmpty()) |
| 348 return false; | 348 return false; |
| 349 ScriptState* scriptState = ScriptState::from(contextInPrivateScript); | 349 ScriptState* scriptState = ScriptState::from(contextInPrivateScript); |
| 350 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); | 350 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); |
| 351 if (!scriptState->executionContext()) | 351 if (!scriptState->executionContext()) |
| 352 return false; | 352 return false; |
| 353 | 353 |
| 354 ScriptState::Scope scope(scriptState); | 354 ScriptState::Scope scope(scriptState); |
| 355 v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Glob
al(), scriptState->isolate()); | 355 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa
l(), scriptState->isolate()); |
| 356 | 356 |
| 357 ExceptionState exceptionState(ExceptionState::GetterContext, "{{attribute.na
me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate()
); | 357 ExceptionState exceptionState(ExceptionState::GetterContext, "{{attribute.na
me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate()
); |
| 358 v8::Handle<v8::Value> v8Value = PrivateScriptRunner::runDOMAttributeGetter(s
criptState, scriptStateInUserScript, "{{cpp_class}}", "{{attribute.name}}", hold
er); | 358 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMAttributeGetter(sc
riptState, scriptStateInUserScript, "{{cpp_class}}", "{{attribute.name}}", holde
r); |
| 359 if (v8Value.IsEmpty()) | 359 if (v8Value.IsEmpty()) |
| 360 return false; | 360 return false; |
| 361 {{attribute.private_script_v8_value_to_local_cpp_value}}; | 361 {{attribute.private_script_v8_value_to_local_cpp_value}}; |
| 362 RELEASE_ASSERT(!exceptionState.hadException()); | 362 RELEASE_ASSERT(!exceptionState.hadException()); |
| 363 *result = cppValue; | 363 *result = cppValue; |
| 364 return true; | 364 return true; |
| 365 } | 365 } |
| 366 {% endmacro %} | 366 {% endmacro %} |
| 367 | 367 |
| 368 | 368 |
| 369 {% macro attribute_setter_implemented_in_private_script(attribute) %} | 369 {% macro attribute_setter_implemented_in_private_script(attribute) %} |
| 370 bool {{v8_class}}::PrivateScript::{{attribute.name}}AttributeSetter(LocalFrame*
frame, {{cpp_class}}* holderImpl, {{attribute.argument_cpp_type}} cppValue) | 370 bool {{v8_class}}::PrivateScript::{{attribute.name}}AttributeSetter(LocalFrame*
frame, {{cpp_class}}* holderImpl, {{attribute.argument_cpp_type}} cppValue) |
| 371 { | 371 { |
| 372 if (!frame) | 372 if (!frame) |
| 373 return false; | 373 return false; |
| 374 v8::HandleScope handleScope(toIsolate(frame)); | 374 v8::HandleScope handleScope(toIsolate(frame)); |
| 375 ScriptForbiddenScope::AllowUserAgentScript script; | 375 ScriptForbiddenScope::AllowUserAgentScript script; |
| 376 v8::Handle<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrapp
erWorld::privateScriptIsolatedWorld()); | 376 v8::Local<v8::Context> contextInPrivateScript = toV8Context(frame, DOMWrappe
rWorld::privateScriptIsolatedWorld()); |
| 377 if (contextInPrivateScript.IsEmpty()) | 377 if (contextInPrivateScript.IsEmpty()) |
| 378 return false; | 378 return false; |
| 379 ScriptState* scriptState = ScriptState::from(contextInPrivateScript); | 379 ScriptState* scriptState = ScriptState::from(contextInPrivateScript); |
| 380 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); | 380 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); |
| 381 if (!scriptState->executionContext()) | 381 if (!scriptState->executionContext()) |
| 382 return false; | 382 return false; |
| 383 | 383 |
| 384 ScriptState::Scope scope(scriptState); | 384 ScriptState::Scope scope(scriptState); |
| 385 v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Glob
al(), scriptState->isolate()); | 385 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa
l(), scriptState->isolate()); |
| 386 | 386 |
| 387 ExceptionState exceptionState(ExceptionState::SetterContext, "{{attribute.na
me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate()
); | 387 ExceptionState exceptionState(ExceptionState::SetterContext, "{{attribute.na
me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate()
); |
| 388 return PrivateScriptRunner::runDOMAttributeSetter(scriptState, scriptStateIn
UserScript, "{{cpp_class}}", "{{attribute.name}}", holder, {{attribute.private_s
cript_cpp_value_to_v8_value}}); | 388 return PrivateScriptRunner::runDOMAttributeSetter(scriptState, scriptStateIn
UserScript, "{{cpp_class}}", "{{attribute.name}}", holder, {{attribute.private_s
cript_cpp_value_to_v8_value}}); |
| 389 } | 389 } |
| 390 {% endmacro %} | 390 {% endmacro %} |
| 391 | 391 |
| 392 | 392 |
| 393 {##############################################################################} | 393 {##############################################################################} |
| 394 {% macro attribute_configuration(attribute) %} | 394 {% macro attribute_configuration(attribute) %} |
| 395 {% set getter_callback = | 395 {% set getter_callback = |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 access_control, | 432 access_control, |
| 433 property_attribute, | 433 property_attribute, |
| 434 only_exposed_to_private_script, | 434 only_exposed_to_private_script, |
| 435 ] %} | 435 ] %} |
| 436 {% if not attribute.is_expose_js_accessors %} | 436 {% if not attribute.is_expose_js_accessors %} |
| 437 {% set attribute_configuration_list = attribute_configuration_list | 437 {% set attribute_configuration_list = attribute_configuration_list |
| 438 + [on_prototype] %} | 438 + [on_prototype] %} |
| 439 {% endif %} | 439 {% endif %} |
| 440 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} | 440 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} |
| 441 {%- endmacro %} | 441 {%- endmacro %} |
| OLD | NEW |