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