| Index: third_party/WebKit/Source/bindings/templates/methods.cpp
|
| diff --git a/third_party/WebKit/Source/bindings/templates/methods.cpp b/third_party/WebKit/Source/bindings/templates/methods.cpp
|
| index 33c828609622cc2a0d9add39acff3b9503f8e381..a8f8b352b2c21c01182e3db5dca133274ea0dca0 100644
|
| --- a/third_party/WebKit/Source/bindings/templates/methods.cpp
|
| +++ b/third_party/WebKit/Source/bindings/templates/methods.cpp
|
| @@ -70,6 +70,17 @@ static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
|
| {{generate_argument_var_declaration(argument)}};
|
| {% endfor %}
|
| {
|
| + {% if method.has_optional_argument_without_default_value %}
|
| + {# Count the effective number of arguments. (arg1, arg2, undefined) is
|
| + interpreted as two arguments are passed and (arg1, undefined, arg3) is
|
| + interpreted as three arguments are passed. #}
|
| + int numArgsPassed = info.Length();
|
| + while (numArgsPassed > 0) {
|
| + if (!info[numArgsPassed - 1]->IsUndefined())
|
| + break;
|
| + --numArgsPassed;
|
| + }
|
| + {% endif %}
|
| {% for argument in method.arguments %}
|
| {% if argument.set_default_value %}
|
| if (!info[{{argument.index}}]->IsUndefined()) {
|
| @@ -104,7 +115,7 @@ RefPtrWillBeRawPtr<{{argument.idl_type}}> {{argument.name}}
|
| {# Optional arguments without a default value generate an early call with
|
| fewer arguments if they are omitted.
|
| Optional Dictionary arguments default to empty dictionary. #}
|
| -if (UNLIKELY(info.Length() <= {{argument.index}})) {
|
| +if (UNLIKELY(numArgsPassed <= {{argument.index}})) {
|
| {% if world_suffix %}
|
| {{cpp_method_call(method, argument.v8_set_return_value_for_main_world, argument.cpp_value) | indent}}
|
| {% else %}
|
|
|