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

Unified Diff: Source/bindings/core/v8/V8Binding.h

Issue 732483002: bindings: make toImplArguments() less strict (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/V8Binding.h
diff --git a/Source/bindings/core/v8/V8Binding.h b/Source/bindings/core/v8/V8Binding.h
index 3df3807ca2defda002d9e9701452389adc9c65fc..17789b32baf9f3dfb6e2909ab808cefa7996b857 100644
--- a/Source/bindings/core/v8/V8Binding.h
+++ b/Source/bindings/core/v8/V8Binding.h
@@ -1005,15 +1005,16 @@ Vector<T> toImplArray(v8::Handle<v8::Value> value, int argumentIndex, v8::Isolat
template <class T>
Vector<T> toImplArguments(const v8::FunctionCallbackInfo<v8::Value>& info, int startIndex, ExceptionState& exceptionState)
{
- ASSERT(startIndex <= info.Length());
Vector<T> result;
typedef NativeValueTraits<T> TraitsType;
int length = info.Length();
- result.reserveInitialCapacity(length);
- for (int i = startIndex; i < length; ++i) {
- result.uncheckedAppend(TraitsType::nativeValue(info[i], info.GetIsolate(), exceptionState));
- if (exceptionState.hadException())
- return Vector<T>();
+ if (startIndex < length) {
+ result.reserveInitialCapacity(length - startIndex);
+ for (int i = startIndex; i < length; ++i) {
+ result.uncheckedAppend(TraitsType::nativeValue(info[i], info.GetIsolate(), exceptionState));
+ if (exceptionState.hadException())
+ return Vector<T>();
+ }
}
return result;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698