Update custom setter implementations to perform type checks
[WebKit-https.git] / Source / WebCore / bindings / scripts / test / JS / JSTestTypedefs.cpp
1 /*
2     This file is part of the WebKit open source project.
3     This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5     This library is free software; you can redistribute it and/or
6     modify it under the terms of the GNU Library General Public
7     License as published by the Free Software Foundation; either
8     version 2 of the License, or (at your option) any later version.
9
10     This library is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13     Library General Public License for more details.
14
15     You should have received a copy of the GNU Library General Public License
16     along with this library; see the file COPYING.LIB.  If not, write to
17     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18     Boston, MA 02110-1301, USA.
19 */
20
21 #include "config.h"
22 #include "JSTestTypedefs.h"
23
24 #include "DOMStringList.h"
25 #include "ExceptionCode.h"
26 #include "JSDOMBinding.h"
27 #include "JSDOMStringList.h"
28 #include "JSSVGPoint.h"
29 #include "JSSerializedScriptValue.h"
30 #include "JSTestCallback.h"
31 #include "JSTestEventTarget.h"
32 #include "JSTestSubObj.h"
33 #include "SVGPoint.h"
34 #include "SerializedScriptValue.h"
35 #include "TestTypedefs.h"
36 #include "URL.h"
37 #include <runtime/Error.h>
38 #include <runtime/JSArray.h>
39 #include <runtime/JSString.h>
40 #include <wtf/GetPtr.h>
41
42 using namespace JSC;
43
44 namespace WebCore {
45
46 /* Hash table */
47
48 static const HashTableValue JSTestTypedefsTableValues[] =
49 {
50     { "unsignedLongLongAttr", DontDelete, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestTypedefsUnsignedLongLongAttr), (intptr_t)setJSTestTypedefsUnsignedLongLongAttr },
51     { "immutableSerializedScriptValue", DontDelete, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestTypedefsImmutableSerializedScriptValue), (intptr_t)setJSTestTypedefsImmutableSerializedScriptValue },
52     { "attrWithGetterException", DontDelete, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestTypedefsAttrWithGetterException), (intptr_t)setJSTestTypedefsAttrWithGetterException },
53     { "attrWithSetterException", DontDelete, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestTypedefsAttrWithSetterException), (intptr_t)setJSTestTypedefsAttrWithSetterException },
54     { "stringAttrWithGetterException", DontDelete, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestTypedefsStringAttrWithGetterException), (intptr_t)setJSTestTypedefsStringAttrWithGetterException },
55     { "stringAttrWithSetterException", DontDelete, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestTypedefsStringAttrWithSetterException), (intptr_t)setJSTestTypedefsStringAttrWithSetterException },
56     { "constructor", DontEnum | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestTypedefsConstructor), (intptr_t)0 },
57     { 0, 0, NoIntrinsic, 0, 0 }
58 };
59
60 static const HashTable JSTestTypedefsTable = { 18, 15, JSTestTypedefsTableValues, 0 };
61 /* Hash table for constructor */
62
63 static const HashTableValue JSTestTypedefsConstructorTableValues[] =
64 {
65     { "TestSubObj", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestTypedefsConstructorTestSubObj), (intptr_t)0 },
66     { 0, 0, NoIntrinsic, 0, 0 }
67 };
68
69 static const HashTable JSTestTypedefsConstructorTable = { 1, 0, JSTestTypedefsConstructorTableValues, 0 };
70 EncodedJSValue JSC_HOST_CALL JSTestTypedefsConstructor::constructJSTestTypedefs(ExecState* exec)
71 {
72     JSTestTypedefsConstructor* castedThis = jsCast<JSTestTypedefsConstructor*>(exec->callee());
73     if (exec->argumentCount() < 2)
74         return throwVMError(exec, createNotEnoughArgumentsError(exec));
75     const String& hello(exec->argument(0).isEmpty() ? String() : exec->argument(0).toString(exec)->value(exec));
76     if (exec->hadException())
77         return JSValue::encode(jsUndefined());
78     if (!exec->argument(1).isFunction())
79         return throwVMTypeError(exec);
80     RefPtr<TestCallback> testCallback = JSTestCallback::create(asObject(exec->uncheckedArgument(1)), castedThis->globalObject());
81     RefPtr<TestTypedefs> object = TestTypedefs::create(hello, testCallback);
82     return JSValue::encode(asObject(toJS(exec, castedThis->globalObject(), object.get())));
83 }
84
85 const ClassInfo JSTestTypedefsConstructor::s_info = { "TestTypedefsConstructor", &Base::s_info, &JSTestTypedefsConstructorTable, 0, CREATE_METHOD_TABLE(JSTestTypedefsConstructor) };
86
87 JSTestTypedefsConstructor::JSTestTypedefsConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
88     : DOMConstructorObject(structure, globalObject)
89 {
90 }
91
92 void JSTestTypedefsConstructor::finishCreation(VM& vm, JSDOMGlobalObject* globalObject)
93 {
94     Base::finishCreation(vm);
95     ASSERT(inherits(info()));
96     putDirect(vm, vm.propertyNames->prototype, JSTestTypedefsPrototype::self(vm, globalObject), DontDelete | ReadOnly);
97     putDirect(vm, vm.propertyNames->length, jsNumber(2), ReadOnly | DontDelete | DontEnum);
98 }
99
100 bool JSTestTypedefsConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
101 {
102     return getStaticValueSlot<JSTestTypedefsConstructor, JSDOMWrapper>(exec, JSTestTypedefsConstructorTable, jsCast<JSTestTypedefsConstructor*>(object), propertyName, slot);
103 }
104
105 ConstructType JSTestTypedefsConstructor::getConstructData(JSCell*, ConstructData& constructData)
106 {
107     constructData.native.function = constructJSTestTypedefs;
108     return ConstructTypeHost;
109 }
110
111 /* Hash table for prototype */
112
113 static const HashTableValue JSTestTypedefsPrototypeTableValues[] =
114 {
115     { "func", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionFunc), (intptr_t)0 },
116     { "setShadow", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionSetShadow), (intptr_t)3 },
117     { "methodWithSequenceArg", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionMethodWithSequenceArg), (intptr_t)1 },
118     { "nullableArrayArg", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionNullableArrayArg), (intptr_t)1 },
119     { "funcWithClamp", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionFuncWithClamp), (intptr_t)1 },
120     { "immutablePointFunction", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionImmutablePointFunction), (intptr_t)0 },
121     { "stringArrayFunction", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionStringArrayFunction), (intptr_t)1 },
122     { "stringArrayFunction2", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionStringArrayFunction2), (intptr_t)1 },
123     { "callWithSequenceThatRequiresInclude", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionCallWithSequenceThatRequiresInclude), (intptr_t)1 },
124     { "methodWithException", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionMethodWithException), (intptr_t)0 },
125     { 0, 0, NoIntrinsic, 0, 0 }
126 };
127
128 static const HashTable JSTestTypedefsPrototypeTable = { 33, 31, JSTestTypedefsPrototypeTableValues, 0 };
129 const ClassInfo JSTestTypedefsPrototype::s_info = { "TestTypedefsPrototype", &Base::s_info, &JSTestTypedefsPrototypeTable, 0, CREATE_METHOD_TABLE(JSTestTypedefsPrototype) };
130
131 JSObject* JSTestTypedefsPrototype::self(VM& vm, JSGlobalObject* globalObject)
132 {
133     return getDOMPrototype<JSTestTypedefs>(vm, globalObject);
134 }
135
136 bool JSTestTypedefsPrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
137 {
138     JSTestTypedefsPrototype* thisObject = jsCast<JSTestTypedefsPrototype*>(object);
139     return getStaticFunctionSlot<JSObject>(exec, JSTestTypedefsPrototypeTable, thisObject, propertyName, slot);
140 }
141
142 const ClassInfo JSTestTypedefs::s_info = { "TestTypedefs", &Base::s_info, &JSTestTypedefsTable, 0 , CREATE_METHOD_TABLE(JSTestTypedefs) };
143
144 JSTestTypedefs::JSTestTypedefs(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestTypedefs> impl)
145     : JSDOMWrapper(structure, globalObject)
146     , m_impl(impl.leakRef())
147 {
148 }
149
150 void JSTestTypedefs::finishCreation(VM& vm)
151 {
152     Base::finishCreation(vm);
153     ASSERT(inherits(info()));
154 }
155
156 JSObject* JSTestTypedefs::createPrototype(VM& vm, JSGlobalObject* globalObject)
157 {
158     return JSTestTypedefsPrototype::create(vm, globalObject, JSTestTypedefsPrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
159 }
160
161 void JSTestTypedefs::destroy(JSC::JSCell* cell)
162 {
163     JSTestTypedefs* thisObject = static_cast<JSTestTypedefs*>(cell);
164     thisObject->JSTestTypedefs::~JSTestTypedefs();
165 }
166
167 JSTestTypedefs::~JSTestTypedefs()
168 {
169     releaseImplIfNotNull();
170 }
171
172 bool JSTestTypedefs::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
173 {
174     JSTestTypedefs* thisObject = jsCast<JSTestTypedefs*>(object);
175     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
176     return getStaticValueSlot<JSTestTypedefs, Base>(exec, JSTestTypedefsTable, thisObject, propertyName, slot);
177 }
178
179 EncodedJSValue jsTestTypedefsUnsignedLongLongAttr(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
180 {
181     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
182     UNUSED_PARAM(slotBase);
183     if (!castedThis)
184         return throwVMTypeError(exec);
185     UNUSED_PARAM(exec);
186     TestTypedefs& impl = castedThis->impl();
187     JSValue result = jsNumber(impl.unsignedLongLongAttr());
188     return JSValue::encode(result);
189 }
190
191
192 EncodedJSValue jsTestTypedefsImmutableSerializedScriptValue(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
193 {
194     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
195     UNUSED_PARAM(slotBase);
196     if (!castedThis)
197         return throwVMTypeError(exec);
198     UNUSED_PARAM(exec);
199     TestTypedefs& impl = castedThis->impl();
200     JSValue result = impl.immutableSerializedScriptValue() ? impl.immutableSerializedScriptValue()->deserialize(exec, castedThis->globalObject(), 0) : jsNull();
201     return JSValue::encode(result);
202 }
203
204
205 EncodedJSValue jsTestTypedefsConstructorTestSubObj(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
206 {
207     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
208     UNUSED_PARAM(slotBase);
209     if (!castedThis)
210         return throwVMTypeError(exec);
211     return JSValue::encode(JSTestSubObj::getConstructor(exec->vm(), castedThis->globalObject()));
212 }
213
214
215 EncodedJSValue jsTestTypedefsAttrWithGetterException(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
216 {
217     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
218     UNUSED_PARAM(slotBase);
219     if (!castedThis)
220         return throwVMTypeError(exec);
221     ExceptionCode ec = 0;
222     TestTypedefs& impl = castedThis->impl();
223     JSC::JSValue result = jsNumber(impl.attrWithGetterException(ec));
224     setDOMException(exec, ec);
225     return JSValue::encode(result);
226 }
227
228
229 EncodedJSValue jsTestTypedefsAttrWithSetterException(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
230 {
231     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
232     UNUSED_PARAM(slotBase);
233     if (!castedThis)
234         return throwVMTypeError(exec);
235     UNUSED_PARAM(exec);
236     TestTypedefs& impl = castedThis->impl();
237     JSValue result = jsNumber(impl.attrWithSetterException());
238     return JSValue::encode(result);
239 }
240
241
242 EncodedJSValue jsTestTypedefsStringAttrWithGetterException(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
243 {
244     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
245     UNUSED_PARAM(slotBase);
246     if (!castedThis)
247         return throwVMTypeError(exec);
248     ExceptionCode ec = 0;
249     TestTypedefs& impl = castedThis->impl();
250     JSC::JSValue result = jsStringWithCache(exec, impl.stringAttrWithGetterException(ec));
251     setDOMException(exec, ec);
252     return JSValue::encode(result);
253 }
254
255
256 EncodedJSValue jsTestTypedefsStringAttrWithSetterException(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
257 {
258     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
259     UNUSED_PARAM(slotBase);
260     if (!castedThis)
261         return throwVMTypeError(exec);
262     UNUSED_PARAM(exec);
263     TestTypedefs& impl = castedThis->impl();
264     JSValue result = jsStringWithCache(exec, impl.stringAttrWithSetterException());
265     return JSValue::encode(result);
266 }
267
268
269 EncodedJSValue jsTestTypedefsConstructor(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue, PropertyName)
270 {
271     JSTestTypedefs* domObject = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(slotBase));
272     if (!domObject)
273         return throwVMTypeError(exec);
274     return JSValue::encode(JSTestTypedefs::getConstructor(exec->vm(), domObject->globalObject()));
275 }
276
277 void JSTestTypedefs::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
278 {
279     JSTestTypedefs* thisObject = jsCast<JSTestTypedefs*>(cell);
280     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
281     lookupPut<JSTestTypedefs, Base>(exec, propertyName, value, JSTestTypedefsTable, thisObject, slot);
282 }
283
284 void setJSTestTypedefsUnsignedLongLongAttr(ExecState* exec, EncodedJSValue thisValue, EncodedJSValue encodedValue)
285 {
286     JSValue value = JSValue::decode(encodedValue);
287     UNUSED_PARAM(exec);
288     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
289     if (!castedThis) {
290         throwVMTypeError(exec);
291         return;
292     }
293     TestTypedefs& impl = castedThis->impl();
294     unsigned long long nativeValue(toUInt64(exec, value, NormalConversion));
295     if (exec->hadException())
296         return;
297     impl.setUnsignedLongLongAttr(nativeValue);
298 }
299
300
301 void setJSTestTypedefsImmutableSerializedScriptValue(ExecState* exec, EncodedJSValue thisValue, EncodedJSValue encodedValue)
302 {
303     JSValue value = JSValue::decode(encodedValue);
304     UNUSED_PARAM(exec);
305     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
306     if (!castedThis) {
307         throwVMTypeError(exec);
308         return;
309     }
310     TestTypedefs& impl = castedThis->impl();
311     RefPtr<SerializedScriptValue> nativeValue(SerializedScriptValue::create(exec, value, 0, 0));
312     if (exec->hadException())
313         return;
314     impl.setImmutableSerializedScriptValue(nativeValue);
315 }
316
317
318 void setJSTestTypedefsAttrWithGetterException(ExecState* exec, EncodedJSValue thisValue, EncodedJSValue encodedValue)
319 {
320     JSValue value = JSValue::decode(encodedValue);
321     UNUSED_PARAM(exec);
322     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
323     if (!castedThis) {
324         throwVMTypeError(exec);
325         return;
326     }
327     TestTypedefs& impl = castedThis->impl();
328     int nativeValue(toInt32(exec, value, NormalConversion));
329     if (exec->hadException())
330         return;
331     impl.setAttrWithGetterException(nativeValue);
332 }
333
334
335 void setJSTestTypedefsAttrWithSetterException(ExecState* exec, EncodedJSValue thisValue, EncodedJSValue encodedValue)
336 {
337     JSValue value = JSValue::decode(encodedValue);
338     UNUSED_PARAM(exec);
339     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
340     if (!castedThis) {
341         throwVMTypeError(exec);
342         return;
343     }
344     TestTypedefs& impl = castedThis->impl();
345     ExceptionCode ec = 0;
346     int nativeValue(toInt32(exec, value, NormalConversion));
347     if (exec->hadException())
348         return;
349     impl.setAttrWithSetterException(nativeValue, ec);
350     setDOMException(exec, ec);
351 }
352
353
354 void setJSTestTypedefsStringAttrWithGetterException(ExecState* exec, EncodedJSValue thisValue, EncodedJSValue encodedValue)
355 {
356     JSValue value = JSValue::decode(encodedValue);
357     UNUSED_PARAM(exec);
358     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
359     if (!castedThis) {
360         throwVMTypeError(exec);
361         return;
362     }
363     TestTypedefs& impl = castedThis->impl();
364     const String& nativeValue(value.isEmpty() ? String() : value.toString(exec)->value(exec));
365     if (exec->hadException())
366         return;
367     impl.setStringAttrWithGetterException(nativeValue);
368 }
369
370
371 void setJSTestTypedefsStringAttrWithSetterException(ExecState* exec, EncodedJSValue thisValue, EncodedJSValue encodedValue)
372 {
373     JSValue value = JSValue::decode(encodedValue);
374     UNUSED_PARAM(exec);
375     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
376     if (!castedThis) {
377         throwVMTypeError(exec);
378         return;
379     }
380     TestTypedefs& impl = castedThis->impl();
381     ExceptionCode ec = 0;
382     const String& nativeValue(value.isEmpty() ? String() : value.toString(exec)->value(exec));
383     if (exec->hadException())
384         return;
385     impl.setStringAttrWithSetterException(nativeValue, ec);
386     setDOMException(exec, ec);
387 }
388
389
390 JSValue JSTestTypedefs::getConstructor(VM& vm, JSGlobalObject* globalObject)
391 {
392     return getDOMConstructor<JSTestTypedefsConstructor>(vm, jsCast<JSDOMGlobalObject*>(globalObject));
393 }
394
395 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionFunc(ExecState* exec)
396 {
397     JSValue thisValue = exec->hostThisValue();
398     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
399     if (!castedThis)
400         return throwVMTypeError(exec);
401     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
402     TestTypedefs& impl = castedThis->impl();
403
404     size_t argsCount = exec->argumentCount();
405     if (argsCount <= 0) {
406         impl.func();
407         return JSValue::encode(jsUndefined());
408     }
409
410     Vector<int> x(toNativeArray<int>(exec, exec->argument(0)));
411     if (exec->hadException())
412         return JSValue::encode(jsUndefined());
413     impl.func(x);
414     return JSValue::encode(jsUndefined());
415 }
416
417 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionSetShadow(ExecState* exec)
418 {
419     JSValue thisValue = exec->hostThisValue();
420     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
421     if (!castedThis)
422         return throwVMTypeError(exec);
423     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
424     TestTypedefs& impl = castedThis->impl();
425     if (exec->argumentCount() < 3)
426         return throwVMError(exec, createNotEnoughArgumentsError(exec));
427     float width(exec->argument(0).toFloat(exec));
428     if (exec->hadException())
429         return JSValue::encode(jsUndefined());
430     float height(exec->argument(1).toFloat(exec));
431     if (exec->hadException())
432         return JSValue::encode(jsUndefined());
433     float blur(exec->argument(2).toFloat(exec));
434     if (exec->hadException())
435         return JSValue::encode(jsUndefined());
436
437     size_t argsCount = exec->argumentCount();
438     if (argsCount <= 3) {
439         impl.setShadow(width, height, blur);
440         return JSValue::encode(jsUndefined());
441     }
442
443     const String& color(exec->argument(3).isEmpty() ? String() : exec->argument(3).toString(exec)->value(exec));
444     if (exec->hadException())
445         return JSValue::encode(jsUndefined());
446     if (argsCount <= 4) {
447         impl.setShadow(width, height, blur, color);
448         return JSValue::encode(jsUndefined());
449     }
450
451     float alpha(exec->argument(4).toFloat(exec));
452     if (exec->hadException())
453         return JSValue::encode(jsUndefined());
454     impl.setShadow(width, height, blur, color, alpha);
455     return JSValue::encode(jsUndefined());
456 }
457
458 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionMethodWithSequenceArg(ExecState* exec)
459 {
460     JSValue thisValue = exec->hostThisValue();
461     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
462     if (!castedThis)
463         return throwVMTypeError(exec);
464     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
465     TestTypedefs& impl = castedThis->impl();
466     if (exec->argumentCount() < 1)
467         return throwVMError(exec, createNotEnoughArgumentsError(exec));
468     Vector<RefPtr<SerializedScriptValue>> sequenceArg((toRefPtrNativeArray<SerializedScriptValue, JSSerializedScriptValue>(exec, exec->argument(0), &toSerializedScriptValue)));
469     if (exec->hadException())
470         return JSValue::encode(jsUndefined());
471
472     JSC::JSValue result = jsNumber(impl.methodWithSequenceArg(sequenceArg));
473     return JSValue::encode(result);
474 }
475
476 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionNullableArrayArg(ExecState* exec)
477 {
478     JSValue thisValue = exec->hostThisValue();
479     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
480     if (!castedThis)
481         return throwVMTypeError(exec);
482     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
483     TestTypedefs& impl = castedThis->impl();
484     if (exec->argumentCount() < 1)
485         return throwVMError(exec, createNotEnoughArgumentsError(exec));
486     Vector<String> arrayArg(toNativeArray<String>(exec, exec->argument(0)));
487     if (exec->hadException())
488         return JSValue::encode(jsUndefined());
489     impl.nullableArrayArg(arrayArg);
490     return JSValue::encode(jsUndefined());
491 }
492
493 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionFuncWithClamp(ExecState* exec)
494 {
495     JSValue thisValue = exec->hostThisValue();
496     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
497     if (!castedThis)
498         return throwVMTypeError(exec);
499     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
500     TestTypedefs& impl = castedThis->impl();
501     if (exec->argumentCount() < 1)
502         return throwVMError(exec, createNotEnoughArgumentsError(exec));
503     unsigned long long arg1 = 0;
504     double arg1NativeValue = exec->argument(0).toNumber(exec);
505     if (exec->hadException())
506         return JSValue::encode(jsUndefined());
507
508     if (!std::isnan(arg1NativeValue))
509         arg1 = clampTo<unsigned long long>(arg1NativeValue);
510
511
512     size_t argsCount = exec->argumentCount();
513     if (argsCount <= 1) {
514         impl.funcWithClamp(arg1);
515         return JSValue::encode(jsUndefined());
516     }
517
518     unsigned long long arg2 = 0;
519     double arg2NativeValue = exec->argument(1).toNumber(exec);
520     if (exec->hadException())
521         return JSValue::encode(jsUndefined());
522
523     if (!std::isnan(arg2NativeValue))
524         arg2 = clampTo<unsigned long long>(arg2NativeValue);
525
526     impl.funcWithClamp(arg1, arg2);
527     return JSValue::encode(jsUndefined());
528 }
529
530 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionImmutablePointFunction(ExecState* exec)
531 {
532     JSValue thisValue = exec->hostThisValue();
533     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
534     if (!castedThis)
535         return throwVMTypeError(exec);
536     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
537     TestTypedefs& impl = castedThis->impl();
538
539     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<SVGPoint>::create(impl.immutablePointFunction())));
540     return JSValue::encode(result);
541 }
542
543 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionStringArrayFunction(ExecState* exec)
544 {
545     JSValue thisValue = exec->hostThisValue();
546     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
547     if (!castedThis)
548         return throwVMTypeError(exec);
549     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
550     TestTypedefs& impl = castedThis->impl();
551     if (exec->argumentCount() < 1)
552         return throwVMError(exec, createNotEnoughArgumentsError(exec));
553     ExceptionCode ec = 0;
554     Vector<String> values(toNativeArray<String>(exec, exec->argument(0)));
555     if (exec->hadException())
556         return JSValue::encode(jsUndefined());
557
558     JSC::JSValue result = jsArray(exec, castedThis->globalObject(), impl.stringArrayFunction(values, ec));
559     setDOMException(exec, ec);
560     return JSValue::encode(result);
561 }
562
563 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionStringArrayFunction2(ExecState* exec)
564 {
565     JSValue thisValue = exec->hostThisValue();
566     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
567     if (!castedThis)
568         return throwVMTypeError(exec);
569     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
570     TestTypedefs& impl = castedThis->impl();
571     if (exec->argumentCount() < 1)
572         return throwVMError(exec, createNotEnoughArgumentsError(exec));
573     ExceptionCode ec = 0;
574     Vector<String> values(toNativeArray<String>(exec, exec->argument(0)));
575     if (exec->hadException())
576         return JSValue::encode(jsUndefined());
577
578     JSC::JSValue result = jsArray(exec, castedThis->globalObject(), impl.stringArrayFunction2(values, ec));
579     setDOMException(exec, ec);
580     return JSValue::encode(result);
581 }
582
583 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionCallWithSequenceThatRequiresInclude(ExecState* exec)
584 {
585     JSValue thisValue = exec->hostThisValue();
586     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
587     if (!castedThis)
588         return throwVMTypeError(exec);
589     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
590     TestTypedefs& impl = castedThis->impl();
591     if (exec->argumentCount() < 1)
592         return throwVMError(exec, createNotEnoughArgumentsError(exec));
593     Vector<RefPtr<TestEventTarget> > sequenceArg((toRefPtrNativeArray<TestEventTarget, JSTestEventTarget>(exec, exec->argument(0), &toTestEventTarget)));
594     if (exec->hadException())
595         return JSValue::encode(jsUndefined());
596
597     JSC::JSValue result = jsBoolean(impl.callWithSequenceThatRequiresInclude(sequenceArg));
598     return JSValue::encode(result);
599 }
600
601 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionMethodWithException(ExecState* exec)
602 {
603     JSValue thisValue = exec->hostThisValue();
604     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
605     if (!castedThis)
606         return throwVMTypeError(exec);
607     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
608     TestTypedefs& impl = castedThis->impl();
609     ExceptionCode ec = 0;
610     impl.methodWithException(ec);
611     setDOMException(exec, ec);
612     return JSValue::encode(jsUndefined());
613 }
614
615 bool JSTestTypedefsOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
616 {
617     UNUSED_PARAM(handle);
618     UNUSED_PARAM(visitor);
619     return false;
620 }
621
622 void JSTestTypedefsOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
623 {
624     JSTestTypedefs* jsTestTypedefs = jsCast<JSTestTypedefs*>(handle.get().asCell());
625     DOMWrapperWorld& world = *static_cast<DOMWrapperWorld*>(context);
626     uncacheWrapper(world, &jsTestTypedefs->impl(), jsTestTypedefs);
627     jsTestTypedefs->releaseImpl();
628 }
629
630 #if ENABLE(BINDING_INTEGRITY)
631 #if PLATFORM(WIN)
632 #pragma warning(disable: 4483)
633 extern "C" { extern void (*const __identifier("??_7TestTypedefs@WebCore@@6B@")[])(); }
634 #else
635 extern "C" { extern void* _ZTVN7WebCore12TestTypedefsE[]; }
636 #endif
637 #endif
638 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestTypedefs* impl)
639 {
640     if (!impl)
641         return jsNull();
642     if (JSValue result = getExistingWrapper<JSTestTypedefs>(exec, impl))
643         return result;
644
645 #if ENABLE(BINDING_INTEGRITY)
646     void* actualVTablePointer = *(reinterpret_cast<void**>(impl));
647 #if PLATFORM(WIN)
648     void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestTypedefs@WebCore@@6B@"));
649 #else
650     void* expectedVTablePointer = &_ZTVN7WebCore12TestTypedefsE[2];
651 #if COMPILER(CLANG)
652     // If this fails TestTypedefs does not have a vtable, so you need to add the
653     // ImplementationLacksVTable attribute to the interface definition
654     COMPILE_ASSERT(__is_polymorphic(TestTypedefs), TestTypedefs_is_not_polymorphic);
655 #endif
656 #endif
657     // If you hit this assertion you either have a use after free bug, or
658     // TestTypedefs has subclasses. If TestTypedefs has subclasses that get passed
659     // to toJS() we currently require TestTypedefs you to opt out of binding hardening
660     // by adding the SkipVTableValidation attribute to the interface IDL definition
661     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
662 #endif
663     ReportMemoryCost<TestTypedefs>::reportMemoryCost(exec, impl);
664     return createNewWrapper<JSTestTypedefs>(exec, globalObject, impl);
665 }
666
667 TestTypedefs* toTestTypedefs(JSC::JSValue value)
668 {
669     return value.inherits(JSTestTypedefs::info()) ? &jsCast<JSTestTypedefs*>(value)->impl() : 0;
670 }
671
672 }