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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 } | 170 } |
171 {% else %}{# argument.is_optional #} | 171 {% else %}{# argument.is_optional #} |
172 if (info.Length() <= {{argument.index}} || !{% if argument.is_nullable %}(info[{
{argument.index}}]->IsFunction() || info[{{argument.index}}]->IsNull()){% else %
}info[{{argument.index}}]->IsFunction(){% endif %}) { | 172 if (info.Length() <= {{argument.index}} || !{% if argument.is_nullable %}(info[{
{argument.index}}]->IsFunction() || info[{{argument.index}}]->IsNull()){% else %
}info[{{argument.index}}]->IsFunction(){% endif %}) { |
173 {{throw_argument_error(method, argument, "The callback provided as parameter %
(index)d is not a function.")}} | 173 {{throw_argument_error(method, argument, "The callback provided as parameter %
(index)d is not a function.")}} |
174 return; | 174 return; |
175 } | 175 } |
176 {{argument.name}} = {% if argument.is_nullable %}info[{{argument.index}}]->IsNul
l() ? nullptr : {% endif %}V8{{argument.idl_type}}::create(v8::Local<v8::Functio
n>::Cast(info[{{argument.index}}]), ScriptState::current(info.GetIsolate())); | 176 {{argument.name}} = {% if argument.is_nullable %}info[{{argument.index}}]->IsNul
l() ? nullptr : {% endif %}V8{{argument.idl_type}}::create(v8::Local<v8::Functio
n>::Cast(info[{{argument.index}}]), ScriptState::current(info.GetIsolate())); |
177 {% endif %}{# argument.is_optional #} | 177 {% endif %}{# argument.is_optional #} |
178 {% endif %}{# argument.idl_type == 'EventListener' #} | 178 {% endif %}{# argument.idl_type == 'EventListener' #} |
179 {% elif argument.is_callback_function %} | 179 {% elif argument.is_callback_function %} |
180 if (!info[{{argument.index}}]->IsFunction(){% if argument.is_nullable %} && !inf
o[{{argument.index}}]->IsNull(){% endif %}) { | 180 if (!info[{{argument.index}}]->IsObject() || !v8::Local<v8::Object>::Cast(info[{
{argument.index}}])->IsCallable()) { |
181 {{throw_argument_error(method, argument, "The callback provided as parameter %
(index)d is not a function.")}} | 181 {{throw_argument_error(method, argument, "The callback provided as parameter %
(index)d is not a function.")}} |
182 return; | 182 return; |
183 } | 183 } |
184 {{v8_value_to_local_cpp_value(argument)}} | 184 {{v8_value_to_local_cpp_value(argument)}} |
185 {% elif argument.is_variadic_wrapper_type %} | 185 {% elif argument.is_variadic_wrapper_type %} |
186 for (int i = {{argument.index}}; i < info.Length(); ++i) { | 186 for (int i = {{argument.index}}; i < info.Length(); ++i) { |
187 if (!V8{{argument.idl_type}}::hasInstance(info[i], info.GetIsolate())) { | 187 if (!V8{{argument.idl_type}}::hasInstance(info[i], info.GetIsolate())) { |
188 {{throw_argument_error(method, argument, "parameter %(index)d is not of type
'%(type)s'.")}} | 188 {{throw_argument_error(method, argument, "parameter %(index)d is not of type
'%(type)s'.")}} |
189 return; | 189 return; |
190 } | 190 } |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 if method.overloads else | 637 if method.overloads else |
638 method.runtime_enabled_feature_name) %} | 638 method.runtime_enabled_feature_name) %} |
639 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration
= {{method_configuration(method)}}; | 639 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration
= {{method_configuration(method)}}; |
640 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto
typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration); | 640 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto
typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration); |
641 {% endfilter %}{# runtime_enabled() #} | 641 {% endfilter %}{# runtime_enabled() #} |
642 {% endfilter %}{# exposed() #} | 642 {% endfilter %}{# exposed() #} |
643 {% endfilter %}{# secure_context() #} | 643 {% endfilter %}{# secure_context() #} |
644 {% endfor %} | 644 {% endfor %} |
645 {% endif %} | 645 {% endif %} |
646 {%- endmacro %} | 646 {%- endmacro %} |
OLD | NEW |