Chromium Code Reviews| 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 %} | |
|
haraken
2017/02/23 04:30:20
What is this change for?
dcheng
2017/02/23 04:55:41
This needs to be done after the security check; ot
haraken
2017/02/23 09:26:24
Hmm.
Then you will need to make a similar change
dcheng
2017/02/23 09:44:43
As far as I know, it's only a problem for methods
| |
| 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); |
|
haraken
2017/02/23 09:26:24
Nit: You're potentially redefining the ScriptState
dcheng
2017/02/23 09:44:43
Done.
| |
| 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; |
| 91 {% endif %} | 105 {% endif %} |
| 92 | 106 |
| 93 {{function_call | indent(2)}} | 107 {{function_call | indent(2)}} |
| 94 } | 108 } |
| 95 {% endfilter %} | 109 {% endfilter %} |
| (...skipping 408 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 %} | |
| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 654 if method.overloads else | 655 if method.overloads else |
| 655 method.runtime_enabled_feature_name) %} | 656 method.runtime_enabled_feature_name) %} |
| 656 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}}; | 657 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}}; |
| 657 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration); | 658 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration); |
| 658 {% endfilter %}{# runtime_enabled() #} | 659 {% endfilter %}{# runtime_enabled() #} |
| 659 {% endfilter %}{# exposed() #} | 660 {% endfilter %}{# exposed() #} |
| 660 {% endfilter %}{# secure_context() #} | 661 {% endfilter %}{# secure_context() #} |
| 661 {% endfor %} | 662 {% endfor %} |
| 662 {% endif %} | 663 {% endif %} |
| 663 {%- endmacro %} | 664 {%- endmacro %} |
| OLD | NEW |