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

Side by Side Diff: Source/bindings/v8/custom/V8ElementCustom.cpp

Issue 284163002: Better arity checks for overloads (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Return properly Created 6 years, 7 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/bindings/v8/V8Binding.cpp ('k') | Source/bindings/v8/custom/V8SubtleCryptoCustom.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 ASSERT(impl); 157 ASSERT(impl);
158 RefPtr<AnimationPlayer> result = ElementAnimation::animate(*impl, keyframes, timingInput, exceptionState); 158 RefPtr<AnimationPlayer> result = ElementAnimation::animate(*impl, keyframes, timingInput, exceptionState);
159 if (exceptionState.throwIfNeeded()) 159 if (exceptionState.throwIfNeeded())
160 return; 160 return;
161 v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl); 161 v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl);
162 } 162 }
163 163
164 void V8Element::animateMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& i nfo) 164 void V8Element::animateMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& i nfo)
165 { 165 {
166 v8::Isolate* isolate = info.GetIsolate(); 166 v8::Isolate* isolate = info.GetIsolate();
167 ExceptionState exceptionState(ExceptionState::ExecutionContext, "animate", " Element", info.Holder(), isolate);
167 // AnimationPlayer animate( 168 // AnimationPlayer animate(
168 // (AnimationEffect or sequence<Dictionary>)? effect, 169 // (AnimationEffect or sequence<Dictionary>)? effect,
169 // optional (double or Dictionary) timing); 170 // optional (double or Dictionary) timing);
170 switch (info.Length()) { 171 switch (info.Length()) {
171 case 1: 172 case 1:
172 // null resolved as to AnimationEffect, as if the member were nullable: 173 // null resolved as to AnimationEffect, as if the member were nullable:
173 // (AnimationEffect? or sequence<Dictionary>) 174 // (AnimationEffect? or sequence<Dictionary>)
174 // instead of the *union* being nullable: 175 // instead of the *union* being nullable:
175 // (AnimationEffect or sequence<Dictionary>)? 176 // (AnimationEffect or sequence<Dictionary>)?
176 // AnimationPlayer animate(AnimationEffect? effect); 177 // AnimationPlayer animate(AnimationEffect? effect);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 return; 223 return;
223 } 224 }
224 // [MeasureAs=ElementAnimateKeyframeListEffectDoubleTiming] 225 // [MeasureAs=ElementAnimateKeyframeListEffectDoubleTiming]
225 // AnimationPlayer animate(sequence<Dictionary> effect, double timing); 226 // AnimationPlayer animate(sequence<Dictionary> effect, double timing);
226 if (info[0]->IsArray()) { 227 if (info[0]->IsArray()) {
227 UseCounter::count(callingExecutionContext(isolate), UseCounter::Elem entAnimateKeyframeListEffectDoubleTiming); 228 UseCounter::count(callingExecutionContext(isolate), UseCounter::Elem entAnimateKeyframeListEffectDoubleTiming);
228 animate5Method(info); 229 animate5Method(info);
229 return; 230 return;
230 } 231 }
231 break; 232 break;
232 } 233 default:
233 ExceptionState exceptionState(ExceptionState::ExecutionContext, "animate", " Element", info.Holder(), isolate); 234 throwArityTypeError(exceptionState, "[1]", info.Length());
234 if (UNLIKELY(info.Length() < 1)) {
235 throwArityTypeError(exceptionState, 1, info.Length());
236 return; 235 return;
236 break;
237 } 237 }
238 exceptionState.throwTypeError("No function was found that matched the signat ure provided."); 238 exceptionState.throwTypeError("No function was found that matched the signat ure provided.");
239 exceptionState.throwIfNeeded(); 239 exceptionState.throwIfNeeded();
240 } 240 }
241 241
242 } // namespace WebCore 242 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8Binding.cpp ('k') | Source/bindings/v8/custom/V8SubtleCryptoCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698