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 {% if method.has_exception_state %} | 6 {% if method.has_exception_state %} |
7 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na
me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); | 7 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na
me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); |
8 {% endif %} | 8 {% endif %} |
9 {% if method.name in ['addEventListener', 'removeEventListener'] %} | 9 {% if method.name in ['addEventListener', 'removeEventListener'] %} |
10 {{add_remove_event_listener_method(method.name) | indent}} | 10 {{add_remove_event_listener_method(method.name) | indent}} |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 {{cpp_method_call(method, argument.v8_set_return_value_for_main_world, argum
ent.cpp_value) | indent}} | 90 {{cpp_method_call(method, argument.v8_set_return_value_for_main_world, argum
ent.cpp_value) | indent}} |
91 {% else %} | 91 {% else %} |
92 {{cpp_method_call(method, argument.v8_set_return_value, argument.cpp_value)
| indent}} | 92 {{cpp_method_call(method, argument.v8_set_return_value, argument.cpp_value)
| indent}} |
93 {% endif %} | 93 {% endif %} |
94 return; | 94 return; |
95 } | 95 } |
96 {% endif %} | 96 {% endif %} |
97 {% if method.is_strict_type_checking and argument.is_wrapper_type %} | 97 {% if method.is_strict_type_checking and argument.is_wrapper_type %} |
98 {# Type checking for wrapper interface types (if interface not implemented, | 98 {# Type checking for wrapper interface types (if interface not implemented, |
99 throw TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #} | 99 throw TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #} |
100 if (info.Length() > {{argument.index}} && !{% if argument.is_nullable %}isUndefi
nedOrNull(info[{{argument.index}}]){% else %}info[{{argument.index}}]->IsUndefin
ed(){% endif %} && !V8{{argument.idl_type}}::hasInstance(info[{{argument.index}}
], info.GetIsolate())) { | 100 if (info.Length() > {{argument.index}} && ({% if argument.is_nullable %}!isUndef
inedOrNull(info[{{argument.index}}]) && {% else %}isUndefinedOrNull(info[{{argum
ent.index}}]) || {% endif %}!V8{{argument.idl_type}}::hasInstance(info[{{argumen
t.index}}], info.GetIsolate()))) { |
101 {{throw_type_error(method, '"parameter %s is not of type \'%s\'."' % | 101 {{throw_type_error(method, '"parameter %s is not of type \'%s\'."' % |
102 (argument.index + 1, argument.idl_type)) | indent
}} | 102 (argument.index + 1, argument.idl_type)) | indent
}} |
103 return; | 103 return; |
104 } | 104 } |
105 {% endif %} | 105 {% endif %} |
106 {% if argument.is_callback_interface %} | 106 {% if argument.is_callback_interface %} |
107 {% if argument.is_optional %} | 107 {% if argument.is_optional %} |
108 OwnPtr<{{argument.idl_type}}> {{argument.name}}; | 108 OwnPtr<{{argument.idl_type}}> {{argument.name}}; |
109 if (info.Length() > {{argument.index}} && !isUndefinedOrNull(info[{{argument.ind
ex}}])) { | 109 if (info.Length() > {{argument.index}} && !isUndefinedOrNull(info[{{argument.ind
ex}}])) { |
110 if (!info[{{argument.index}}]->IsFunction()) { | 110 if (!info[{{argument.index}}]->IsFunction()) { |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 v8::Handle<v8::Object> wrapper = info.Holder(); | 424 v8::Handle<v8::Object> wrapper = info.Holder(); |
425 {% if is_constructor_raises_exception %} | 425 {% if is_constructor_raises_exception %} |
426 if (exceptionState.throwIfNeeded()) | 426 if (exceptionState.throwIfNeeded()) |
427 return; | 427 return; |
428 {% endif %} | 428 {% endif %} |
429 | 429 |
430 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{v8
_class}}Constructor::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfigu
ration::Dependent); | 430 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{v8
_class}}Constructor::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfigu
ration::Dependent); |
431 v8SetReturnValue(info, wrapper); | 431 v8SetReturnValue(info, wrapper); |
432 } | 432 } |
433 {% endmacro %} | 433 {% endmacro %} |
OLD | NEW |