Rebaseline bindings tests after Swedish breakage.
[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 "JSTestSubObj.h"
32 #include "KURL.h"
33 #include "SVGPoint.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(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(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
100 {
101     return getStaticValueSlot<JSTestTypedefsConstructor, JSDOMWrapper>(exec, JSTestTypedefsConstructorTable, jsCast<JSTestTypedefsConstructor*>(object), propertyName, slot);
102 }
103
104 ConstructType JSTestTypedefsConstructor::getConstructData(JSCell*, ConstructData& constructData)
105 {
106     constructData.native.function = constructJSTestTypedefs;
107     return ConstructTypeHost;
108 }
109
110 /* Hash table for prototype */
111
112 static const HashTableValue JSTestTypedefsPrototypeTableValues[] =
113 {
114     { "func", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionFunc), (intptr_t)0, NoIntrinsic },
115     { "setShadow", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionSetShadow), (intptr_t)3, NoIntrinsic },
116     { "methodWithSequenceArg", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionMethodWithSequenceArg), (intptr_t)1, NoIntrinsic },
117     { "nullableArrayArg", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionNullableArrayArg), (intptr_t)1, NoIntrinsic },
118     { "funcWithClamp", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionFuncWithClamp), (intptr_t)1, NoIntrinsic },
119     { "immutablePointFunction", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionImmutablePointFunction), (intptr_t)0, NoIntrinsic },
120     { "stringArrayFunction", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionStringArrayFunction), (intptr_t)1, NoIntrinsic },
121     { "stringArrayFunction2", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionStringArrayFunction2), (intptr_t)1, NoIntrinsic },
122     { "methodWithException", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionMethodWithException), (intptr_t)0, NoIntrinsic },
123     { 0, 0, 0, 0, NoIntrinsic }
124 };
125
126 static const HashTable JSTestTypedefsPrototypeTable = { 33, 31, JSTestTypedefsPrototypeTableValues, 0 };
127 const ClassInfo JSTestTypedefsPrototype::s_info = { "TestTypedefsPrototype", &Base::s_info, &JSTestTypedefsPrototypeTable, 0, CREATE_METHOD_TABLE(JSTestTypedefsPrototype) };
128
129 JSObject* JSTestTypedefsPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
130 {
131     return getDOMPrototype<JSTestTypedefs>(exec, globalObject);
132 }
133
134 bool JSTestTypedefsPrototype::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
135 {
136     JSTestTypedefsPrototype* thisObject = jsCast<JSTestTypedefsPrototype*>(object);
137     return getStaticFunctionSlot<JSObject>(exec, JSTestTypedefsPrototypeTable, thisObject, propertyName, slot);
138 }
139
140 const ClassInfo JSTestTypedefs::s_info = { "TestTypedefs", &Base::s_info, &JSTestTypedefsTable, 0 , CREATE_METHOD_TABLE(JSTestTypedefs) };
141
142 JSTestTypedefs::JSTestTypedefs(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestTypedefs> impl)
143     : JSDOMWrapper(structure, globalObject)
144     , m_impl(impl.leakRef())
145 {
146 }
147
148 void JSTestTypedefs::finishCreation(VM& vm)
149 {
150     Base::finishCreation(vm);
151     ASSERT(inherits(info()));
152 }
153
154 JSObject* JSTestTypedefs::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
155 {
156     return JSTestTypedefsPrototype::create(exec->vm(), globalObject, JSTestTypedefsPrototype::createStructure(globalObject->vm(), globalObject, globalObject->objectPrototype()));
157 }
158
159 void JSTestTypedefs::destroy(JSC::JSCell* cell)
160 {
161     JSTestTypedefs* thisObject = static_cast<JSTestTypedefs*>(cell);
162     thisObject->JSTestTypedefs::~JSTestTypedefs();
163 }
164
165 JSTestTypedefs::~JSTestTypedefs()
166 {
167     releaseImplIfNotNull();
168 }
169
170 bool JSTestTypedefs::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
171 {
172     JSTestTypedefs* thisObject = jsCast<JSTestTypedefs*>(object);
173     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
174     return getStaticValueSlot<JSTestTypedefs, Base>(exec, JSTestTypedefsTable, thisObject, propertyName, slot);
175 }
176
177 JSValue jsTestTypedefsUnsignedLongLongAttr(ExecState* exec, JSValue slotBase, PropertyName)
178 {
179     JSTestTypedefs* castedThis = jsCast<JSTestTypedefs*>(asObject(slotBase));
180     UNUSED_PARAM(exec);
181     TestTypedefs* impl = static_cast<TestTypedefs*>(castedThis->impl());
182     JSValue result = jsNumber(impl->unsignedLongLongAttr());
183     return result;
184 }
185
186
187 JSValue jsTestTypedefsImmutableSerializedScriptValue(ExecState* exec, JSValue slotBase, PropertyName)
188 {
189     JSTestTypedefs* castedThis = jsCast<JSTestTypedefs*>(asObject(slotBase));
190     UNUSED_PARAM(exec);
191     TestTypedefs* impl = static_cast<TestTypedefs*>(castedThis->impl());
192     JSValue result = impl->immutableSerializedScriptValue() ? impl->immutableSerializedScriptValue()->deserialize(exec, castedThis->globalObject(), 0) : jsNull();
193     return result;
194 }
195
196
197 JSValue jsTestTypedefsConstructorTestSubObj(ExecState* exec, JSValue slotBase, PropertyName)
198 {
199     JSTestTypedefs* castedThis = jsCast<JSTestTypedefs*>(asObject(slotBase));
200     return JSTestSubObj::getConstructor(exec, castedThis->globalObject());
201 }
202
203
204 JSValue jsTestTypedefsAttrWithGetterException(ExecState* exec, JSValue slotBase, PropertyName)
205 {
206     JSTestTypedefs* castedThis = jsCast<JSTestTypedefs*>(asObject(slotBase));
207     ExceptionCode ec = 0;
208     TestTypedefs* impl = static_cast<TestTypedefs*>(castedThis->impl());
209     JSC::JSValue result = jsNumber(impl->attrWithGetterException(ec));
210     setDOMException(exec, ec);
211     return result;
212 }
213
214
215 JSValue jsTestTypedefsAttrWithSetterException(ExecState* exec, JSValue slotBase, PropertyName)
216 {
217     JSTestTypedefs* castedThis = jsCast<JSTestTypedefs*>(asObject(slotBase));
218     UNUSED_PARAM(exec);
219     TestTypedefs* impl = static_cast<TestTypedefs*>(castedThis->impl());
220     JSValue result = jsNumber(impl->attrWithSetterException());
221     return result;
222 }
223
224
225 JSValue jsTestTypedefsStringAttrWithGetterException(ExecState* exec, JSValue slotBase, PropertyName)
226 {
227     JSTestTypedefs* castedThis = jsCast<JSTestTypedefs*>(asObject(slotBase));
228     ExceptionCode ec = 0;
229     TestTypedefs* impl = static_cast<TestTypedefs*>(castedThis->impl());
230     JSC::JSValue result = jsStringWithCache(exec, impl->stringAttrWithGetterException(ec));
231     setDOMException(exec, ec);
232     return result;
233 }
234
235
236 JSValue jsTestTypedefsStringAttrWithSetterException(ExecState* exec, JSValue slotBase, PropertyName)
237 {
238     JSTestTypedefs* castedThis = jsCast<JSTestTypedefs*>(asObject(slotBase));
239     UNUSED_PARAM(exec);
240     TestTypedefs* impl = static_cast<TestTypedefs*>(castedThis->impl());
241     JSValue result = jsStringWithCache(exec, impl->stringAttrWithSetterException());
242     return result;
243 }
244
245
246 JSValue jsTestTypedefsConstructor(ExecState* exec, JSValue slotBase, PropertyName)
247 {
248     JSTestTypedefs* domObject = jsCast<JSTestTypedefs*>(asObject(slotBase));
249     return JSTestTypedefs::getConstructor(exec, domObject->globalObject());
250 }
251
252 void JSTestTypedefs::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
253 {
254     JSTestTypedefs* thisObject = jsCast<JSTestTypedefs*>(cell);
255     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
256     lookupPut<JSTestTypedefs, Base>(exec, propertyName, value, JSTestTypedefsTable, thisObject, slot);
257 }
258
259 void setJSTestTypedefsUnsignedLongLongAttr(ExecState* exec, JSObject* thisObject, JSValue value)
260 {
261     UNUSED_PARAM(exec);
262     JSTestTypedefs* castedThis = jsCast<JSTestTypedefs*>(thisObject);
263     TestTypedefs* impl = static_cast<TestTypedefs*>(castedThis->impl());
264     unsigned long long nativeValue(toUInt64(exec, value, NormalConversion));
265     if (exec->hadException())
266         return;
267     impl->setUnsignedLongLongAttr(nativeValue);
268 }
269
270
271 void setJSTestTypedefsImmutableSerializedScriptValue(ExecState* exec, JSObject* thisObject, JSValue value)
272 {
273     UNUSED_PARAM(exec);
274     JSTestTypedefs* castedThis = jsCast<JSTestTypedefs*>(thisObject);
275     TestTypedefs* impl = static_cast<TestTypedefs*>(castedThis->impl());
276     RefPtr<SerializedScriptValue> nativeValue(SerializedScriptValue::create(exec, value, 0, 0));
277     if (exec->hadException())
278         return;
279     impl->setImmutableSerializedScriptValue(nativeValue);
280 }
281
282
283 void setJSTestTypedefsAttrWithGetterException(ExecState* exec, JSObject* thisObject, JSValue value)
284 {
285     UNUSED_PARAM(exec);
286     JSTestTypedefs* castedThis = jsCast<JSTestTypedefs*>(thisObject);
287     TestTypedefs* impl = static_cast<TestTypedefs*>(castedThis->impl());
288     int nativeValue(toInt32(exec, value, NormalConversion));
289     if (exec->hadException())
290         return;
291     impl->setAttrWithGetterException(nativeValue);
292 }
293
294
295 void setJSTestTypedefsAttrWithSetterException(ExecState* exec, JSObject* thisObject, JSValue value)
296 {
297     UNUSED_PARAM(exec);
298     JSTestTypedefs* castedThis = jsCast<JSTestTypedefs*>(thisObject);
299     TestTypedefs* impl = static_cast<TestTypedefs*>(castedThis->impl());
300     ExceptionCode ec = 0;
301     int nativeValue(toInt32(exec, value, NormalConversion));
302     if (exec->hadException())
303         return;
304     impl->setAttrWithSetterException(nativeValue, ec);
305     setDOMException(exec, ec);
306 }
307
308
309 void setJSTestTypedefsStringAttrWithGetterException(ExecState* exec, JSObject* thisObject, JSValue value)
310 {
311     UNUSED_PARAM(exec);
312     JSTestTypedefs* castedThis = jsCast<JSTestTypedefs*>(thisObject);
313     TestTypedefs* impl = static_cast<TestTypedefs*>(castedThis->impl());
314     const String& nativeValue(value.isEmpty() ? String() : value.toString(exec)->value(exec));
315     if (exec->hadException())
316         return;
317     impl->setStringAttrWithGetterException(nativeValue);
318 }
319
320
321 void setJSTestTypedefsStringAttrWithSetterException(ExecState* exec, JSObject* thisObject, JSValue value)
322 {
323     UNUSED_PARAM(exec);
324     JSTestTypedefs* castedThis = jsCast<JSTestTypedefs*>(thisObject);
325     TestTypedefs* impl = static_cast<TestTypedefs*>(castedThis->impl());
326     ExceptionCode ec = 0;
327     const String& nativeValue(value.isEmpty() ? String() : value.toString(exec)->value(exec));
328     if (exec->hadException())
329         return;
330     impl->setStringAttrWithSetterException(nativeValue, ec);
331     setDOMException(exec, ec);
332 }
333
334
335 JSValue JSTestTypedefs::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
336 {
337     return getDOMConstructor<JSTestTypedefsConstructor>(exec, jsCast<JSDOMGlobalObject*>(globalObject));
338 }
339
340 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionFunc(ExecState* exec)
341 {
342     JSValue thisValue = exec->hostThisValue();
343     if (!thisValue.inherits(JSTestTypedefs::info()))
344         return throwVMTypeError(exec);
345     JSTestTypedefs* castedThis = jsCast<JSTestTypedefs*>(asObject(thisValue));
346     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
347     TestTypedefs* impl = static_cast<TestTypedefs*>(castedThis->impl());
348
349     size_t argsCount = exec->argumentCount();
350     if (argsCount <= 0) {
351         impl->func();
352         return JSValue::encode(jsUndefined());
353     }
354
355     if (exec->argumentCount() > 0 && !exec->argument(0).isUndefinedOrNull() && !exec->argument(0).inherits(JSlong[]::info()))
356         return throwVMTypeError(exec);
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     if (!thisValue.inherits(JSTestTypedefs::info()))
368         return throwVMTypeError(exec);
369     JSTestTypedefs* castedThis = jsCast<JSTestTypedefs*>(asObject(thisValue));
370     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
371     TestTypedefs* impl = static_cast<TestTypedefs*>(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     if (!thisValue.inherits(JSTestTypedefs::info()))
409         return throwVMTypeError(exec);
410     JSTestTypedefs* castedThis = jsCast<JSTestTypedefs*>(asObject(thisValue));
411     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
412     TestTypedefs* impl = static_cast<TestTypedefs*>(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     if (!thisValue.inherits(JSTestTypedefs::info()))
427         return throwVMTypeError(exec);
428     JSTestTypedefs* castedThis = jsCast<JSTestTypedefs*>(asObject(thisValue));
429     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
430     TestTypedefs* impl = static_cast<TestTypedefs*>(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     if (!thisValue.inherits(JSTestTypedefs::info()))
444         return throwVMTypeError(exec);
445     JSTestTypedefs* castedThis = jsCast<JSTestTypedefs*>(asObject(thisValue));
446     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
447     TestTypedefs* impl = static_cast<TestTypedefs*>(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     if (!thisValue.inherits(JSTestTypedefs::info()))
481         return throwVMTypeError(exec);
482     JSTestTypedefs* castedThis = jsCast<JSTestTypedefs*>(asObject(thisValue));
483     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
484     TestTypedefs* impl = static_cast<TestTypedefs*>(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     if (!thisValue.inherits(JSTestTypedefs::info()))
494         return throwVMTypeError(exec);
495     JSTestTypedefs* castedThis = jsCast<JSTestTypedefs*>(asObject(thisValue));
496     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
497     TestTypedefs* impl = static_cast<TestTypedefs*>(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     if (!thisValue.inherits(JSTestTypedefs::info()))
514         return throwVMTypeError(exec);
515     JSTestTypedefs* castedThis = jsCast<JSTestTypedefs*>(asObject(thisValue));
516     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
517     TestTypedefs* impl = static_cast<TestTypedefs*>(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 jsTestTypedefsPrototypeFunctionMethodWithException(ExecState* exec)
531 {
532     JSValue thisValue = exec->hostThisValue();
533     if (!thisValue.inherits(JSTestTypedefs::info()))
534         return throwVMTypeError(exec);
535     JSTestTypedefs* castedThis = jsCast<JSTestTypedefs*>(asObject(thisValue));
536     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
537     TestTypedefs* impl = static_cast<TestTypedefs*>(castedThis->impl());
538     ExceptionCode ec = 0;
539     impl->methodWithException(ec);
540     setDOMException(exec, ec);
541     return JSValue::encode(jsUndefined());
542 }
543
544 static inline bool isObservable(JSTestTypedefs* jsTestTypedefs)
545 {
546     if (jsTestTypedefs->hasCustomProperties())
547         return true;
548     return false;
549 }
550
551 bool JSTestTypedefsOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
552 {
553     JSTestTypedefs* jsTestTypedefs = jsCast<JSTestTypedefs*>(handle.get().asCell());
554     if (!isObservable(jsTestTypedefs))
555         return false;
556     UNUSED_PARAM(visitor);
557     return false;
558 }
559
560 void JSTestTypedefsOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
561 {
562     JSTestTypedefs* jsTestTypedefs = jsCast<JSTestTypedefs*>(handle.get().asCell());
563     DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
564     uncacheWrapper(world, jsTestTypedefs->impl(), jsTestTypedefs);
565     jsTestTypedefs->releaseImpl();
566 }
567
568 #if ENABLE(BINDING_INTEGRITY)
569 #if PLATFORM(WIN)
570 #pragma warning(disable: 4483)
571 extern "C" { extern void (*const __identifier("??_7TestTypedefs@WebCore@@6B@")[])(); }
572 #else
573 extern "C" { extern void* _ZTVN7WebCore12TestTypedefsE[]; }
574 #endif
575 #endif
576 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestTypedefs* impl)
577 {
578     if (!impl)
579         return jsNull();
580     if (JSValue result = getExistingWrapper<JSTestTypedefs>(exec, impl))
581         return result;
582
583 #if ENABLE(BINDING_INTEGRITY)
584     void* actualVTablePointer = *(reinterpret_cast<void**>(impl));
585 #if PLATFORM(WIN)
586     void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestTypedefs@WebCore@@6B@"));
587 #else
588     void* expectedVTablePointer = &_ZTVN7WebCore12TestTypedefsE[2];
589 #if COMPILER(CLANG)
590     // If this fails TestTypedefs does not have a vtable, so you need to add the
591     // ImplementationLacksVTable attribute to the interface definition
592     COMPILE_ASSERT(__is_polymorphic(TestTypedefs), TestTypedefs_is_not_polymorphic);
593 #endif
594 #endif
595     // If you hit this assertion you either have a use after free bug, or
596     // TestTypedefs has subclasses. If TestTypedefs has subclasses that get passed
597     // to toJS() we currently require TestTypedefs you to opt out of binding hardening
598     // by adding the SkipVTableValidation attribute to the interface IDL definition
599     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
600 #endif
601     ReportMemoryCost<TestTypedefs>::reportMemoryCost(exec, impl);
602     return createNewWrapper<JSTestTypedefs>(exec, globalObject, impl);
603 }
604
605 TestTypedefs* toTestTypedefs(JSC::JSValue value)
606 {
607     return value.inherits(JSTestTypedefs::info()) ? jsCast<JSTestTypedefs*>(asObject(value))->impl() : 0;
608 }
609
610 }