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 generate_method(method, world_suffix) %} | 4 {% macro generate_method(method, world_suffix) %} |
5 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info) { | 5 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info) { |
6 {% filter format_remove_duplicates([ | 6 {% filter format_remove_duplicates([ |
7 'ExceptionState exceptionState', | 7 'ExceptionState exceptionState', |
8 'ScriptState* scriptState = ']) %} | 8 'ScriptState* scriptState = ']) %} |
9 {% set define_exception_state -%} | 9 {% set define_exception_state -%} |
10 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionCont ext, "{{interface_name}}", "{{method.name}}"); | 10 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionCont ext, "{{interface_name}}", "{{method.name}}"); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 {% endif %}{# interface_name == 'EventTarget' #} | 71 {% endif %}{# interface_name == 'EventTarget' #} |
72 {% endif %}{# method.is_check_security_for_receiver #} | 72 {% endif %}{# method.is_check_security_for_receiver #} |
73 {% if method.is_check_security_for_return_value %} | 73 {% if method.is_check_security_for_return_value %} |
74 {{define_exception_state}} | 74 {{define_exception_state}} |
75 if (!BindingSecurity::shouldAllowAccessTo(currentDOMWindow(info.GetIsolate()), {{method.cpp_value}}, exceptionState)) { | 75 if (!BindingSecurity::shouldAllowAccessTo(currentDOMWindow(info.GetIsolate()), {{method.cpp_value}}, exceptionState)) { |
76 v8SetReturnValueNull(info); | 76 v8SetReturnValueNull(info); |
77 return; | 77 return; |
78 } | 78 } |
79 {% endif %} | 79 {% endif %} |
80 | 80 |
81 {% if world_suffix in method.activity_logging_world_list %} | |
82 {% if method.is_static %} | |
83 ScriptState* scriptState = ScriptState::forFunctionObject(info); | |
84 {% else %} | |
85 ScriptState* scriptState = ScriptState::forReceiverObject(info); | |
86 {% endif %} | |
87 V8PerContextData* contextData = scriptState->perContextData(); | |
88 if (contextData && contextData->activityLogger()) { | |
89 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionCo ntext, "{{interface_name}}", "{{method.name}}"); | |
90 Vector<v8::Local<v8::Value>> loggerArgs = toImplArguments<Vector<v8::Local<v 8::Value>>>(info, 0, exceptionState); | |
91 contextData->activityLogger()->logMethod("{{interface_name}}.{{method.name}} ", info.Length(), loggerArgs.data()); | |
92 } | |
93 {% endif %} | |
94 | |
81 {% if 'scriptState' in function_call %} | 95 {% if 'scriptState' in function_call %} |
82 {% if method.is_static %} | 96 {% if method.is_static %} |
83 ScriptState* scriptState = ScriptState::forFunctionObject(info); | 97 ScriptState* scriptState = ScriptState::forFunctionObject(info); |
84 {% else %} | 98 {% else %} |
85 ScriptState* scriptState = ScriptState::forReceiverObject(info); | 99 ScriptState* scriptState = ScriptState::forReceiverObject(info); |
86 {% endif %} | 100 {% endif %} |
87 {% endif %} | 101 {% endif %} |
88 | 102 |
89 {% if method.is_custom_element_callbacks %} | 103 {% if method.is_custom_element_callbacks %} |
90 V0CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; | 104 V0CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
504 {% macro method_callback(method, world_suffix) %} | 518 {% macro method_callback(method, world_suffix) %} |
505 void {{v8_class_or_partial}}::{{method.name}}MethodCallback{{world_suffix}}(cons t v8::FunctionCallbackInfo<v8::Value>& info) { | 519 void {{v8_class_or_partial}}::{{method.name}}MethodCallback{{world_suffix}}(cons t v8::FunctionCallbackInfo<v8::Value>& info) { |
506 {% if not method.overloads %}{# Overloaded methods are measured in overload_re solution_method() #} | 520 {% if not method.overloads %}{# Overloaded methods are measured in overload_re solution_method() #} |
507 {% if method.measure_as %} | 521 {% if method.measure_as %} |
508 UseCounter::count(currentExecutionContext(info.GetIsolate()), UseCounter::{{me thod.measure_as('Method')}}); | 522 UseCounter::count(currentExecutionContext(info.GetIsolate()), UseCounter::{{me thod.measure_as('Method')}}); |
509 {% endif %} | 523 {% endif %} |
510 {% if method.deprecate_as %} | 524 {% if method.deprecate_as %} |
511 Deprecation::countDeprecation(currentExecutionContext(info.GetIsolate()), UseC ounter::{{method.deprecate_as}}); | 525 Deprecation::countDeprecation(currentExecutionContext(info.GetIsolate()), UseC ounter::{{method.deprecate_as}}); |
512 {% endif %} | 526 {% endif %} |
513 {% endif %}{# not method.overloads #} | 527 {% endif %}{# not method.overloads #} |
514 {% if world_suffix in method.activity_logging_world_list %} | |
dcheng
2017/02/17 07:30:42
Also, I had to move the activity logging helper: f
Yuki
2017/02/17 10:53:17
AFAIK, no cross origin accessible property uses a
dcheng
2017/02/17 10:57:00
It happens when you do something this:
window.ope
Yuki
2017/02/17 11:24:49
I see. Then, I'm okay with moving this, although
| |
515 {% if method.is_static %} | |
516 ScriptState* scriptState = ScriptState::forFunctionObject(info); | |
517 {% else %} | |
518 ScriptState* scriptState = ScriptState::forReceiverObject(info); | |
519 {% endif %} | |
520 V8PerContextData* contextData = scriptState->perContextData(); | |
521 if (contextData && contextData->activityLogger()) { | |
522 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionCo ntext, "{{interface_name}}", "{{method.name}}"); | |
523 Vector<v8::Local<v8::Value>> loggerArgs = toImplArguments<Vector<v8::Local<v 8::Value>>>(info, 0, exceptionState); | |
524 contextData->activityLogger()->logMethod("{{interface_name}}.{{method.name}} ", info.Length(), loggerArgs.data()); | |
525 } | |
526 {% endif %} | |
527 {% if method.is_ce_reactions %} | 528 {% if method.is_ce_reactions %} |
528 CEReactionsScope ceReactionsScope; | 529 CEReactionsScope ceReactionsScope; |
529 {% endif %} | 530 {% endif %} |
530 {% if method.is_custom %} | 531 {% if method.is_custom %} |
531 {{v8_class}}::{{method.name}}MethodCustom(info); | 532 {{v8_class}}::{{method.name}}MethodCustom(info); |
532 {% elif method.is_post_message %} | 533 {% elif method.is_post_message %} |
533 {{cpp_class_or_partial}}V8Internal::postMessageImpl("{{interface_name}}", {{v8 _class}}::toImpl(info.Holder()), info); | 534 {{cpp_class_or_partial}}V8Internal::postMessageImpl("{{interface_name}}", {{v8 _class}}::toImpl(info.Holder()), info); |
534 {% else %} | 535 {% else %} |
535 {{cpp_class_or_partial}}V8Internal::{{method.name}}Method{{world_suffix}}(info ); | 536 {{cpp_class_or_partial}}V8Internal::{{method.name}}Method{{world_suffix}}(info ); |
536 {% endif %} | 537 {% endif %} |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
658 if method.overloads else | 659 if method.overloads else |
659 method.runtime_enabled_feature_name) %} | 660 method.runtime_enabled_feature_name) %} |
660 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}}; | 661 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}}; |
661 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration); | 662 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration); |
662 {% endfilter %}{# runtime_enabled() #} | 663 {% endfilter %}{# runtime_enabled() #} |
663 {% endfilter %}{# exposed() #} | 664 {% endfilter %}{# exposed() #} |
664 {% endfilter %}{# secure_context() #} | 665 {% endfilter %}{# secure_context() #} |
665 {% endfor %} | 666 {% endfor %} |
666 {% endif %} | 667 {% endif %} |
667 {%- endmacro %} | 668 {%- endmacro %} |
OLD | NEW |