OLD | NEW |
1 {% from 'utilities.cpp' import declare_enum_validation_variable, v8_value_to_loc
al_cpp_value %} | 1 {% from 'utilities.cpp' import declare_enum_validation_variable, v8_value_to_loc
al_cpp_value %} |
2 | 2 |
3 {##############################################################################} | 3 {##############################################################################} |
4 {% macro generate_method(method, world_suffix) %} | 4 {% macro generate_method(method, world_suffix) %} |
5 {% if method.returns_promise and method.has_exception_state %} | 5 {% if method.returns_promise and method.has_exception_state %} |
6 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}Promis
e(const v8::FunctionCallbackInfo<v8::Value>& info, ExceptionState& exceptionStat
e) | 6 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}Promis
e(const v8::FunctionCallbackInfo<v8::Value>& info, ExceptionState& exceptionStat
e) |
7 {% else %} | 7 {% else %} |
8 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
v8::FunctionCallbackInfo<v8::Value>& info) | 8 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
v8::FunctionCallbackInfo<v8::Value>& info) |
9 {% endif %} | 9 {% endif %} |
10 { | 10 { |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 Note: for variadic arguments, the type checking is done for each matched | 201 Note: for variadic arguments, the type checking is done for each matched |
202 argument instead; see argument.is_variadic_wrapper_type code-path above. #} | 202 argument instead; see argument.is_variadic_wrapper_type code-path above. #} |
203 if (!{{argument.name}}{% if argument.is_nullable %} && !isUndefinedOrNull(info[{
{argument.index}}]){% endif %}) { | 203 if (!{{argument.name}}{% if argument.is_nullable %} && !isUndefinedOrNull(info[{
{argument.index}}]){% endif %}) { |
204 {{throw_type_error(method, '"parameter %s is not of type \'%s\'."' % | 204 {{throw_type_error(method, '"parameter %s is not of type \'%s\'."' % |
205 (argument.index + 1, argument.idl_type)) | indent
}} | 205 (argument.index + 1, argument.idl_type)) | indent
}} |
206 } | 206 } |
207 {% elif argument.enum_values %} | 207 {% elif argument.enum_values %} |
208 {# Invalid enum values: http://www.w3.org/TR/WebIDL/#idl-enums #} | 208 {# Invalid enum values: http://www.w3.org/TR/WebIDL/#idl-enums #} |
209 {{declare_enum_validation_variable(argument.enum_values)}} | 209 {{declare_enum_validation_variable(argument.enum_values)}} |
210 if (!isValidEnum({{argument.name}}, validValues, WTF_ARRAY_LENGTH(validValues),
"{{argument.enum_type}}", exceptionState)) { | 210 if (!isValidEnum({{argument.name}}, validValues, WTF_ARRAY_LENGTH(validValues),
"{{argument.enum_type}}", exceptionState)) { |
| 211 {% if not method.returns_promise %} |
211 exceptionState.throwIfNeeded(); | 212 exceptionState.throwIfNeeded(); |
| 213 {% endif %} |
212 return; | 214 return; |
213 } | 215 } |
214 {% elif argument.idl_type == 'Promise' %} | 216 {% elif argument.idl_type == 'Promise' %} |
215 {# We require this for our implementation of promises, though not in spec: | 217 {# We require this for our implementation of promises, though not in spec: |
216 http://heycam.github.io/webidl/#es-promise #} | 218 http://heycam.github.io/webidl/#es-promise #} |
217 if (!{{argument.name}}.isUndefinedOrNull() && !{{argument.name}}.isObject()) { | 219 if (!{{argument.name}}.isUndefinedOrNull() && !{{argument.name}}.isObject()) { |
218 {{throw_type_error(method, '"parameter %s (\'%s\') is not an object."' % | 220 {{throw_type_error(method, '"parameter %s (\'%s\') is not an object."' % |
219 (argument.index + 1, argument.name)) | indent}} | 221 (argument.index + 1, argument.name)) | indent}} |
220 } | 222 } |
221 {% endif %} | 223 {% endif %} |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 {% filter runtime_enabled(method.overloads.runtime_enabled_function_all | 685 {% filter runtime_enabled(method.overloads.runtime_enabled_function_all |
684 if method.overloads else | 686 if method.overloads else |
685 method.runtime_enabled_function) %} | 687 method.runtime_enabled_function) %} |
686 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration
= {{method_configuration(method)}}; | 688 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration
= {{method_configuration(method)}}; |
687 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto
typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration); | 689 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto
typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration); |
688 {% endfilter %}{# runtime_enabled() #} | 690 {% endfilter %}{# runtime_enabled() #} |
689 {% endfilter %}{# exposed() #} | 691 {% endfilter %}{# exposed() #} |
690 {% endfor %} | 692 {% endfor %} |
691 {% endif %} | 693 {% endif %} |
692 {%- endmacro %} | 694 {%- endmacro %} |
OLD | NEW |