[JSC] Weak should only accept cell pointees.
[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 // Functions
47
48 JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionFunc(JSC::ExecState*);
49 JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionSetShadow(JSC::ExecState*);
50 JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionMethodWithSequenceArg(JSC::ExecState*);
51 JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionNullableArrayArg(JSC::ExecState*);
52 JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionFuncWithClamp(JSC::ExecState*);
53 JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionImmutablePointFunction(JSC::ExecState*);
54 JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionStringArrayFunction(JSC::ExecState*);
55 JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionStringArrayFunction2(JSC::ExecState*);
56 JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionCallWithSequenceThatRequiresInclude(JSC::ExecState*);
57 JSC::EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionMethodWithException(JSC::ExecState*);
58
59 // Attributes
60
61 JSC::EncodedJSValue jsTestTypedefsUnsignedLongLongAttr(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::PropertyName);
62 void setJSTestTypedefsUnsignedLongLongAttr(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::EncodedJSValue);
63 JSC::EncodedJSValue jsTestTypedefsImmutableSerializedScriptValue(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::PropertyName);
64 void setJSTestTypedefsImmutableSerializedScriptValue(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::EncodedJSValue);
65 JSC::EncodedJSValue jsTestTypedefsConstructorTestSubObj(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::PropertyName);
66 JSC::EncodedJSValue jsTestTypedefsAttrWithGetterException(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::PropertyName);
67 void setJSTestTypedefsAttrWithGetterException(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::EncodedJSValue);
68 JSC::EncodedJSValue jsTestTypedefsAttrWithSetterException(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::PropertyName);
69 void setJSTestTypedefsAttrWithSetterException(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::EncodedJSValue);
70 JSC::EncodedJSValue jsTestTypedefsStringAttrWithGetterException(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::PropertyName);
71 void setJSTestTypedefsStringAttrWithGetterException(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::EncodedJSValue);
72 JSC::EncodedJSValue jsTestTypedefsStringAttrWithSetterException(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::PropertyName);
73 void setJSTestTypedefsStringAttrWithSetterException(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::EncodedJSValue);
74 JSC::EncodedJSValue jsTestTypedefsConstructor(JSC::ExecState*, JSC::JSObject*, JSC::EncodedJSValue, JSC::PropertyName);
75
76 class JSTestTypedefsPrototype : public JSC::JSNonFinalObject {
77 public:
78     typedef JSC::JSNonFinalObject Base;
79     static JSTestTypedefsPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
80     {
81         JSTestTypedefsPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestTypedefsPrototype>(vm.heap)) JSTestTypedefsPrototype(vm, globalObject, structure);
82         ptr->finishCreation(vm);
83         return ptr;
84     }
85
86     DECLARE_INFO;
87     static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
88     {
89         return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
90     }
91
92 private:
93     JSTestTypedefsPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
94         : JSC::JSNonFinalObject(vm, structure)
95     {
96     }
97
98     void finishCreation(JSC::VM&);
99 };
100
101 class JSTestTypedefsConstructor : public DOMConstructorObject {
102 private:
103     JSTestTypedefsConstructor(JSC::Structure*, JSDOMGlobalObject*);
104     void finishCreation(JSC::VM&, JSDOMGlobalObject*);
105
106 public:
107     typedef DOMConstructorObject Base;
108     static JSTestTypedefsConstructor* create(JSC::VM& vm, JSC::Structure* structure, JSDOMGlobalObject* globalObject)
109     {
110         JSTestTypedefsConstructor* ptr = new (NotNull, JSC::allocateCell<JSTestTypedefsConstructor>(vm.heap)) JSTestTypedefsConstructor(structure, globalObject);
111         ptr->finishCreation(vm, globalObject);
112         return ptr;
113     }
114
115     DECLARE_INFO;
116     static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
117     {
118         return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
119     }
120 protected:
121     static JSC::EncodedJSValue JSC_HOST_CALL constructJSTestTypedefs(JSC::ExecState*);
122     static JSC::ConstructType getConstructData(JSC::JSCell*, JSC::ConstructData&);
123 };
124
125 /* Hash table */
126
127 static const struct CompactHashIndex JSTestTypedefsTableIndex[2] = {
128     { -1, -1 },
129     { -1, -1 },
130 };
131
132
133 static const HashTableValue JSTestTypedefsTableValues[] =
134 {
135     { 0, 0, NoIntrinsic, { 0, 0 } }
136 };
137
138 static const HashTable JSTestTypedefsTable = { 0, 1, false, JSTestTypedefsTableValues, JSTestTypedefsTableIndex };
139 /* Hash table for constructor */
140
141 static const HashTableValue JSTestTypedefsConstructorTableValues[] =
142 {
143     { "TestSubObj", DontDelete | ReadOnly, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestTypedefsConstructorTestSubObj), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
144 };
145
146 EncodedJSValue JSC_HOST_CALL JSTestTypedefsConstructor::constructJSTestTypedefs(ExecState* exec)
147 {
148     auto* castedThis = jsCast<JSTestTypedefsConstructor*>(exec->callee());
149     if (UNLIKELY(exec->argumentCount() < 2))
150         return throwVMError(exec, createNotEnoughArgumentsError(exec));
151     String hello = exec->argument(0).toString(exec)->value(exec);
152     if (UNLIKELY(exec->hadException()))
153         return JSValue::encode(jsUndefined());
154     if (!exec->argument(1).isObject())
155         return throwArgumentMustBeFunctionError(*exec, 1, "testCallback", "TestTypedefs", nullptr);
156     RefPtr<TestCallback> testCallback = JSTestCallback::create(asObject(exec->uncheckedArgument(1)), castedThis->globalObject());
157     RefPtr<TestTypedefs> object = TestTypedefs::create(hello, testCallback);
158     return JSValue::encode(asObject(toJS(exec, castedThis->globalObject(), object.get())));
159 }
160
161 const ClassInfo JSTestTypedefsConstructor::s_info = { "TestTypedefsConstructor", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestTypedefsConstructor) };
162
163 JSTestTypedefsConstructor::JSTestTypedefsConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
164     : DOMConstructorObject(structure, globalObject)
165 {
166 }
167
168 void JSTestTypedefsConstructor::finishCreation(VM& vm, JSDOMGlobalObject* globalObject)
169 {
170     Base::finishCreation(vm);
171     ASSERT(inherits(info()));
172     putDirect(vm, vm.propertyNames->prototype, JSTestTypedefs::getPrototype(vm, globalObject), DontDelete | ReadOnly | DontEnum);
173     putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("TestTypedefs"))), ReadOnly | DontEnum);
174     putDirect(vm, vm.propertyNames->length, jsNumber(2), ReadOnly | DontEnum);
175     reifyStaticProperties(vm, JSTestTypedefsConstructorTableValues, *this);
176 }
177
178 ConstructType JSTestTypedefsConstructor::getConstructData(JSCell*, ConstructData& constructData)
179 {
180     constructData.native.function = constructJSTestTypedefs;
181     return ConstructTypeHost;
182 }
183
184 /* Hash table for prototype */
185
186 static const HashTableValue JSTestTypedefsPrototypeTableValues[] =
187 {
188     { "constructor", DontEnum | ReadOnly, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestTypedefsConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
189     { "unsignedLongLongAttr", DontDelete | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestTypedefsUnsignedLongLongAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestTypedefsUnsignedLongLongAttr) } },
190     { "immutableSerializedScriptValue", DontDelete | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestTypedefsImmutableSerializedScriptValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestTypedefsImmutableSerializedScriptValue) } },
191     { "attrWithGetterException", DontDelete | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestTypedefsAttrWithGetterException), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestTypedefsAttrWithGetterException) } },
192     { "attrWithSetterException", DontDelete | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestTypedefsAttrWithSetterException), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestTypedefsAttrWithSetterException) } },
193     { "stringAttrWithGetterException", DontDelete | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestTypedefsStringAttrWithGetterException), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestTypedefsStringAttrWithGetterException) } },
194     { "stringAttrWithSetterException", DontDelete | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestTypedefsStringAttrWithSetterException), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestTypedefsStringAttrWithSetterException) } },
195     { "func", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionFunc), (intptr_t) (0) } },
196     { "setShadow", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionSetShadow), (intptr_t) (3) } },
197     { "methodWithSequenceArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionMethodWithSequenceArg), (intptr_t) (1) } },
198     { "nullableArrayArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionNullableArrayArg), (intptr_t) (1) } },
199     { "funcWithClamp", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionFuncWithClamp), (intptr_t) (1) } },
200     { "immutablePointFunction", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionImmutablePointFunction), (intptr_t) (0) } },
201     { "stringArrayFunction", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionStringArrayFunction), (intptr_t) (1) } },
202     { "stringArrayFunction2", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionStringArrayFunction2), (intptr_t) (1) } },
203     { "callWithSequenceThatRequiresInclude", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionCallWithSequenceThatRequiresInclude), (intptr_t) (1) } },
204     { "methodWithException", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestTypedefsPrototypeFunctionMethodWithException), (intptr_t) (0) } },
205 };
206
207 const ClassInfo JSTestTypedefsPrototype::s_info = { "TestTypedefsPrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestTypedefsPrototype) };
208
209 void JSTestTypedefsPrototype::finishCreation(VM& vm)
210 {
211     Base::finishCreation(vm);
212     reifyStaticProperties(vm, JSTestTypedefsPrototypeTableValues, *this);
213 }
214
215 const ClassInfo JSTestTypedefs::s_info = { "TestTypedefs", &Base::s_info, &JSTestTypedefsTable, CREATE_METHOD_TABLE(JSTestTypedefs) };
216
217 JSTestTypedefs::JSTestTypedefs(Structure* structure, JSDOMGlobalObject* globalObject, Ref<TestTypedefs>&& impl)
218     : JSDOMWrapper(structure, globalObject)
219     , m_impl(&impl.leakRef())
220 {
221 }
222
223 JSObject* JSTestTypedefs::createPrototype(VM& vm, JSGlobalObject* globalObject)
224 {
225     return JSTestTypedefsPrototype::create(vm, globalObject, JSTestTypedefsPrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
226 }
227
228 JSObject* JSTestTypedefs::getPrototype(VM& vm, JSGlobalObject* globalObject)
229 {
230     return getDOMPrototype<JSTestTypedefs>(vm, globalObject);
231 }
232
233 void JSTestTypedefs::destroy(JSC::JSCell* cell)
234 {
235     JSTestTypedefs* thisObject = static_cast<JSTestTypedefs*>(cell);
236     thisObject->JSTestTypedefs::~JSTestTypedefs();
237 }
238
239 JSTestTypedefs::~JSTestTypedefs()
240 {
241     releaseImpl();
242 }
243
244 bool JSTestTypedefs::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
245 {
246     auto* thisObject = jsCast<JSTestTypedefs*>(object);
247     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
248     if (getStaticValueSlot<JSTestTypedefs, Base>(exec, JSTestTypedefsTable, thisObject, propertyName, slot))
249         return true;
250     return false;
251 }
252
253 EncodedJSValue jsTestTypedefsUnsignedLongLongAttr(ExecState* exec, JSObject* slotBase, EncodedJSValue thisValue, PropertyName)
254 {
255     UNUSED_PARAM(exec);
256     UNUSED_PARAM(slotBase);
257     UNUSED_PARAM(thisValue);
258     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
259     if (UNLIKELY(!castedThis)) {
260         if (jsDynamicCast<JSTestTypedefsPrototype*>(slotBase))
261             return reportDeprecatedGetterError(*exec, "TestTypedefs", "unsignedLongLongAttr");
262         return throwGetterTypeError(*exec, "TestTypedefs", "unsignedLongLongAttr");
263     }
264     auto& impl = castedThis->impl();
265     JSValue result = jsNumber(impl.unsignedLongLongAttr());
266     return JSValue::encode(result);
267 }
268
269
270 EncodedJSValue jsTestTypedefsImmutableSerializedScriptValue(ExecState* exec, JSObject* slotBase, EncodedJSValue thisValue, PropertyName)
271 {
272     UNUSED_PARAM(exec);
273     UNUSED_PARAM(slotBase);
274     UNUSED_PARAM(thisValue);
275     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
276     if (UNLIKELY(!castedThis)) {
277         if (jsDynamicCast<JSTestTypedefsPrototype*>(slotBase))
278             return reportDeprecatedGetterError(*exec, "TestTypedefs", "immutableSerializedScriptValue");
279         return throwGetterTypeError(*exec, "TestTypedefs", "immutableSerializedScriptValue");
280     }
281     auto& impl = castedThis->impl();
282     JSValue result = impl.immutableSerializedScriptValue() ? impl.immutableSerializedScriptValue()->deserialize(exec, castedThis->globalObject(), 0) : jsNull();
283     return JSValue::encode(result);
284 }
285
286
287 EncodedJSValue jsTestTypedefsConstructorTestSubObj(ExecState* exec, JSObject* slotBase, EncodedJSValue thisValue, PropertyName)
288 {
289     UNUSED_PARAM(exec);
290     UNUSED_PARAM(slotBase);
291     UNUSED_PARAM(thisValue);
292     auto* castedThis = jsCast<JSTestTypedefs*>(slotBase);
293     return JSValue::encode(JSTestSubObj::getConstructor(exec->vm(), castedThis->globalObject()));
294 }
295
296
297 EncodedJSValue jsTestTypedefsAttrWithGetterException(ExecState* exec, JSObject* slotBase, EncodedJSValue thisValue, PropertyName)
298 {
299     UNUSED_PARAM(exec);
300     UNUSED_PARAM(slotBase);
301     UNUSED_PARAM(thisValue);
302     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
303     if (UNLIKELY(!castedThis)) {
304         if (jsDynamicCast<JSTestTypedefsPrototype*>(slotBase))
305             return reportDeprecatedGetterError(*exec, "TestTypedefs", "attrWithGetterException");
306         return throwGetterTypeError(*exec, "TestTypedefs", "attrWithGetterException");
307     }
308     ExceptionCode ec = 0;
309     auto& impl = castedThis->impl();
310     JSValue result = jsNumber(impl.attrWithGetterException(ec));
311     setDOMException(exec, ec);
312     return JSValue::encode(result);
313 }
314
315
316 EncodedJSValue jsTestTypedefsAttrWithSetterException(ExecState* exec, JSObject* slotBase, EncodedJSValue thisValue, PropertyName)
317 {
318     UNUSED_PARAM(exec);
319     UNUSED_PARAM(slotBase);
320     UNUSED_PARAM(thisValue);
321     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
322     if (UNLIKELY(!castedThis)) {
323         if (jsDynamicCast<JSTestTypedefsPrototype*>(slotBase))
324             return reportDeprecatedGetterError(*exec, "TestTypedefs", "attrWithSetterException");
325         return throwGetterTypeError(*exec, "TestTypedefs", "attrWithSetterException");
326     }
327     auto& impl = castedThis->impl();
328     JSValue result = jsNumber(impl.attrWithSetterException());
329     return JSValue::encode(result);
330 }
331
332
333 EncodedJSValue jsTestTypedefsStringAttrWithGetterException(ExecState* exec, JSObject* slotBase, EncodedJSValue thisValue, PropertyName)
334 {
335     UNUSED_PARAM(exec);
336     UNUSED_PARAM(slotBase);
337     UNUSED_PARAM(thisValue);
338     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
339     if (UNLIKELY(!castedThis)) {
340         if (jsDynamicCast<JSTestTypedefsPrototype*>(slotBase))
341             return reportDeprecatedGetterError(*exec, "TestTypedefs", "stringAttrWithGetterException");
342         return throwGetterTypeError(*exec, "TestTypedefs", "stringAttrWithGetterException");
343     }
344     ExceptionCode ec = 0;
345     auto& impl = castedThis->impl();
346     JSValue result = jsStringWithCache(exec, impl.stringAttrWithGetterException(ec));
347     setDOMException(exec, ec);
348     return JSValue::encode(result);
349 }
350
351
352 EncodedJSValue jsTestTypedefsStringAttrWithSetterException(ExecState* exec, JSObject* slotBase, EncodedJSValue thisValue, PropertyName)
353 {
354     UNUSED_PARAM(exec);
355     UNUSED_PARAM(slotBase);
356     UNUSED_PARAM(thisValue);
357     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
358     if (UNLIKELY(!castedThis)) {
359         if (jsDynamicCast<JSTestTypedefsPrototype*>(slotBase))
360             return reportDeprecatedGetterError(*exec, "TestTypedefs", "stringAttrWithSetterException");
361         return throwGetterTypeError(*exec, "TestTypedefs", "stringAttrWithSetterException");
362     }
363     auto& impl = castedThis->impl();
364     JSValue result = jsStringWithCache(exec, impl.stringAttrWithSetterException());
365     return JSValue::encode(result);
366 }
367
368
369 EncodedJSValue jsTestTypedefsConstructor(ExecState* exec, JSObject* baseValue, EncodedJSValue, PropertyName)
370 {
371     JSTestTypedefsPrototype* domObject = jsDynamicCast<JSTestTypedefsPrototype*>(baseValue);
372     if (!domObject)
373         return throwVMTypeError(exec);
374     return JSValue::encode(JSTestTypedefs::getConstructor(exec->vm(), domObject->globalObject()));
375 }
376
377 void setJSTestTypedefsUnsignedLongLongAttr(ExecState* exec, JSObject* baseObject, EncodedJSValue thisValue, EncodedJSValue encodedValue)
378 {
379     JSValue value = JSValue::decode(encodedValue);
380     UNUSED_PARAM(baseObject);
381     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
382     if (UNLIKELY(!castedThis)) {
383         if (jsDynamicCast<JSTestTypedefsPrototype*>(JSValue::decode(thisValue)))
384             reportDeprecatedSetterError(*exec, "TestTypedefs", "unsignedLongLongAttr");
385         else
386             throwSetterTypeError(*exec, "TestTypedefs", "unsignedLongLongAttr");
387         return;
388     }
389     auto& impl = castedThis->impl();
390     unsigned long long nativeValue = toUInt64(exec, value, NormalConversion);
391     if (UNLIKELY(exec->hadException()))
392         return;
393     impl.setUnsignedLongLongAttr(nativeValue);
394 }
395
396
397 void setJSTestTypedefsImmutableSerializedScriptValue(ExecState* exec, JSObject* baseObject, EncodedJSValue thisValue, EncodedJSValue encodedValue)
398 {
399     JSValue value = JSValue::decode(encodedValue);
400     UNUSED_PARAM(baseObject);
401     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
402     if (UNLIKELY(!castedThis)) {
403         if (jsDynamicCast<JSTestTypedefsPrototype*>(JSValue::decode(thisValue)))
404             reportDeprecatedSetterError(*exec, "TestTypedefs", "immutableSerializedScriptValue");
405         else
406             throwSetterTypeError(*exec, "TestTypedefs", "immutableSerializedScriptValue");
407         return;
408     }
409     auto& impl = castedThis->impl();
410     RefPtr<SerializedScriptValue> nativeValue = SerializedScriptValue::create(exec, value, 0, 0);
411     if (UNLIKELY(exec->hadException()))
412         return;
413     impl.setImmutableSerializedScriptValue(nativeValue);
414 }
415
416
417 void setJSTestTypedefsAttrWithGetterException(ExecState* exec, JSObject* baseObject, EncodedJSValue thisValue, EncodedJSValue encodedValue)
418 {
419     JSValue value = JSValue::decode(encodedValue);
420     UNUSED_PARAM(baseObject);
421     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
422     if (UNLIKELY(!castedThis)) {
423         if (jsDynamicCast<JSTestTypedefsPrototype*>(JSValue::decode(thisValue)))
424             reportDeprecatedSetterError(*exec, "TestTypedefs", "attrWithGetterException");
425         else
426             throwSetterTypeError(*exec, "TestTypedefs", "attrWithGetterException");
427         return;
428     }
429     auto& impl = castedThis->impl();
430     int nativeValue = toInt32(exec, value, NormalConversion);
431     if (UNLIKELY(exec->hadException()))
432         return;
433     impl.setAttrWithGetterException(nativeValue);
434 }
435
436
437 void setJSTestTypedefsAttrWithSetterException(ExecState* exec, JSObject* baseObject, EncodedJSValue thisValue, EncodedJSValue encodedValue)
438 {
439     JSValue value = JSValue::decode(encodedValue);
440     UNUSED_PARAM(baseObject);
441     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
442     if (UNLIKELY(!castedThis)) {
443         if (jsDynamicCast<JSTestTypedefsPrototype*>(JSValue::decode(thisValue)))
444             reportDeprecatedSetterError(*exec, "TestTypedefs", "attrWithSetterException");
445         else
446             throwSetterTypeError(*exec, "TestTypedefs", "attrWithSetterException");
447         return;
448     }
449     auto& impl = castedThis->impl();
450     ExceptionCode ec = 0;
451     int nativeValue = toInt32(exec, value, NormalConversion);
452     if (UNLIKELY(exec->hadException()))
453         return;
454     impl.setAttrWithSetterException(nativeValue, ec);
455     setDOMException(exec, ec);
456 }
457
458
459 void setJSTestTypedefsStringAttrWithGetterException(ExecState* exec, JSObject* baseObject, EncodedJSValue thisValue, EncodedJSValue encodedValue)
460 {
461     JSValue value = JSValue::decode(encodedValue);
462     UNUSED_PARAM(baseObject);
463     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
464     if (UNLIKELY(!castedThis)) {
465         if (jsDynamicCast<JSTestTypedefsPrototype*>(JSValue::decode(thisValue)))
466             reportDeprecatedSetterError(*exec, "TestTypedefs", "stringAttrWithGetterException");
467         else
468             throwSetterTypeError(*exec, "TestTypedefs", "stringAttrWithGetterException");
469         return;
470     }
471     auto& impl = castedThis->impl();
472     String nativeValue = value.toString(exec)->value(exec);
473     if (UNLIKELY(exec->hadException()))
474         return;
475     impl.setStringAttrWithGetterException(nativeValue);
476 }
477
478
479 void setJSTestTypedefsStringAttrWithSetterException(ExecState* exec, JSObject* baseObject, EncodedJSValue thisValue, EncodedJSValue encodedValue)
480 {
481     JSValue value = JSValue::decode(encodedValue);
482     UNUSED_PARAM(baseObject);
483     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(JSValue::decode(thisValue));
484     if (UNLIKELY(!castedThis)) {
485         if (jsDynamicCast<JSTestTypedefsPrototype*>(JSValue::decode(thisValue)))
486             reportDeprecatedSetterError(*exec, "TestTypedefs", "stringAttrWithSetterException");
487         else
488             throwSetterTypeError(*exec, "TestTypedefs", "stringAttrWithSetterException");
489         return;
490     }
491     auto& impl = castedThis->impl();
492     ExceptionCode ec = 0;
493     String nativeValue = value.toString(exec)->value(exec);
494     if (UNLIKELY(exec->hadException()))
495         return;
496     impl.setStringAttrWithSetterException(nativeValue, ec);
497     setDOMException(exec, ec);
498 }
499
500
501 JSValue JSTestTypedefs::getConstructor(VM& vm, JSGlobalObject* globalObject)
502 {
503     return getDOMConstructor<JSTestTypedefsConstructor>(vm, jsCast<JSDOMGlobalObject*>(globalObject));
504 }
505
506 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionFunc(ExecState* exec)
507 {
508     JSValue thisValue = exec->thisValue();
509     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
510     if (UNLIKELY(!castedThis))
511         return throwThisTypeError(*exec, "TestTypedefs", "func");
512     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
513     auto& impl = castedThis->impl();
514
515     size_t argsCount = exec->argumentCount();
516     if (argsCount <= 0) {
517         impl.func();
518         return JSValue::encode(jsUndefined());
519     }
520
521     Vector<int> x = toNativeArray<int>(exec, exec->argument(0));
522     if (UNLIKELY(exec->hadException()))
523         return JSValue::encode(jsUndefined());
524     impl.func(x);
525     return JSValue::encode(jsUndefined());
526 }
527
528 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionSetShadow(ExecState* exec)
529 {
530     JSValue thisValue = exec->thisValue();
531     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
532     if (UNLIKELY(!castedThis))
533         return throwThisTypeError(*exec, "TestTypedefs", "setShadow");
534     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
535     auto& impl = castedThis->impl();
536     if (UNLIKELY(exec->argumentCount() < 3))
537         return throwVMError(exec, createNotEnoughArgumentsError(exec));
538     float width = exec->argument(0).toFloat(exec);
539     if (UNLIKELY(exec->hadException()))
540         return JSValue::encode(jsUndefined());
541     float height = exec->argument(1).toFloat(exec);
542     if (UNLIKELY(exec->hadException()))
543         return JSValue::encode(jsUndefined());
544     float blur = exec->argument(2).toFloat(exec);
545     if (UNLIKELY(exec->hadException()))
546         return JSValue::encode(jsUndefined());
547
548     size_t argsCount = exec->argumentCount();
549     if (argsCount <= 3) {
550         impl.setShadow(width, height, blur);
551         return JSValue::encode(jsUndefined());
552     }
553
554     String color = exec->argument(3).toString(exec)->value(exec);
555     if (UNLIKELY(exec->hadException()))
556         return JSValue::encode(jsUndefined());
557     if (argsCount <= 4) {
558         impl.setShadow(width, height, blur, color);
559         return JSValue::encode(jsUndefined());
560     }
561
562     float alpha = exec->argument(4).toFloat(exec);
563     if (UNLIKELY(exec->hadException()))
564         return JSValue::encode(jsUndefined());
565     impl.setShadow(width, height, blur, color, alpha);
566     return JSValue::encode(jsUndefined());
567 }
568
569 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionMethodWithSequenceArg(ExecState* exec)
570 {
571     JSValue thisValue = exec->thisValue();
572     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
573     if (UNLIKELY(!castedThis))
574         return throwThisTypeError(*exec, "TestTypedefs", "methodWithSequenceArg");
575     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
576     auto& impl = castedThis->impl();
577     if (UNLIKELY(exec->argumentCount() < 1))
578         return throwVMError(exec, createNotEnoughArgumentsError(exec));
579     Vector<RefPtr<SerializedScriptValue>> sequenceArg = (toRefPtrNativeArray<SerializedScriptValue, JSSerializedScriptValue>(exec, exec->argument(0), &JSSerializedScriptValue::toWrapped));
580     if (UNLIKELY(exec->hadException()))
581         return JSValue::encode(jsUndefined());
582     JSValue result = jsNumber(impl.methodWithSequenceArg(sequenceArg));
583     return JSValue::encode(result);
584 }
585
586 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionNullableArrayArg(ExecState* exec)
587 {
588     JSValue thisValue = exec->thisValue();
589     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
590     if (UNLIKELY(!castedThis))
591         return throwThisTypeError(*exec, "TestTypedefs", "nullableArrayArg");
592     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
593     auto& impl = castedThis->impl();
594     if (UNLIKELY(exec->argumentCount() < 1))
595         return throwVMError(exec, createNotEnoughArgumentsError(exec));
596     Vector<String> arrayArg = toNativeArray<String>(exec, exec->argument(0));
597     if (UNLIKELY(exec->hadException()))
598         return JSValue::encode(jsUndefined());
599     impl.nullableArrayArg(arrayArg);
600     return JSValue::encode(jsUndefined());
601 }
602
603 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionFuncWithClamp(ExecState* exec)
604 {
605     JSValue thisValue = exec->thisValue();
606     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
607     if (UNLIKELY(!castedThis))
608         return throwThisTypeError(*exec, "TestTypedefs", "funcWithClamp");
609     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
610     auto& impl = castedThis->impl();
611     if (UNLIKELY(exec->argumentCount() < 1))
612         return throwVMError(exec, createNotEnoughArgumentsError(exec));
613     unsigned long long arg1 = 0;
614     double arg1NativeValue = exec->argument(0).toNumber(exec);
615     if (UNLIKELY(exec->hadException()))
616         return JSValue::encode(jsUndefined());
617
618     if (!std::isnan(arg1NativeValue))
619         arg1 = clampTo<unsigned long long>(arg1NativeValue);
620
621
622     size_t argsCount = exec->argumentCount();
623     if (argsCount <= 1) {
624         impl.funcWithClamp(arg1);
625         return JSValue::encode(jsUndefined());
626     }
627
628     unsigned long long arg2 = 0;
629     double arg2NativeValue = exec->argument(1).toNumber(exec);
630     if (UNLIKELY(exec->hadException()))
631         return JSValue::encode(jsUndefined());
632
633     if (!std::isnan(arg2NativeValue))
634         arg2 = clampTo<unsigned long long>(arg2NativeValue);
635
636     impl.funcWithClamp(arg1, arg2);
637     return JSValue::encode(jsUndefined());
638 }
639
640 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionImmutablePointFunction(ExecState* exec)
641 {
642     JSValue thisValue = exec->thisValue();
643     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
644     if (UNLIKELY(!castedThis))
645         return throwThisTypeError(*exec, "TestTypedefs", "immutablePointFunction");
646     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
647     auto& impl = castedThis->impl();
648     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(SVGPropertyTearOff<SVGPoint>::create(impl.immutablePointFunction())));
649     return JSValue::encode(result);
650 }
651
652 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionStringArrayFunction(ExecState* exec)
653 {
654     JSValue thisValue = exec->thisValue();
655     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
656     if (UNLIKELY(!castedThis))
657         return throwThisTypeError(*exec, "TestTypedefs", "stringArrayFunction");
658     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
659     auto& impl = castedThis->impl();
660     if (UNLIKELY(exec->argumentCount() < 1))
661         return throwVMError(exec, createNotEnoughArgumentsError(exec));
662     ExceptionCode ec = 0;
663     Vector<String> values = toNativeArray<String>(exec, exec->argument(0));
664     if (UNLIKELY(exec->hadException()))
665         return JSValue::encode(jsUndefined());
666     JSValue result = jsArray(exec, castedThis->globalObject(), impl.stringArrayFunction(values, ec));
667
668     setDOMException(exec, ec);
669     return JSValue::encode(result);
670 }
671
672 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionStringArrayFunction2(ExecState* exec)
673 {
674     JSValue thisValue = exec->thisValue();
675     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
676     if (UNLIKELY(!castedThis))
677         return throwThisTypeError(*exec, "TestTypedefs", "stringArrayFunction2");
678     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
679     auto& impl = castedThis->impl();
680     if (UNLIKELY(exec->argumentCount() < 1))
681         return throwVMError(exec, createNotEnoughArgumentsError(exec));
682     ExceptionCode ec = 0;
683     Vector<String> values = toNativeArray<String>(exec, exec->argument(0));
684     if (UNLIKELY(exec->hadException()))
685         return JSValue::encode(jsUndefined());
686     JSValue result = jsArray(exec, castedThis->globalObject(), impl.stringArrayFunction2(values, ec));
687
688     setDOMException(exec, ec);
689     return JSValue::encode(result);
690 }
691
692 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionCallWithSequenceThatRequiresInclude(ExecState* exec)
693 {
694     JSValue thisValue = exec->thisValue();
695     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
696     if (UNLIKELY(!castedThis))
697         return throwThisTypeError(*exec, "TestTypedefs", "callWithSequenceThatRequiresInclude");
698     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
699     auto& impl = castedThis->impl();
700     if (UNLIKELY(exec->argumentCount() < 1))
701         return throwVMError(exec, createNotEnoughArgumentsError(exec));
702     Vector<RefPtr<TestEventTarget>> sequenceArg = (toRefPtrNativeArray<TestEventTarget, JSTestEventTarget>(exec, exec->argument(0), &JSTestEventTarget::toWrapped));
703     if (UNLIKELY(exec->hadException()))
704         return JSValue::encode(jsUndefined());
705     JSValue result = jsBoolean(impl.callWithSequenceThatRequiresInclude(sequenceArg));
706     return JSValue::encode(result);
707 }
708
709 EncodedJSValue JSC_HOST_CALL jsTestTypedefsPrototypeFunctionMethodWithException(ExecState* exec)
710 {
711     JSValue thisValue = exec->thisValue();
712     JSTestTypedefs* castedThis = jsDynamicCast<JSTestTypedefs*>(thisValue);
713     if (UNLIKELY(!castedThis))
714         return throwThisTypeError(*exec, "TestTypedefs", "methodWithException");
715     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info());
716     auto& impl = castedThis->impl();
717     ExceptionCode ec = 0;
718     impl.methodWithException(ec);
719     setDOMException(exec, ec);
720     return JSValue::encode(jsUndefined());
721 }
722
723 bool JSTestTypedefsOwner::isReachableFromOpaqueRoots(JSC::JSCell& cell, void*, SlotVisitor& visitor)
724 {
725     UNUSED_PARAM(cell);
726     UNUSED_PARAM(visitor);
727     return false;
728 }
729
730 void JSTestTypedefsOwner::finalize(JSC::JSCell*& cell, void* context)
731 {
732     auto& wrapper = jsCast<JSTestTypedefs&>(*cell);
733     auto& world = *static_cast<DOMWrapperWorld*>(context);
734     uncacheWrapper(world, &wrapper.impl(), &wrapper);
735 }
736
737 #if ENABLE(BINDING_INTEGRITY)
738 #if PLATFORM(WIN)
739 #pragma warning(disable: 4483)
740 extern "C" { extern void (*const __identifier("??_7TestTypedefs@WebCore@@6B@")[])(); }
741 #else
742 extern "C" { extern void* _ZTVN7WebCore12TestTypedefsE[]; }
743 #endif
744 #endif
745 JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject* globalObject, TestTypedefs* impl)
746 {
747     if (!impl)
748         return jsNull();
749     if (JSValue result = getExistingWrapper<JSTestTypedefs>(globalObject, impl))
750         return result;
751
752 #if ENABLE(BINDING_INTEGRITY)
753     void* actualVTablePointer = *(reinterpret_cast<void**>(impl));
754 #if PLATFORM(WIN)
755     void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestTypedefs@WebCore@@6B@"));
756 #else
757     void* expectedVTablePointer = &_ZTVN7WebCore12TestTypedefsE[2];
758 #if COMPILER(CLANG)
759     // If this fails TestTypedefs does not have a vtable, so you need to add the
760     // ImplementationLacksVTable attribute to the interface definition
761     COMPILE_ASSERT(__is_polymorphic(TestTypedefs), TestTypedefs_is_not_polymorphic);
762 #endif
763 #endif
764     // If you hit this assertion you either have a use after free bug, or
765     // TestTypedefs has subclasses. If TestTypedefs has subclasses that get passed
766     // to toJS() we currently require TestTypedefs you to opt out of binding hardening
767     // by adding the SkipVTableValidation attribute to the interface IDL definition
768     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
769 #endif
770     return createNewWrapper<JSTestTypedefs>(globalObject, impl);
771 }
772
773 TestTypedefs* JSTestTypedefs::toWrapped(JSC::JSValue value)
774 {
775     if (auto* wrapper = jsDynamicCast<JSTestTypedefs*>(value))
776         return &wrapper->impl();
777     return nullptr;
778 }
779
780 }