 Chromium Code Reviews
 Chromium Code Reviews Issue 296403007:
  Set correct Function.length on overloaded methods  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master
    
  
    Issue 296403007:
  Set correct Function.length on overloaded methods  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master| Index: Source/bindings/templates/methods.cpp | 
| diff --git a/Source/bindings/templates/methods.cpp b/Source/bindings/templates/methods.cpp | 
| index f1f0fdb5593b5155d4e13acf141d648f200f3ca3..6b2b9ff4b826ce7e7a6f4a0232ba080da5e38427 100644 | 
| --- a/Source/bindings/templates/methods.cpp | 
| +++ b/Source/bindings/templates/methods.cpp | 
| @@ -420,6 +420,16 @@ static void {{method.name}}MethodCallback{{world_suffix}}(const v8::FunctionCall | 
| {##############################################################################} | 
| +{% macro method_length(method) %} | 
| 
Nils Barth (inactive)
2014/06/04 07:22:02
Could you put this in Python instead, as it's logi
 
Nils Barth (inactive)
2014/06/04 07:30:50
Also, could you quote the spec?
The value of the
 
Jens Widell
2014/06/04 11:12:54
Done. Although not quite as suggested I think, sin
 
Nils Barth (inactive)
2014/06/05 00:26:22
=P good point that...
 | 
| +{% if method.overloads %} | 
| +{{method.overloads.minarg}} | 
| +{%- else %} | 
| +{{method.number_of_required_arguments}} | 
| +{%- endif %} | 
| +{% endmacro %} | 
| + | 
| + | 
| +{##############################################################################} | 
| {% macro origin_safe_method_getter(method, world_suffix) %} | 
| static void {{method.name}}OriginSafeMethodGetter{{world_suffix}}(const v8::PropertyCallbackInfo<v8::Value>& info) | 
| { | 
| @@ -430,7 +440,7 @@ static void {{method.name}}OriginSafeMethodGetter{{world_suffix}}(const v8::Prop | 
| static int domTemplateKey; // This address is used for a key to look up the dom template. | 
| V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 
| {# FIXME: 1 case of [DoNotCheckSignature] in Window.idl may differ #} | 
| - v8::Handle<v8::FunctionTemplate> privateTemplate = data->domTemplate(&domTemplateKey, {{cpp_class}}V8Internal::{{method.name}}MethodCallback{{world_suffix}}, v8Undefined(), {{signature}}, {{method.number_of_required_or_variadic_arguments}}); | 
| + v8::Handle<v8::FunctionTemplate> privateTemplate = data->domTemplate(&domTemplateKey, {{cpp_class}}V8Internal::{{method.name}}MethodCallback{{world_suffix}}, v8Undefined(), {{signature}}, {{method_length(method)}}); | 
| v8::Handle<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(info.This(), isolate); | 
| if (holder.IsEmpty()) { | 
| @@ -442,7 +452,7 @@ static void {{method.name}}OriginSafeMethodGetter{{world_suffix}}(const v8::Prop | 
| {{cpp_class}}* impl = {{v8_class}}::toNative(holder); | 
| if (!BindingSecurity::shouldAllowAccessToFrame(isolate, impl->frame(), DoNotReportSecurityError)) { | 
| static int sharedTemplateKey; // This address is used for a key to look up the dom template. | 
| - v8::Handle<v8::FunctionTemplate> sharedTemplate = data->domTemplate(&sharedTemplateKey, {{cpp_class}}V8Internal::{{method.name}}MethodCallback{{world_suffix}}, v8Undefined(), {{signature}}, {{method.number_of_required_or_variadic_arguments}}); | 
| + v8::Handle<v8::FunctionTemplate> sharedTemplate = data->domTemplate(&sharedTemplateKey, {{cpp_class}}V8Internal::{{method.name}}MethodCallback{{world_suffix}}, v8Undefined(), {{signature}}, {{method_length(method)}}); | 
| v8SetReturnValue(info, sharedTemplate->GetFunction()); | 
| return; | 
| } |