Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1379)

Unified Diff: third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor.cpp

Issue 1476863003: bindings: Ignores the last undefined arguments when counting the args. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed a review comment. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor.cpp
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor.cpp
index f097bbb14ae8161fd642ed4ce1a985c40578093e..2c74a5e0fbbf8744db01a6aa964f3c1d1df50839 100644
--- a/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor.cpp
+++ b/third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor.cpp
@@ -135,10 +135,16 @@ static void constructor3(const v8::FunctionCallbackInfo<v8::Value>& info)
V8StringResource<> arg;
V8StringResource<> optArg;
{
+ int numArgsPassed = info.Length();
+ while (numArgsPassed > 0) {
+ if (!info[numArgsPassed - 1]->IsUndefined())
+ break;
+ --numArgsPassed;
+ }
arg = info[0];
if (!arg.prepare())
return;
- if (UNLIKELY(info.Length() <= 1)) {
+ if (UNLIKELY(numArgsPassed <= 1)) {
ScriptState* scriptState = ScriptState::current(info.GetIsolate());
ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate());
Document& document = *toDocument(currentExecutionContext(info.GetIsolate()));
@@ -291,10 +297,16 @@ static void V8TestInterfaceConstructorConstructorCallback(const v8::FunctionCall
V8StringResource<> arg;
V8StringResource<> optArg;
{
+ int numArgsPassed = info.Length();
+ while (numArgsPassed > 0) {
+ if (!info[numArgsPassed - 1]->IsUndefined())
+ break;
+ --numArgsPassed;
+ }
arg = info[0];
if (!arg.prepare())
return;
- if (UNLIKELY(info.Length() <= 1)) {
+ if (UNLIKELY(numArgsPassed <= 1)) {
ScriptState* scriptState = ScriptState::current(info.GetIsolate());
ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate());
Document& document = *toDocument(currentExecutionContext(info.GetIsolate()));

Powered by Google App Engine
This is Rietveld 408576698