| 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 { | 9 { |
| 10 {% set define_exception_state -%} | 10 {% set define_exception_state -%} |
| 11 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionCo
ntext, "{{interface_name}}", "{{method.name}}"); | 11 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionCo
ntext, "{{interface_name}}", "{{method.name}}"); |
| 12 {%- endset %} | 12 {%- endset %} |
| 13 | 13 |
| 14 {% set function_call = func_call_with_prep_of_args(method, world_suffix) %} | 14 {% set function_call = func_call_with_prep_of_args(method, world_suffix) %} |
| 15 | 15 |
| 16 {% if 'exceptionState' in function_call %} | 16 {% if 'exceptionState' in function_call %} |
| 17 {{define_exception_state}} | 17 {{define_exception_state}} |
| 18 {% if method.returns_promise %} | 18 {% if method.returns_promise %} |
| 19 {% if method.is_static %} | 19 ExceptionToRejectPromiseScope rejectPromiseScope(info, exceptionState); |
| 20 ScriptState* scriptState = ScriptState::forFunctionObject(info); | |
| 21 {% else %} | |
| 22 ScriptState* scriptState = ScriptState::forReceiverObject(info); | |
| 23 {% endif %} | |
| 24 ExceptionToRejectPromiseScope rejectPromiseScope(info, scriptState, exceptio
nState); | |
| 25 {% endif %} | 20 {% endif %} |
| 26 {% endif %} | 21 {% endif %} |
| 27 | 22 |
| 28 {% if not method.is_static %} | 23 {% if not method.is_static %} |
| 29 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); | 24 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); |
| 30 {% endif %} | 25 {% endif %} |
| 31 | 26 |
| 32 {# Security checks #} | 27 {# Security checks #} |
| 33 {% if method.is_check_security_for_receiver %} | 28 {% if method.is_check_security_for_receiver %} |
| 34 {{define_exception_state}} | 29 {{define_exception_state}} |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 | 395 |
| 401 {% if fall_through_to_partial_overloads %} | 396 {% if fall_through_to_partial_overloads %} |
| 402 | 397 |
| 403 DCHECK({{overloads.name}}MethodForPartialInterface); | 398 DCHECK({{overloads.name}}MethodForPartialInterface); |
| 404 ({{overloads.name}}MethodForPartialInterface)(info); | 399 ({{overloads.name}}MethodForPartialInterface)(info); |
| 405 | 400 |
| 406 {% else %}{# fall_through_to_partial_overloads #} | 401 {% else %}{# fall_through_to_partial_overloads #} |
| 407 | 402 |
| 408 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionCo
ntext, "{{interface_name}}", "{{overloads.name}}"); | 403 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionCo
ntext, "{{interface_name}}", "{{overloads.name}}"); |
| 409 {% if overloads.returns_promise_all %} | 404 {% if overloads.returns_promise_all %} |
| 410 {% if overloads.is_static %} | 405 ExceptionToRejectPromiseScope rejectPromiseScope(info, exceptionState); |
| 411 ScriptState* scriptState = ScriptState::forFunctionObject(info); | |
| 412 {% else %} | |
| 413 ScriptState* scriptState = ScriptState::forReceiverObject(info); | |
| 414 {% endif %} | |
| 415 ExceptionToRejectPromiseScope rejectPromiseScope(info, scriptState, exceptio
nState); | |
| 416 {% endif %} | 406 {% endif %} |
| 417 | 407 |
| 418 if (isArityError) { | 408 if (isArityError) { |
| 419 {% if overloads.length != 0 %} | 409 {% if overloads.length != 0 %} |
| 420 if (info.Length() < {{overloads.length}}) { | 410 if (info.Length() < {{overloads.length}}) { |
| 421 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(
{{overloads.length}}, info.Length())); | 411 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(
{{overloads.length}}, info.Length())); |
| 422 return; | 412 return; |
| 423 } | 413 } |
| 424 {% endif %} | 414 {% endif %} |
| 425 {% if overloads.valid_arities %} | 415 {% if overloads.valid_arities %} |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 if method.overloads else | 652 if method.overloads else |
| 663 method.runtime_enabled_function) %} | 653 method.runtime_enabled_function) %} |
| 664 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration
= {{method_configuration(method)}}; | 654 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration
= {{method_configuration(method)}}; |
| 665 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto
typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration); | 655 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto
typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration); |
| 666 {% endfilter %}{# runtime_enabled() #} | 656 {% endfilter %}{# runtime_enabled() #} |
| 667 {% endfilter %}{# exposed() #} | 657 {% endfilter %}{# exposed() #} |
| 668 {% endfilter %}{# secure_context() #} | 658 {% endfilter %}{# secure_context() #} |
| 669 {% endfor %} | 659 {% endfor %} |
| 670 {% endif %} | 660 {% endif %} |
| 671 {%- endmacro %} | 661 {%- endmacro %} |
| OLD | NEW |