e94421ca5f7c7ae0dde4c5f868e9f540557a506d
[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 | CustomAccessor, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestTypedefsUnsignedLongLongAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestTypedefsUnsignedLongLongAttr) },
51     { "immutableSerializedScriptValue", DontDelete | CustomAccessor, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestTypedefsImmutableSerializedScriptValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestTypedefsImmutableSerializedScriptValue) },
52     { "attrWithGetterException", DontDelete | CustomAccessor, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestTypedefsAttrWithGetterException), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestTypedefsAttrWithGetterException) },
53     { "attrWithSetterException", DontDelete | CustomAccessor, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestTypedefsAttrWithSetterException), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestTypedefsAttrWithSetterException) },
54     { "stringAttrWithGetterException", DontDelete | CustomAccessor, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestTypedefsStringAttrWithGetterException), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestTypedefsStringAttrWithGetterException) },
55     { "stringAttrWithSetterException", DontDelete | CustomAccessor, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestTypedefsStringAttrWithSetterException), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestTypedefsStringAttrWithSetterException) },
56     { "constructor", DontEnum | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestTypedefsConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
57     { 0, 0, NoIntrinsic, 0, 0 }
58 };
59
60 static const HashTable JSTestTypedefsTable = { 18, 15, true, 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) static_cast<PutPropertySlot::PutValueFunc>(0) },
66     { 0, 0, NoIntrinsic, 0, 0 }
67 };
68
69 static const HashTable JSTestTypedefsConstructorTable = { 1, 0, true, 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, false, 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, EncodedJSValue thisValue, PropertyName)
270 {
271     JSTestTypedefs* domObject = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
272     if (!domObject)
273         return throwVMTypeError(exec);
274     return JSValue::encode(JSTestTypedefs::getConstructor(exec->vm(), domObject->globalObject()));
275 }
276
277 void setJSTestTypedefsUnsignedLongLongAttr(ExecState* exec, JSObject* /* baseObject */, EncodedJSValue thisValue, EncodedJSValue encodedValue)
278 {
279     JSValue value = JSValue::decode(encodedValue);
280     UNUSED_PARAM(exec);
281     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
282     if (!castedThis) {
283         throwVMTypeError(exec);
284         return;
285     }
286     TestTypedefs& impl = castedThis->impl();
287     unsigned long long nativeValue(toUInt64(exec, value, NormalConversion));
288     if (exec->hadException())
289         return;
290     impl.setUnsignedLongLongAttr(nativeValue);
291 }
292
293
294 void setJSTestTypedefsImmutableSerializedScriptValue(ExecState* exec, JSObject* /* baseObject */, EncodedJSValue thisValue, EncodedJSValue encodedValue)
295 {
296     JSValue value = JSValue::decode(encodedValue);
297     UNUSED_PARAM(exec);
298     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
299     if (!castedThis) {
300         throwVMTypeError(exec);
301         return;
302     }
303     TestTypedefs& impl = castedThis->impl();
304     RefPtr<SerializedScriptValue> nativeValue(SerializedScriptValue::create(exec, value, 0, 0));
305     if (exec->hadException())
306         return;
307     impl.setImmutableSerializedScriptValue(nativeValue);
308 }
309
310
311 void setJSTestTypedefsAttrWithGetterException(ExecState* exec, JSObject* /* baseObject */, EncodedJSValue thisValue, EncodedJSValue encodedValue)
312 {
313     JSValue value = JSValue::decode(encodedValue);
314     UNUSED_PARAM(exec);
315     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
316     if (!castedThis) {
317         throwVMTypeError(exec);
318         return;
319     }
320     TestTypedefs& impl = castedThis->impl();
321     int nativeValue(toInt32(exec, value, NormalConversion));
322     if (exec->hadException())
323         return;
324     impl.setAttrWithGetterException(nativeValue);
325 }
326
327
328 void setJSTestTypedefsAttrWithSetterException(ExecState* exec, JSObject* /* baseObject */, EncodedJSValue thisValue, EncodedJSValue encodedValue)
329 {
330     JSValue value = JSValue::decode(encodedValue);
331     UNUSED_PARAM(exec);
332     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
333     if (!castedThis) {
334         throwVMTypeError(exec);
335         return;
336     }
337     TestTypedefs& impl = castedThis->impl();
338     ExceptionCode ec = 0;
339     int nativeValue(toInt32(exec, value, NormalConversion));
340     if (exec->hadException())
341         return;
342     impl.setAttrWithSetterException(nativeValue, ec);
343     setDOMException(exec, ec);
344 }
345
346
347 void setJSTestTypedefsStringAttrWithGetterException(ExecState* exec, JSObject* /* baseObject */, EncodedJSValue thisValue, EncodedJSValue encodedValue)
348 {
349     JSValue value = JSValue::decode(encodedValue);
350     UNUSED_PARAM(exec);
351     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
352     if (!castedThis) {
353         throwVMTypeError(exec);
354         return;
355     }
356     TestTypedefs& impl = castedThis->impl();
357     const String& nativeValue(value.isEmpty() ? String() : value.toString(exec)->value(exec));
358     if (exec->hadException())
359         return;
360     impl.setStringAttrWithGetterException(nativeValue);
361 }
362
363
364 void setJSTestTypedefsStringAttrWithSetterException(ExecState* exec, JSObject* /* baseObject */, EncodedJSValue thisValue, EncodedJSValue encodedValue)
365 {
366     JSValue value = JSValue::decode(encodedValue);
367     UNUSED_PARAM(exec);
368     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
369     if (!castedThis) {
370         throwVMTypeError(exec);
371         return;
372     }
373     TestTypedefs& impl = castedThis->impl();
374     ExceptionCode ec = 0;
375     const String& nativeValue(value.isEmpty() ? String() : value.toString(exec)->value(exec));
376     if (exec->hadException())
377         return;
378     impl.setStringAttrWithSetterException(nativeValue, ec);
379     setDOMException(exec, ec);
380 }
381
382
383 JSValue JSTestTypedefs::getConstructor(VM& vm, JSGlobalObject* globalObject)
384 {
385     return getDOMConstructor<JSTestTypedefsConstructor>(vm, jsCast<JSDOMGlobalObject*>(globalObject));
386 }
387
388 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionFunc(ExecState* exec)
389 {
390     JSValue thisValue = exec->hostThisValue();
391     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
392     if (!castedThis)
393         return throwVMTypeError(exec);
394     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
395     TestTypedefs& impl = castedThis->impl();
396
397     size_t argsCount = exec->argumentCount();
398     if (argsCount <= 0) {
399         impl.func();
400         return JSValue::encode(jsUndefined());
401     }
402
403     Vector<int> x(toNativeArray<int>(exec, exec->argument(0)));
404     if (exec->hadException())
405         return JSValue::encode(jsUndefined());
406     impl.func(x);
407     return JSValue::encode(jsUndefined());
408 }
409
410 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionSetShadow(ExecState* exec)
411 {
412     JSValue thisValue = exec->hostThisValue();
413     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
414     if (!castedThis)
415         return throwVMTypeError(exec);
416     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
417     TestTypedefs& impl = castedThis->impl();
418     if (exec->argumentCount() < 3)
419         return throwVMError(exec, createNotEnoughArgumentsError(exec));
420     float width(exec->argument(0).toFloat(exec));
421     if (exec->hadException())
422         return JSValue::encode(jsUndefined());
423     float height(exec->argument(1).toFloat(exec));
424     if (exec->hadException())
425         return JSValue::encode(jsUndefined());
426     float blur(exec->argument(2).toFloat(exec));
427     if (exec->hadException())
428         return JSValue::encode(jsUndefined());
429
430     size_t argsCount = exec->argumentCount();
431     if (argsCount <= 3) {
432         impl.setShadow(width, height, blur);
433         return JSValue::encode(jsUndefined());
434     }
435
436     const String& color(exec->argument(3).isEmpty() ? String() : exec->argument(3).toString(exec)->value(exec));
437     if (exec->hadException())
438         return JSValue::encode(jsUndefined());
439     if (argsCount <= 4) {
440         impl.setShadow(width, height, blur, color);
441         return JSValue::encode(jsUndefined());
442     }
443
444     float alpha(exec->argument(4).toFloat(exec));
445     if (exec->hadException())
446         return JSValue::encode(jsUndefined());
447     impl.setShadow(width, height, blur, color, alpha);
448     return JSValue::encode(jsUndefined());
449 }
450
451 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionMethodWithSequenceArg(ExecState* exec)
452 {
453     JSValue thisValue = exec->hostThisValue();
454     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
455     if (!castedThis)
456         return throwVMTypeError(exec);
457     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
458     TestTypedefs& impl = castedThis->impl();
459     if (exec->argumentCount() < 1)
460         return throwVMError(exec, createNotEnoughArgumentsError(exec));
461     Vector<RefPtr<SerializedScriptValue>> sequenceArg((toRefPtrNativeArray<SerializedScriptValue, JSSerializedScriptValue>(exec, exec->argument(0), &toSerializedScriptValue)));
462     if (exec->hadException())
463         return JSValue::encode(jsUndefined());
464
465     JSC::JSValue result = jsNumber(impl.methodWithSequenceArg(sequenceArg));
466     return JSValue::encode(result);
467 }
468
469 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionNullableArrayArg(ExecState* exec)
470 {
471     JSValue thisValue = exec->hostThisValue();
472     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
473     if (!castedThis)
474         return throwVMTypeError(exec);
475     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
476     TestTypedefs& impl = castedThis->impl();
477     if (exec->argumentCount() < 1)
478         return throwVMError(exec, createNotEnoughArgumentsError(exec));
479     Vector<String> arrayArg(toNativeArray<String>(exec, exec->argument(0)));
480     if (exec->hadException())
481         return JSValue::encode(jsUndefined());
482     impl.nullableArrayArg(arrayArg);
483     return JSValue::encode(jsUndefined());
484 }
485
486 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionFuncWithClamp(ExecState* exec)
487 {
488     JSValue thisValue = exec->hostThisValue();
489     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
490     if (!castedThis)
491         return throwVMTypeError(exec);
492     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
493     TestTypedefs& impl = castedThis->impl();
494     if (exec->argumentCount() < 1)
495         return throwVMError(exec, createNotEnoughArgumentsError(exec));
496     unsigned long long arg1 = 0;
497     double arg1NativeValue = exec->argument(0).toNumber(exec);
498     if (exec->hadException())
499         return JSValue::encode(jsUndefined());
500
501     if (!std::isnan(arg1NativeValue))
502         arg1 = clampTo<unsigned long long>(arg1NativeValue);
503
504
505     size_t argsCount = exec->argumentCount();
506     if (argsCount <= 1) {
507         impl.funcWithClamp(arg1);
508         return JSValue::encode(jsUndefined());
509     }
510
511     unsigned long long arg2 = 0;
512     double arg2NativeValue = exec->argument(1).toNumber(exec);
513     if (exec->hadException())
514         return JSValue::encode(jsUndefined());
515
516     if (!std::isnan(arg2NativeValue))
517         arg2 = clampTo<unsigned long long>(arg2NativeValue);
518
519     impl.funcWithClamp(arg1, arg2);
520     return JSValue::encode(jsUndefined());
521 }
522
523 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionImmutablePointFunction(ExecState* exec)
524 {
525     JSValue thisValue = exec->hostThisValue();
526     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
527     if (!castedThis)
528         return throwVMTypeError(exec);
529     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
530     TestTypedefs& impl = castedThis->impl();
531
532     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<SVGPoint>::create(impl.immutablePointFunction())));
533     return JSValue::encode(result);
534 }
535
536 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionStringArrayFunction(ExecState* exec)
537 {
538     JSValue thisValue = exec->hostThisValue();
539     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
540     if (!castedThis)
541         return throwVMTypeError(exec);
542     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
543     TestTypedefs& impl = castedThis->impl();
544     if (exec->argumentCount() < 1)
545         return throwVMError(exec, createNotEnoughArgumentsError(exec));
546     ExceptionCode ec = 0;
547     Vector<String> values(toNativeArray<String>(exec, exec->argument(0)));
548     if (exec->hadException())
549         return JSValue::encode(jsUndefined());
550
551     JSC::JSValue result = jsArray(exec, castedThis->globalObject(), impl.stringArrayFunction(values, ec));
552     setDOMException(exec, ec);
553     return JSValue::encode(result);
554 }
555
556 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionStringArrayFunction2(ExecState* exec)
557 {
558     JSValue thisValue = exec->hostThisValue();
559     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
560     if (!castedThis)
561         return throwVMTypeError(exec);
562     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
563     TestTypedefs& impl = castedThis->impl();
564     if (exec->argumentCount() < 1)
565         return throwVMError(exec, createNotEnoughArgumentsError(exec));
566     ExceptionCode ec = 0;
567     Vector<String> values(toNativeArray<String>(exec, exec->argument(0)));
568     if (exec->hadException())
569         return JSValue::encode(jsUndefined());
570
571     JSC::JSValue result = jsArray(exec, castedThis->globalObject(), impl.stringArrayFunction2(values, ec));
572     setDOMException(exec, ec);
573     return JSValue::encode(result);
574 }
575
576 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionCallWithSequenceThatRequiresInclude(ExecState* exec)
577 {
578     JSValue thisValue = exec->hostThisValue();
579     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
580     if (!castedThis)
581         return throwVMTypeError(exec);
582     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
583     TestTypedefs& impl = castedThis->impl();
584     if (exec->argumentCount() < 1)
585         return throwVMError(exec, createNotEnoughArgumentsError(exec));
586     Vector<RefPtr<TestEventTarget> > sequenceArg((toRefPtrNativeArray<TestEventTarget, JSTestEventTarget>(exec, exec->argument(0), &toTestEventTarget)));
587     if (exec->hadException())
588         return JSValue::encode(jsUndefined());
589
590     JSC::JSValue result = jsBoolean(impl.callWithSequenceThatRequiresInclude(sequenceArg));
591     return JSValue::encode(result);
592 }
593
594 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionMethodWithException(ExecState* exec)
595 {
596     JSValue thisValue = exec->hostThisValue();
597     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
598     if (!castedThis)
599         return throwVMTypeError(exec);
600     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
601     TestTypedefs& impl = castedThis->impl();
602     ExceptionCode ec = 0;
603     impl.methodWithException(ec);
604     setDOMException(exec, ec);
605     return JSValue::encode(jsUndefined());
606 }
607
608 bool JSTestTypedefsOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
609 {
610     UNUSED_PARAM(handle);
611     UNUSED_PARAM(visitor);
612     return false;
613 }
614
615 void JSTestTypedefsOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
616 {
617     JSTestTypedefs* jsTestTypedefs = jsCast<JSTestTypedefs*>(handle.get().asCell());
618     DOMWrapperWorld& world = *static_cast<DOMWrapperWorld*>(context);
619     uncacheWrapper(world, &jsTestTypedefs->impl(), jsTestTypedefs);
620     jsTestTypedefs->releaseImpl();
621 }
622
623 #if ENABLE(BINDING_INTEGRITY)
624 #if PLATFORM(WIN)
625 #pragma warning(disable: 4483)
626 extern "C" { extern void (*const __identifier("??_7TestTypedefs@WebCore@@6B@")[])(); }
627 #else
628 extern "C" { extern void* _ZTVN7WebCore12TestTypedefsE[]; }
629 #endif
630 #endif
631 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestTypedefs* impl)
632 {
633     if (!impl)
634         return jsNull();
635     if (JSValue result = getExistingWrapper<JSTestTypedefs>(exec, impl))
636         return result;
637
638 #if ENABLE(BINDING_INTEGRITY)
639     void* actualVTablePointer = *(reinterpret_cast<void**>(impl));
640 #if PLATFORM(WIN)
641     void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestTypedefs@WebCore@@6B@"));
642 #else
643     void* expectedVTablePointer = &_ZTVN7WebCore12TestTypedefsE[2];
644 #if COMPILER(CLANG)
645     // If this fails TestTypedefs does not have a vtable, so you need to add the
646     // ImplementationLacksVTable attribute to the interface definition
647     COMPILE_ASSERT(__is_polymorphic(TestTypedefs), TestTypedefs_is_not_polymorphic);
648 #endif
649 #endif
650     // If you hit this assertion you either have a use after free bug, or
651     // TestTypedefs has subclasses. If TestTypedefs has subclasses that get passed
652     // to toJS() we currently require TestTypedefs you to opt out of binding hardening
653     // by adding the SkipVTableValidation attribute to the interface IDL definition
654     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
655 #endif
656     ReportMemoryCost<TestTypedefs>::reportMemoryCost(exec, impl);
657     return createNewWrapper<JSTestTypedefs>(exec, globalObject, impl);
658 }
659
660 TestTypedefs* toTestTypedefs(JSC::JSValue value)
661 {
662     return value.inherits(JSTestTypedefs::info()) ? &jsCast<JSTestTypedefs*>(value)->impl() : 0;
663 }
664
665 }