| OLD | NEW |
| 1 {##############################################################################} | 1 {##############################################################################} |
| 2 {% macro generate_method(method, world_suffix) %} | 2 {% macro generate_method(method, world_suffix) %} |
| 3 {% filter conditional(method.conditional_string) %} | 3 {% filter conditional(method.conditional_string) %} |
| 4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
v8::FunctionCallbackInfo<v8::Value>& info) | 4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
v8::FunctionCallbackInfo<v8::Value>& info) |
| 5 { | 5 { |
| 6 {# Local variables #} | 6 {# Local variables #} |
| 7 {% if method.has_exception_state %} | 7 {% if method.has_exception_state %} |
| 8 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na
me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); | 8 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na
me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); |
| 9 {% endif %} | 9 {% endif %} |
| 10 {# Overloaded methods have length checked during overload resolution #} | 10 {# Overloaded methods have length checked during overload resolution #} |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 {% if method.idl_type == 'Promise' %} | 168 {% if method.idl_type == 'Promise' %} |
| 169 TONATIVE_VOID_PROMISE_INTERNAL({{argument.name}}NativeValue, info[{{argument.ind
ex}}]->NumberValue(), info); | 169 TONATIVE_VOID_PROMISE_INTERNAL({{argument.name}}NativeValue, info[{{argument.ind
ex}}]->NumberValue(), info); |
| 170 {% else %} | 170 {% else %} |
| 171 TONATIVE_VOID_INTERNAL({{argument.name}}NativeValue, info[{{argument.index}}]->N
umberValue()); | 171 TONATIVE_VOID_INTERNAL({{argument.name}}NativeValue, info[{{argument.index}}]->N
umberValue()); |
| 172 {% endif %} | 172 {% endif %} |
| 173 if (!std::isnan({{argument.name}}NativeValue)) | 173 if (!std::isnan({{argument.name}}NativeValue)) |
| 174 {# IDL type is used for clamping, for the right bounds, since different | 174 {# IDL type is used for clamping, for the right bounds, since different |
| 175 IDL integer types have same internal C++ type (int or unsigned) #} | 175 IDL integer types have same internal C++ type (int or unsigned) #} |
| 176 {{argument.name}} = clampTo<{{argument.idl_type}}>({{argument.name}}NativeVa
lue); | 176 {{argument.name}} = clampTo<{{argument.idl_type}}>({{argument.name}}NativeVa
lue); |
| 177 {% elif argument.idl_type == 'SerializedScriptValue' %} | 177 {% elif argument.idl_type == 'SerializedScriptValue' %} |
| 178 {{argument.name}} = SerializedScriptValue::create(info[{{argument.index}}], 0, 0
, exceptionState, info.GetIsolate()); | 178 {{argument.name}} = SerializedScriptValue::create(info[{{argument.index}}], 0, e
xceptionState, info.GetIsolate()); |
| 179 if (exceptionState.hadException()) { | 179 if (exceptionState.hadException()) { |
| 180 {{throw_from_exception_state(method)}}; | 180 {{throw_from_exception_state(method)}}; |
| 181 return; | 181 return; |
| 182 } | 182 } |
| 183 {% elif argument.is_variadic_wrapper_type %} | 183 {% elif argument.is_variadic_wrapper_type %} |
| 184 for (int i = {{argument.index}}; i < info.Length(); ++i) { | 184 for (int i = {{argument.index}}; i < info.Length(); ++i) { |
| 185 if (!V8{{argument.idl_type}}::hasInstance(info[i], info.GetIsolate())) { | 185 if (!V8{{argument.idl_type}}::hasInstance(info[i], info.GetIsolate())) { |
| 186 {{throw_type_error(method, '"parameter %s is not of type \'%s\'."' % | 186 {{throw_type_error(method, '"parameter %s is not of type \'%s\'."' % |
| 187 (argument.index + 1, argument.idl_type)) | in
dent(8)}} | 187 (argument.index + 1, argument.idl_type)) | in
dent(8)}} |
| 188 return; | 188 return; |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 if method.is_per_world_bindings else '0' %} | 629 if method.is_per_world_bindings else '0' %} |
| 630 {% set property_attribute = | 630 {% set property_attribute = |
| 631 'static_cast<v8::PropertyAttribute>(%s)' % ' | '.join(method.property_attribut
es) | 631 'static_cast<v8::PropertyAttribute>(%s)' % ' | '.join(method.property_attribut
es) |
| 632 if method.property_attributes else 'v8::None' %} | 632 if method.property_attributes else 'v8::None' %} |
| 633 {% set only_exposed_to_private_script = 'V8DOMConfiguration::OnlyExposedToPrivat
eScript' if method.only_exposed_to_private_script else 'V8DOMConfiguration::Expo
sedToAllScripts' %} | 633 {% set only_exposed_to_private_script = 'V8DOMConfiguration::OnlyExposedToPrivat
eScript' if method.only_exposed_to_private_script else 'V8DOMConfiguration::Expo
sedToAllScripts' %} |
| 634 static const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfig
uration = { | 634 static const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfig
uration = { |
| 635 "{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}},
{{method.length}}, {{only_exposed_to_private_script}}, | 635 "{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}},
{{method.length}}, {{only_exposed_to_private_script}}, |
| 636 }; | 636 }; |
| 637 V8DOMConfiguration::installMethod({{method.function_template}}, {{method.signatu
re}}, {{property_attribute}}, {{method.name}}MethodConfiguration, isolate); | 637 V8DOMConfiguration::installMethod({{method.function_template}}, {{method.signatu
re}}, {{property_attribute}}, {{method.name}}MethodConfiguration, isolate); |
| 638 {%- endmacro %} | 638 {%- endmacro %} |
| OLD | NEW |