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