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

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

Issue 555133003: Use ExceptionState to throw exceptions when converting arrays (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased Created 6 years, 3 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
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 Element* impl = V8Element::toImpl(info.Holder()); 88 Element* impl = V8Element::toImpl(info.Holder());
89 TONATIVE_VOID(AnimationEffect*, effect, V8AnimationEffect::toImplWithTypeChe ck(info.GetIsolate(), info[0])); 89 TONATIVE_VOID(AnimationEffect*, effect, V8AnimationEffect::toImplWithTypeChe ck(info.GetIsolate(), info[0]));
90 v8SetReturnValueFast(info, WTF::getPtr(ElementAnimation::animate(*impl, effe ct)), impl); 90 v8SetReturnValueFast(info, WTF::getPtr(ElementAnimation::animate(*impl, effe ct)), impl);
91 } 91 }
92 92
93 // [RaisesException] AnimationPlayer animate(sequence<Dictionary> effect); 93 // [RaisesException] AnimationPlayer animate(sequence<Dictionary> effect);
94 void animate2Method(const v8::FunctionCallbackInfo<v8::Value>& info) 94 void animate2Method(const v8::FunctionCallbackInfo<v8::Value>& info)
95 { 95 {
96 ExceptionState exceptionState(ExceptionState::ExecutionContext, "animate", " Element", info.Holder(), info.GetIsolate()); 96 ExceptionState exceptionState(ExceptionState::ExecutionContext, "animate", " Element", info.Holder(), info.GetIsolate());
97 Element* impl = V8Element::toImpl(info.Holder()); 97 Element* impl = V8Element::toImpl(info.Holder());
98 TONATIVE_VOID(Vector<Dictionary>, keyframes, toImplArray<Dictionary>(info[0] , 1, info.GetIsolate())); 98 TONATIVE_VOID_EXCEPTIONSTATE(Vector<Dictionary>, keyframes, toImplArray<Dict ionary>(info[0], 1, info.GetIsolate(), exceptionState), exceptionState);
99 RefPtrWillBeRawPtr<AnimationPlayer> result = ElementAnimation::animate(*impl , keyframes, exceptionState); 99 RefPtrWillBeRawPtr<AnimationPlayer> result = ElementAnimation::animate(*impl , keyframes, exceptionState);
100 if (exceptionState.throwIfNeeded()) 100 if (exceptionState.throwIfNeeded())
101 return; 101 return;
102 v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl); 102 v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl);
103 } 103 }
104 104
105 // AnimationPlayer animate(AnimationEffect? effect, double timing); 105 // AnimationPlayer animate(AnimationEffect? effect, double timing);
106 void animate3Method(const v8::FunctionCallbackInfo<v8::Value>& info) 106 void animate3Method(const v8::FunctionCallbackInfo<v8::Value>& info)
107 { 107 {
108 Element* impl = V8Element::toImpl(info.Holder()); 108 Element* impl = V8Element::toImpl(info.Holder());
(...skipping 13 matching lines...) Expand all
122 return; 122 return;
123 } 123 }
124 v8SetReturnValueFast(info, WTF::getPtr(ElementAnimation::animate(*impl, effe ct, timingInput)), impl); 124 v8SetReturnValueFast(info, WTF::getPtr(ElementAnimation::animate(*impl, effe ct, timingInput)), impl);
125 } 125 }
126 126
127 // [RaisesException] AnimationPlayer animate(sequence<Dictionary> effect, double timing); 127 // [RaisesException] AnimationPlayer animate(sequence<Dictionary> effect, double timing);
128 void animate5Method(const v8::FunctionCallbackInfo<v8::Value>& info) 128 void animate5Method(const v8::FunctionCallbackInfo<v8::Value>& info)
129 { 129 {
130 ExceptionState exceptionState(ExceptionState::ExecutionContext, "animate", " Element", info.Holder(), info.GetIsolate()); 130 ExceptionState exceptionState(ExceptionState::ExecutionContext, "animate", " Element", info.Holder(), info.GetIsolate());
131 Element* impl = V8Element::toImpl(info.Holder()); 131 Element* impl = V8Element::toImpl(info.Holder());
132 TONATIVE_VOID(Vector<Dictionary>, keyframes, toImplArray<Dictionary>(info[0] , 1, info.GetIsolate())); 132 TONATIVE_VOID_EXCEPTIONSTATE(Vector<Dictionary>, keyframes, toImplArray<Dict ionary>(info[0], 1, info.GetIsolate(), exceptionState), exceptionState);
133 TONATIVE_VOID(double, duration, static_cast<double>(info[1]->NumberValue())) ; 133 TONATIVE_VOID(double, duration, static_cast<double>(info[1]->NumberValue())) ;
134 RefPtrWillBeRawPtr<AnimationPlayer> result = ElementAnimation::animate(*impl , keyframes, duration, exceptionState); 134 RefPtrWillBeRawPtr<AnimationPlayer> result = ElementAnimation::animate(*impl , keyframes, duration, exceptionState);
135 if (exceptionState.throwIfNeeded()) 135 if (exceptionState.throwIfNeeded())
136 return; 136 return;
137 v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl); 137 v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl);
138 } 138 }
139 139
140 // [RaisesException] AnimationPlayer animate(sequence<Dictionary> effect, Dictio nary timing); 140 // [RaisesException] AnimationPlayer animate(sequence<Dictionary> effect, Dictio nary timing);
141 void animate6Method(const v8::FunctionCallbackInfo<v8::Value>& info) 141 void animate6Method(const v8::FunctionCallbackInfo<v8::Value>& info)
142 { 142 {
143 ExceptionState exceptionState(ExceptionState::ExecutionContext, "animate", " Element", info.Holder(), info.GetIsolate()); 143 ExceptionState exceptionState(ExceptionState::ExecutionContext, "animate", " Element", info.Holder(), info.GetIsolate());
144 Element* impl = V8Element::toImpl(info.Holder()); 144 Element* impl = V8Element::toImpl(info.Holder());
145 TONATIVE_VOID(Vector<Dictionary>, keyframes, toImplArray<Dictionary>(info[0] , 1, info.GetIsolate())); 145 TONATIVE_VOID_EXCEPTIONSTATE(Vector<Dictionary>, keyframes, toImplArray<Dict ionary>(info[0], 1, info.GetIsolate(), exceptionState), exceptionState);
146 TONATIVE_VOID(Dictionary, timingInput, Dictionary(info[1], info.GetIsolate() )); 146 TONATIVE_VOID(Dictionary, timingInput, Dictionary(info[1], info.GetIsolate() ));
147 if (!timingInput.isUndefinedOrNull() && !timingInput.isObject()) { 147 if (!timingInput.isUndefinedOrNull() && !timingInput.isObject()) {
148 exceptionState.throwTypeError("parameter 2 ('timingInput') is not an obj ect."); 148 exceptionState.throwTypeError("parameter 2 ('timingInput') is not an obj ect.");
149 exceptionState.throwIfNeeded(); 149 exceptionState.throwIfNeeded();
150 return; 150 return;
151 } 151 }
152 RefPtrWillBeRawPtr<AnimationPlayer> result = ElementAnimation::animate(*impl , keyframes, timingInput, exceptionState); 152 RefPtrWillBeRawPtr<AnimationPlayer> result = ElementAnimation::animate(*impl , keyframes, timingInput, exceptionState);
153 if (exceptionState.throwIfNeeded()) 153 if (exceptionState.throwIfNeeded())
154 return; 154 return;
155 v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl); 155 v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 setArityTypeError(exceptionState, "[1]", info.Length()); 228 setArityTypeError(exceptionState, "[1]", info.Length());
229 exceptionState.throwIfNeeded(); 229 exceptionState.throwIfNeeded();
230 return; 230 return;
231 break; 231 break;
232 } 232 }
233 exceptionState.throwTypeError("No function was found that matched the signat ure provided."); 233 exceptionState.throwTypeError("No function was found that matched the signat ure provided.");
234 exceptionState.throwIfNeeded(); 234 exceptionState.throwIfNeeded();
235 } 235 }
236 236
237 } // namespace blink 237 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8StringResource.h ('k') | Source/bindings/core/v8/custom/V8MessageEventCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698