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