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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 271 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
272 } | 272 } |
273 {% endfilter %} | 273 {% endfilter %} |
274 {% endmacro %} | 274 {% endmacro %} |
275 | 275 |
276 | 276 |
277 {##############################################################################} | 277 {##############################################################################} |
278 {% macro origin_safe_method_getter(method, world_suffix) %} | 278 {% macro origin_safe_method_getter(method, world_suffix) %} |
279 static void {{method.name}}OriginSafeMethodGetter{{world_suffix}}(const v8::Prop
ertyCallbackInfo<v8::Value>& info) | 279 static void {{method.name}}OriginSafeMethodGetter{{world_suffix}}(const v8::Prop
ertyCallbackInfo<v8::Value>& info) |
280 { | 280 { |
| 281 {% set signature = 'v8::Local<v8::Signature>()' |
| 282 if method.is_do_not_check_signature else |
| 283 'v8::Signature::New(info.GetIsolate(), %s::domTemplate(in
fo.GetIsolate(), currentWorldType))' % v8_class %} |
281 {# FIXME: don't call GetIsolate() so often #} | 284 {# FIXME: don't call GetIsolate() so often #} |
282 // This is only for getting a unique pointer which we can pass to privateTem
plate. | 285 // This is only for getting a unique pointer which we can pass to privateTem
plate. |
283 static int privateTemplateUniqueKey; | 286 static int privateTemplateUniqueKey; |
284 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); | 287 WrapperWorldType currentWorldType = worldType(info.GetIsolate()); |
285 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); | 288 V8PerIsolateData* data = V8PerIsolateData::from(info.GetIsolate()); |
286 {# FIXME: 1 case of [DoNotCheckSignature] in Window.idl may differ #} | 289 {# FIXME: 1 case of [DoNotCheckSignature] in Window.idl may differ #} |
287 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur
rentWorldType, &privateTemplateUniqueKey, {{cpp_class}}V8Internal::{{method.name
}}MethodCallback{{world_suffix}}, v8Undefined(), v8::Signature::New(info.GetIsol
ate(), {{v8_class}}::domTemplate(info.GetIsolate(), currentWorldType)), {{method
.number_of_required_or_variadic_arguments}}); | 290 v8::Handle<v8::FunctionTemplate> privateTemplate = data->privateTemplate(cur
rentWorldType, &privateTemplateUniqueKey, {{cpp_class}}V8Internal::{{method.name
}}MethodCallback{{world_suffix}}, v8Undefined(), {{signature}}, {{method.number_
of_required_or_variadic_arguments}}); |
288 | 291 |
289 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain({{
v8_class}}::domTemplate(info.GetIsolate(), currentWorldType)); | 292 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain({{
v8_class}}::domTemplate(info.GetIsolate(), currentWorldType)); |
290 if (holder.IsEmpty()) { | 293 if (holder.IsEmpty()) { |
291 // This is only reachable via |object.__proto__.func|, in which case it | 294 // This is only reachable via |object.__proto__.func|, in which case it |
292 // has already passed the same origin security check | 295 // has already passed the same origin security check |
293 v8SetReturnValue(info, privateTemplate->GetFunction()); | 296 v8SetReturnValue(info, privateTemplate->GetFunction()); |
294 return; | 297 return; |
295 } | 298 } |
296 {{cpp_class}}* imp = {{v8_class}}::toNative(holder); | 299 {{cpp_class}}* imp = {{v8_class}}::toNative(holder); |
297 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), imp->frame
(), DoNotReportSecurityError)) { | 300 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), imp->frame
(), DoNotReportSecurityError)) { |
298 static int sharedTemplateUniqueKey; | 301 static int sharedTemplateUniqueKey; |
299 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate(
currentWorldType, &sharedTemplateUniqueKey, {{cpp_class}}V8Internal::{{method.na
me}}MethodCallback{{world_suffix}}, v8Undefined(), v8::Signature::New(info.GetIs
olate(), {{v8_class}}::domTemplate(info.GetIsolate(), currentWorldType)), {{meth
od.number_of_required_or_variadic_arguments}}); | 302 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->privateTemplate(
currentWorldType, &sharedTemplateUniqueKey, {{cpp_class}}V8Internal::{{method.na
me}}MethodCallback{{world_suffix}}, v8Undefined(), {{signature}}, {{method.numbe
r_of_required_or_variadic_arguments}}); |
300 v8SetReturnValue(info, sharedTemplate->GetFunction()); | 303 v8SetReturnValue(info, sharedTemplate->GetFunction()); |
301 return; | 304 return; |
302 } | 305 } |
303 | 306 |
304 v8::Local<v8::Value> hiddenValue = getHiddenValue(info.GetIsolate(), info.Th
is(), "{{method.name}}"); | 307 v8::Local<v8::Value> hiddenValue = getHiddenValue(info.GetIsolate(), info.Th
is(), "{{method.name}}"); |
305 if (!hiddenValue.IsEmpty()) { | 308 if (!hiddenValue.IsEmpty()) { |
306 v8SetReturnValue(info, hiddenValue); | 309 v8SetReturnValue(info, hiddenValue); |
307 return; | 310 return; |
308 } | 311 } |
309 | 312 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 v8::Handle<v8::Object> wrapper = info.Holder(); | 401 v8::Handle<v8::Object> wrapper = info.Holder(); |
399 {% if is_constructor_raises_exception %} | 402 {% if is_constructor_raises_exception %} |
400 if (exceptionState.throwIfNeeded()) | 403 if (exceptionState.throwIfNeeded()) |
401 return; | 404 return; |
402 {% endif %} | 405 {% endif %} |
403 | 406 |
404 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{v8
_class}}Constructor::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfigu
ration::Dependent); | 407 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{v8
_class}}Constructor::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfigu
ration::Dependent); |
405 v8SetReturnValue(info, wrapper); | 408 v8SetReturnValue(info, wrapper); |
406 } | 409 } |
407 {% endmacro %} | 410 {% endmacro %} |
OLD | NEW |