Generated serializers do not properly handle optional interface attributes
[WebKit-https.git] / Source / WebCore / bindings / scripts / test / JS / JSTestSerialization.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 "JSTestSerialization.h"
23
24 #include "JSDOMAttribute.h"
25 #include "JSDOMBinding.h"
26 #include "JSDOMConstructorNotConstructable.h"
27 #include "JSDOMConvertInterface.h"
28 #include "JSDOMConvertNullable.h"
29 #include "JSDOMConvertNumbers.h"
30 #include "JSDOMConvertStrings.h"
31 #include "JSDOMExceptionHandling.h"
32 #include "JSDOMGlobalObject.h"
33 #include "JSDOMOperation.h"
34 #include "JSDOMWrapperCache.h"
35 #include "JSTestException.h"
36 #include "JSTestSerializationIndirectInheritance.h"
37 #include "JSTestSerializationInheritFinal.h"
38 #include <runtime/FunctionPrototype.h>
39 #include <runtime/JSCInlines.h>
40 #include <runtime/ObjectConstructor.h>
41 #include <wtf/GetPtr.h>
42
43
44 namespace WebCore {
45 using namespace JSC;
46
47 // Functions
48
49 JSC::EncodedJSValue JSC_HOST_CALL jsTestSerializationPrototypeFunctionToJSON(JSC::ExecState*);
50
51 // Attributes
52
53 JSC::EncodedJSValue jsTestSerializationConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
54 bool setJSTestSerializationConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
55 JSC::EncodedJSValue jsTestSerializationFirstStringAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
56 bool setJSTestSerializationFirstStringAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
57 JSC::EncodedJSValue jsTestSerializationSecondLongAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
58 bool setJSTestSerializationSecondLongAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
59 JSC::EncodedJSValue jsTestSerializationThirdUnserializableAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
60 bool setJSTestSerializationThirdUnserializableAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
61 JSC::EncodedJSValue jsTestSerializationFourthUnrestrictedDoubleAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
62 bool setJSTestSerializationFourthUnrestrictedDoubleAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
63 JSC::EncodedJSValue jsTestSerializationFifthLongAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
64 bool setJSTestSerializationFifthLongAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
65 JSC::EncodedJSValue jsTestSerializationSixthTypedefAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
66 bool setJSTestSerializationSixthTypedefAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
67 JSC::EncodedJSValue jsTestSerializationSeventhDirectlySerializableAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
68 bool setJSTestSerializationSeventhDirectlySerializableAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
69 JSC::EncodedJSValue jsTestSerializationEighthIndirectlyAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
70 bool setJSTestSerializationEighthIndirectlyAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
71 JSC::EncodedJSValue jsTestSerializationNinthOptionalDirectlySerializableAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
72 bool setJSTestSerializationNinthOptionalDirectlySerializableAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
73
74 class JSTestSerializationPrototype : public JSC::JSNonFinalObject {
75 public:
76     using Base = JSC::JSNonFinalObject;
77     static JSTestSerializationPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
78     {
79         JSTestSerializationPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestSerializationPrototype>(vm.heap)) JSTestSerializationPrototype(vm, globalObject, structure);
80         ptr->finishCreation(vm);
81         return ptr;
82     }
83
84     DECLARE_INFO;
85     static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
86     {
87         return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
88     }
89
90 private:
91     JSTestSerializationPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
92         : JSC::JSNonFinalObject(vm, structure)
93     {
94     }
95
96     void finishCreation(JSC::VM&);
97 };
98
99 using JSTestSerializationConstructor = JSDOMConstructorNotConstructable<JSTestSerialization>;
100
101 template<> JSValue JSTestSerializationConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
102 {
103     UNUSED_PARAM(vm);
104     return globalObject.functionPrototype();
105 }
106
107 template<> void JSTestSerializationConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
108 {
109     putDirect(vm, vm.propertyNames->prototype, JSTestSerialization::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
110     putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("TestSerialization"))), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
111     putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
112 }
113
114 template<> const ClassInfo JSTestSerializationConstructor::s_info = { "TestSerialization", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestSerializationConstructor) };
115
116 /* Hash table for prototype */
117
118 static const HashTableValue JSTestSerializationPrototypeTableValues[] =
119 {
120     { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializationConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestSerializationConstructor) } },
121     { "firstStringAttribute", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializationFirstStringAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestSerializationFirstStringAttribute) } },
122     { "secondLongAttribute", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializationSecondLongAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestSerializationSecondLongAttribute) } },
123     { "thirdUnserializableAttribute", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializationThirdUnserializableAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestSerializationThirdUnserializableAttribute) } },
124     { "fourthUnrestrictedDoubleAttribute", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializationFourthUnrestrictedDoubleAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestSerializationFourthUnrestrictedDoubleAttribute) } },
125     { "fifthLongAttribute", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializationFifthLongAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestSerializationFifthLongAttribute) } },
126     { "sixthTypedefAttribute", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializationSixthTypedefAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestSerializationSixthTypedefAttribute) } },
127     { "seventhDirectlySerializableAttribute", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializationSeventhDirectlySerializableAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestSerializationSeventhDirectlySerializableAttribute) } },
128     { "eighthIndirectlyAttribute", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializationEighthIndirectlyAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestSerializationEighthIndirectlyAttribute) } },
129     { "ninthOptionalDirectlySerializableAttribute", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializationNinthOptionalDirectlySerializableAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestSerializationNinthOptionalDirectlySerializableAttribute) } },
130     { "toJSON", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestSerializationPrototypeFunctionToJSON), (intptr_t) (0) } },
131 };
132
133 const ClassInfo JSTestSerializationPrototype::s_info = { "TestSerializationPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestSerializationPrototype) };
134
135 void JSTestSerializationPrototype::finishCreation(VM& vm)
136 {
137     Base::finishCreation(vm);
138     reifyStaticProperties(vm, JSTestSerialization::info(), JSTestSerializationPrototypeTableValues, *this);
139 }
140
141 const ClassInfo JSTestSerialization::s_info = { "TestSerialization", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestSerialization) };
142
143 JSTestSerialization::JSTestSerialization(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestSerialization>&& impl)
144     : JSDOMWrapper<TestSerialization>(structure, globalObject, WTFMove(impl))
145 {
146 }
147
148 void JSTestSerialization::finishCreation(VM& vm)
149 {
150     Base::finishCreation(vm);
151     ASSERT(inherits(vm, info()));
152
153 }
154
155 JSObject* JSTestSerialization::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
156 {
157     return JSTestSerializationPrototype::create(vm, &globalObject, JSTestSerializationPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
158 }
159
160 JSObject* JSTestSerialization::prototype(VM& vm, JSDOMGlobalObject& globalObject)
161 {
162     return getDOMPrototype<JSTestSerialization>(vm, globalObject);
163 }
164
165 JSValue JSTestSerialization::getConstructor(VM& vm, const JSGlobalObject* globalObject)
166 {
167     return getDOMConstructor<JSTestSerializationConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
168 }
169
170 void JSTestSerialization::destroy(JSC::JSCell* cell)
171 {
172     JSTestSerialization* thisObject = static_cast<JSTestSerialization*>(cell);
173     thisObject->JSTestSerialization::~JSTestSerialization();
174 }
175
176 template<> inline JSTestSerialization* IDLAttribute<JSTestSerialization>::cast(ExecState& state, EncodedJSValue thisValue)
177 {
178     return jsDynamicDowncast<JSTestSerialization*>(state.vm(), JSValue::decode(thisValue));
179 }
180
181 template<> inline JSTestSerialization* IDLOperation<JSTestSerialization>::cast(ExecState& state)
182 {
183     return jsDynamicDowncast<JSTestSerialization*>(state.vm(), state.thisValue());
184 }
185
186 EncodedJSValue jsTestSerializationConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
187 {
188     VM& vm = state->vm();
189     auto throwScope = DECLARE_THROW_SCOPE(vm);
190     auto* prototype = jsDynamicDowncast<JSTestSerializationPrototype*>(vm, JSValue::decode(thisValue));
191     if (UNLIKELY(!prototype))
192         return throwVMTypeError(state, throwScope);
193     return JSValue::encode(JSTestSerialization::getConstructor(state->vm(), prototype->globalObject()));
194 }
195
196 bool setJSTestSerializationConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
197 {
198     VM& vm = state->vm();
199     auto throwScope = DECLARE_THROW_SCOPE(vm);
200     auto* prototype = jsDynamicDowncast<JSTestSerializationPrototype*>(vm, JSValue::decode(thisValue));
201     if (UNLIKELY(!prototype)) {
202         throwVMTypeError(state, throwScope);
203         return false;
204     }
205     // Shadowing a built-in constructor
206     return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
207 }
208
209 static inline JSValue jsTestSerializationFirstStringAttributeGetter(ExecState& state, JSTestSerialization& thisObject, ThrowScope& throwScope)
210 {
211     UNUSED_PARAM(throwScope);
212     UNUSED_PARAM(state);
213     auto& impl = thisObject.wrapped();
214     JSValue result = toJS<IDLDOMString>(state, throwScope, impl.firstStringAttribute());
215     return result;
216 }
217
218 EncodedJSValue jsTestSerializationFirstStringAttribute(ExecState* state, EncodedJSValue thisValue, PropertyName)
219 {
220     return IDLAttribute<JSTestSerialization>::get<jsTestSerializationFirstStringAttributeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "firstStringAttribute");
221 }
222
223 static inline bool setJSTestSerializationFirstStringAttributeSetter(ExecState& state, JSTestSerialization& thisObject, JSValue value, ThrowScope& throwScope)
224 {
225     UNUSED_PARAM(throwScope);
226     auto& impl = thisObject.wrapped();
227     auto nativeValue = convert<IDLDOMString>(state, value);
228     RETURN_IF_EXCEPTION(throwScope, false);
229     AttributeSetter::call(state, throwScope, [&] {
230         return impl.setFirstStringAttribute(WTFMove(nativeValue));
231     });
232     return true;
233 }
234
235 bool setJSTestSerializationFirstStringAttribute(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
236 {
237     return IDLAttribute<JSTestSerialization>::set<setJSTestSerializationFirstStringAttributeSetter>(*state, thisValue, encodedValue, "firstStringAttribute");
238 }
239
240 static inline JSValue jsTestSerializationSecondLongAttributeGetter(ExecState& state, JSTestSerialization& thisObject, ThrowScope& throwScope)
241 {
242     UNUSED_PARAM(throwScope);
243     UNUSED_PARAM(state);
244     auto& impl = thisObject.wrapped();
245     JSValue result = toJS<IDLLong>(state, throwScope, impl.secondLongAttribute());
246     return result;
247 }
248
249 EncodedJSValue jsTestSerializationSecondLongAttribute(ExecState* state, EncodedJSValue thisValue, PropertyName)
250 {
251     return IDLAttribute<JSTestSerialization>::get<jsTestSerializationSecondLongAttributeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "secondLongAttribute");
252 }
253
254 static inline bool setJSTestSerializationSecondLongAttributeSetter(ExecState& state, JSTestSerialization& thisObject, JSValue value, ThrowScope& throwScope)
255 {
256     UNUSED_PARAM(throwScope);
257     auto& impl = thisObject.wrapped();
258     auto nativeValue = convert<IDLLong>(state, value);
259     RETURN_IF_EXCEPTION(throwScope, false);
260     AttributeSetter::call(state, throwScope, [&] {
261         return impl.setSecondLongAttribute(WTFMove(nativeValue));
262     });
263     return true;
264 }
265
266 bool setJSTestSerializationSecondLongAttribute(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
267 {
268     return IDLAttribute<JSTestSerialization>::set<setJSTestSerializationSecondLongAttributeSetter>(*state, thisValue, encodedValue, "secondLongAttribute");
269 }
270
271 static inline JSValue jsTestSerializationThirdUnserializableAttributeGetter(ExecState& state, JSTestSerialization& thisObject, ThrowScope& throwScope)
272 {
273     UNUSED_PARAM(throwScope);
274     UNUSED_PARAM(state);
275     auto& impl = thisObject.wrapped();
276     JSValue result = toJS<IDLInterface<TestException>>(state, *thisObject.globalObject(), throwScope, impl.thirdUnserializableAttribute());
277     return result;
278 }
279
280 EncodedJSValue jsTestSerializationThirdUnserializableAttribute(ExecState* state, EncodedJSValue thisValue, PropertyName)
281 {
282     return IDLAttribute<JSTestSerialization>::get<jsTestSerializationThirdUnserializableAttributeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "thirdUnserializableAttribute");
283 }
284
285 static inline bool setJSTestSerializationThirdUnserializableAttributeSetter(ExecState& state, JSTestSerialization& thisObject, JSValue value, ThrowScope& throwScope)
286 {
287     UNUSED_PARAM(throwScope);
288     auto& impl = thisObject.wrapped();
289     auto nativeValue = convert<IDLInterface<TestException>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestSerialization", "thirdUnserializableAttribute", "TestException"); });
290     RETURN_IF_EXCEPTION(throwScope, false);
291     AttributeSetter::call(state, throwScope, [&] {
292         return impl.setThirdUnserializableAttribute(*nativeValue);
293     });
294     return true;
295 }
296
297 bool setJSTestSerializationThirdUnserializableAttribute(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
298 {
299     return IDLAttribute<JSTestSerialization>::set<setJSTestSerializationThirdUnserializableAttributeSetter>(*state, thisValue, encodedValue, "thirdUnserializableAttribute");
300 }
301
302 static inline JSValue jsTestSerializationFourthUnrestrictedDoubleAttributeGetter(ExecState& state, JSTestSerialization& thisObject, ThrowScope& throwScope)
303 {
304     UNUSED_PARAM(throwScope);
305     UNUSED_PARAM(state);
306     auto& impl = thisObject.wrapped();
307     JSValue result = toJS<IDLUnrestrictedDouble>(state, throwScope, impl.fourthUnrestrictedDoubleAttribute());
308     return result;
309 }
310
311 EncodedJSValue jsTestSerializationFourthUnrestrictedDoubleAttribute(ExecState* state, EncodedJSValue thisValue, PropertyName)
312 {
313     return IDLAttribute<JSTestSerialization>::get<jsTestSerializationFourthUnrestrictedDoubleAttributeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "fourthUnrestrictedDoubleAttribute");
314 }
315
316 static inline bool setJSTestSerializationFourthUnrestrictedDoubleAttributeSetter(ExecState& state, JSTestSerialization& thisObject, JSValue value, ThrowScope& throwScope)
317 {
318     UNUSED_PARAM(throwScope);
319     auto& impl = thisObject.wrapped();
320     auto nativeValue = convert<IDLUnrestrictedDouble>(state, value);
321     RETURN_IF_EXCEPTION(throwScope, false);
322     AttributeSetter::call(state, throwScope, [&] {
323         return impl.setFourthUnrestrictedDoubleAttribute(WTFMove(nativeValue));
324     });
325     return true;
326 }
327
328 bool setJSTestSerializationFourthUnrestrictedDoubleAttribute(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
329 {
330     return IDLAttribute<JSTestSerialization>::set<setJSTestSerializationFourthUnrestrictedDoubleAttributeSetter>(*state, thisValue, encodedValue, "fourthUnrestrictedDoubleAttribute");
331 }
332
333 static inline JSValue jsTestSerializationFifthLongAttributeGetter(ExecState& state, JSTestSerialization& thisObject, ThrowScope& throwScope)
334 {
335     UNUSED_PARAM(throwScope);
336     UNUSED_PARAM(state);
337     auto& impl = thisObject.wrapped();
338     JSValue result = toJS<IDLLong>(state, throwScope, impl.fifthLongAttribute());
339     return result;
340 }
341
342 EncodedJSValue jsTestSerializationFifthLongAttribute(ExecState* state, EncodedJSValue thisValue, PropertyName)
343 {
344     return IDLAttribute<JSTestSerialization>::get<jsTestSerializationFifthLongAttributeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "fifthLongAttribute");
345 }
346
347 static inline bool setJSTestSerializationFifthLongAttributeSetter(ExecState& state, JSTestSerialization& thisObject, JSValue value, ThrowScope& throwScope)
348 {
349     UNUSED_PARAM(throwScope);
350     auto& impl = thisObject.wrapped();
351     auto nativeValue = convert<IDLLong>(state, value);
352     RETURN_IF_EXCEPTION(throwScope, false);
353     AttributeSetter::call(state, throwScope, [&] {
354         return impl.setFifthLongAttribute(WTFMove(nativeValue));
355     });
356     return true;
357 }
358
359 bool setJSTestSerializationFifthLongAttribute(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
360 {
361     return IDLAttribute<JSTestSerialization>::set<setJSTestSerializationFifthLongAttributeSetter>(*state, thisValue, encodedValue, "fifthLongAttribute");
362 }
363
364 static inline JSValue jsTestSerializationSixthTypedefAttributeGetter(ExecState& state, JSTestSerialization& thisObject, ThrowScope& throwScope)
365 {
366     UNUSED_PARAM(throwScope);
367     UNUSED_PARAM(state);
368     auto& impl = thisObject.wrapped();
369     JSValue result = toJS<IDLDouble>(state, throwScope, impl.sixthTypedefAttribute());
370     return result;
371 }
372
373 EncodedJSValue jsTestSerializationSixthTypedefAttribute(ExecState* state, EncodedJSValue thisValue, PropertyName)
374 {
375     return IDLAttribute<JSTestSerialization>::get<jsTestSerializationSixthTypedefAttributeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "sixthTypedefAttribute");
376 }
377
378 static inline bool setJSTestSerializationSixthTypedefAttributeSetter(ExecState& state, JSTestSerialization& thisObject, JSValue value, ThrowScope& throwScope)
379 {
380     UNUSED_PARAM(throwScope);
381     auto& impl = thisObject.wrapped();
382     auto nativeValue = convert<IDLDouble>(state, value);
383     RETURN_IF_EXCEPTION(throwScope, false);
384     AttributeSetter::call(state, throwScope, [&] {
385         return impl.setSixthTypedefAttribute(WTFMove(nativeValue));
386     });
387     return true;
388 }
389
390 bool setJSTestSerializationSixthTypedefAttribute(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
391 {
392     return IDLAttribute<JSTestSerialization>::set<setJSTestSerializationSixthTypedefAttributeSetter>(*state, thisValue, encodedValue, "sixthTypedefAttribute");
393 }
394
395 static inline JSValue jsTestSerializationSeventhDirectlySerializableAttributeGetter(ExecState& state, JSTestSerialization& thisObject, ThrowScope& throwScope)
396 {
397     UNUSED_PARAM(throwScope);
398     UNUSED_PARAM(state);
399     auto& impl = thisObject.wrapped();
400     JSValue result = toJS<IDLInterface<TestSerializationInheritFinal>>(state, *thisObject.globalObject(), throwScope, impl.seventhDirectlySerializableAttribute());
401     return result;
402 }
403
404 EncodedJSValue jsTestSerializationSeventhDirectlySerializableAttribute(ExecState* state, EncodedJSValue thisValue, PropertyName)
405 {
406     return IDLAttribute<JSTestSerialization>::get<jsTestSerializationSeventhDirectlySerializableAttributeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "seventhDirectlySerializableAttribute");
407 }
408
409 static inline bool setJSTestSerializationSeventhDirectlySerializableAttributeSetter(ExecState& state, JSTestSerialization& thisObject, JSValue value, ThrowScope& throwScope)
410 {
411     UNUSED_PARAM(throwScope);
412     auto& impl = thisObject.wrapped();
413     auto nativeValue = convert<IDLInterface<TestSerializationInheritFinal>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestSerialization", "seventhDirectlySerializableAttribute", "TestSerializationInheritFinal"); });
414     RETURN_IF_EXCEPTION(throwScope, false);
415     AttributeSetter::call(state, throwScope, [&] {
416         return impl.setSeventhDirectlySerializableAttribute(*nativeValue);
417     });
418     return true;
419 }
420
421 bool setJSTestSerializationSeventhDirectlySerializableAttribute(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
422 {
423     return IDLAttribute<JSTestSerialization>::set<setJSTestSerializationSeventhDirectlySerializableAttributeSetter>(*state, thisValue, encodedValue, "seventhDirectlySerializableAttribute");
424 }
425
426 static inline JSValue jsTestSerializationEighthIndirectlyAttributeGetter(ExecState& state, JSTestSerialization& thisObject, ThrowScope& throwScope)
427 {
428     UNUSED_PARAM(throwScope);
429     UNUSED_PARAM(state);
430     auto& impl = thisObject.wrapped();
431     JSValue result = toJS<IDLInterface<TestSerializationIndirectInheritance>>(state, *thisObject.globalObject(), throwScope, impl.eighthIndirectlyAttribute());
432     return result;
433 }
434
435 EncodedJSValue jsTestSerializationEighthIndirectlyAttribute(ExecState* state, EncodedJSValue thisValue, PropertyName)
436 {
437     return IDLAttribute<JSTestSerialization>::get<jsTestSerializationEighthIndirectlyAttributeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "eighthIndirectlyAttribute");
438 }
439
440 static inline bool setJSTestSerializationEighthIndirectlyAttributeSetter(ExecState& state, JSTestSerialization& thisObject, JSValue value, ThrowScope& throwScope)
441 {
442     UNUSED_PARAM(throwScope);
443     auto& impl = thisObject.wrapped();
444     auto nativeValue = convert<IDLInterface<TestSerializationIndirectInheritance>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestSerialization", "eighthIndirectlyAttribute", "TestSerializationIndirectInheritance"); });
445     RETURN_IF_EXCEPTION(throwScope, false);
446     AttributeSetter::call(state, throwScope, [&] {
447         return impl.setEighthIndirectlyAttribute(*nativeValue);
448     });
449     return true;
450 }
451
452 bool setJSTestSerializationEighthIndirectlyAttribute(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
453 {
454     return IDLAttribute<JSTestSerialization>::set<setJSTestSerializationEighthIndirectlyAttributeSetter>(*state, thisValue, encodedValue, "eighthIndirectlyAttribute");
455 }
456
457 static inline JSValue jsTestSerializationNinthOptionalDirectlySerializableAttributeGetter(ExecState& state, JSTestSerialization& thisObject, ThrowScope& throwScope)
458 {
459     UNUSED_PARAM(throwScope);
460     UNUSED_PARAM(state);
461     auto& impl = thisObject.wrapped();
462     JSValue result = toJS<IDLNullable<IDLInterface<TestSerializationInheritFinal>>>(state, *thisObject.globalObject(), throwScope, impl.ninthOptionalDirectlySerializableAttribute());
463     return result;
464 }
465
466 EncodedJSValue jsTestSerializationNinthOptionalDirectlySerializableAttribute(ExecState* state, EncodedJSValue thisValue, PropertyName)
467 {
468     return IDLAttribute<JSTestSerialization>::get<jsTestSerializationNinthOptionalDirectlySerializableAttributeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "ninthOptionalDirectlySerializableAttribute");
469 }
470
471 static inline bool setJSTestSerializationNinthOptionalDirectlySerializableAttributeSetter(ExecState& state, JSTestSerialization& thisObject, JSValue value, ThrowScope& throwScope)
472 {
473     UNUSED_PARAM(throwScope);
474     auto& impl = thisObject.wrapped();
475     auto nativeValue = convert<IDLNullable<IDLInterface<TestSerializationInheritFinal>>>(state, value, [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwAttributeTypeError(state, scope, "TestSerialization", "ninthOptionalDirectlySerializableAttribute", "TestSerializationInheritFinal"); });
476     RETURN_IF_EXCEPTION(throwScope, false);
477     AttributeSetter::call(state, throwScope, [&] {
478         return impl.setNinthOptionalDirectlySerializableAttribute(WTFMove(nativeValue));
479     });
480     return true;
481 }
482
483 bool setJSTestSerializationNinthOptionalDirectlySerializableAttribute(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
484 {
485     return IDLAttribute<JSTestSerialization>::set<setJSTestSerializationNinthOptionalDirectlySerializableAttributeSetter>(*state, thisValue, encodedValue, "ninthOptionalDirectlySerializableAttribute");
486 }
487
488 JSC::JSObject* JSTestSerialization::serialize(ExecState& state, JSTestSerialization& thisObject, JSDOMGlobalObject& globalObject, ThrowScope& throwScope)
489 {
490     auto& vm = state.vm();
491     auto* result = constructEmptyObject(&state, globalObject.objectPrototype());
492
493     auto firstStringAttributeValue = jsTestSerializationFirstStringAttributeGetter(state, thisObject, throwScope);
494     throwScope.assertNoException();
495     result->putDirect(vm, Identifier::fromString(&vm, "firstStringAttribute"), firstStringAttributeValue);
496
497     auto secondLongAttributeValue = jsTestSerializationSecondLongAttributeGetter(state, thisObject, throwScope);
498     throwScope.assertNoException();
499     result->putDirect(vm, Identifier::fromString(&vm, "secondLongAttribute"), secondLongAttributeValue);
500
501     auto fourthUnrestrictedDoubleAttributeValue = jsTestSerializationFourthUnrestrictedDoubleAttributeGetter(state, thisObject, throwScope);
502     throwScope.assertNoException();
503     result->putDirect(vm, Identifier::fromString(&vm, "fourthUnrestrictedDoubleAttribute"), fourthUnrestrictedDoubleAttributeValue);
504
505     auto fifthLongAttributeValue = jsTestSerializationFifthLongAttributeGetter(state, thisObject, throwScope);
506     throwScope.assertNoException();
507     result->putDirect(vm, Identifier::fromString(&vm, "fifthLongAttribute"), fifthLongAttributeValue);
508
509     auto sixthTypedefAttributeValue = jsTestSerializationSixthTypedefAttributeGetter(state, thisObject, throwScope);
510     throwScope.assertNoException();
511     result->putDirect(vm, Identifier::fromString(&vm, "sixthTypedefAttribute"), sixthTypedefAttributeValue);
512
513     auto seventhDirectlySerializableAttributeValue = jsTestSerializationSeventhDirectlySerializableAttributeGetter(state, thisObject, throwScope);
514     throwScope.assertNoException();
515     auto* seventhDirectlySerializableAttributeSerializedValue = JSTestSerializationInheritFinal::serialize(state, *jsCast<JSTestSerializationInheritFinal*>(seventhDirectlySerializableAttributeValue), globalObject, throwScope);
516     result->putDirect(vm, Identifier::fromString(&vm, "seventhDirectlySerializableAttribute"), seventhDirectlySerializableAttributeSerializedValue);
517
518     auto eighthIndirectlyAttributeValue = jsTestSerializationEighthIndirectlyAttributeGetter(state, thisObject, throwScope);
519     throwScope.assertNoException();
520     auto* eighthIndirectlyAttributeSerializedValue = JSTestSerializationIndirectInheritance::serialize(state, *jsCast<JSTestSerializationIndirectInheritance*>(eighthIndirectlyAttributeValue), globalObject, throwScope);
521     result->putDirect(vm, Identifier::fromString(&vm, "eighthIndirectlyAttribute"), eighthIndirectlyAttributeSerializedValue);
522
523     auto ninthOptionalDirectlySerializableAttributeValue = jsTestSerializationNinthOptionalDirectlySerializableAttributeGetter(state, thisObject, throwScope);
524     throwScope.assertNoException();
525     if (!ninthOptionalDirectlySerializableAttributeValue.isNull()) {
526         auto* ninthOptionalDirectlySerializableAttributeSerializedValue = JSTestSerializationInheritFinal::serialize(state, *jsCast<JSTestSerializationInheritFinal*>(ninthOptionalDirectlySerializableAttributeValue), globalObject, throwScope);
527         result->putDirect(vm, Identifier::fromString(&vm, "ninthOptionalDirectlySerializableAttribute"), ninthOptionalDirectlySerializableAttributeSerializedValue);
528     } else
529         result->putDirect(vm, Identifier::fromString(&vm, "ninthOptionalDirectlySerializableAttribute"), ninthOptionalDirectlySerializableAttributeValue);
530
531     return result;
532 }
533
534 static inline EncodedJSValue jsTestSerializationPrototypeFunctionToJSONBody(ExecState* state, JSTestSerialization* thisObject, JSC::ThrowScope& throwScope)
535 {
536     return JSValue::encode(JSTestSerialization::serialize(*state, *thisObject, *thisObject->globalObject(), throwScope));
537 }
538
539 EncodedJSValue JSC_HOST_CALL jsTestSerializationPrototypeFunctionToJSON(ExecState* state)
540 {
541     return IDLOperation<JSTestSerialization>::call<jsTestSerializationPrototypeFunctionToJSONBody>(*state, "toJSON");
542 }
543
544 bool JSTestSerializationOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
545 {
546     UNUSED_PARAM(handle);
547     UNUSED_PARAM(visitor);
548     return false;
549 }
550
551 void JSTestSerializationOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
552 {
553     auto* jsTestSerialization = static_cast<JSTestSerialization*>(handle.slot()->asCell());
554     auto& world = *static_cast<DOMWrapperWorld*>(context);
555     uncacheWrapper(world, &jsTestSerialization->wrapped(), jsTestSerialization);
556 }
557
558 #if ENABLE(BINDING_INTEGRITY)
559 #if PLATFORM(WIN)
560 #pragma warning(disable: 4483)
561 extern "C" { extern void (*const __identifier("??_7TestSerialization@WebCore@@6B@")[])(); }
562 #else
563 extern "C" { extern void* _ZTVN7WebCore17TestSerializationE[]; }
564 #endif
565 #endif
566
567 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestSerialization>&& impl)
568 {
569
570 #if ENABLE(BINDING_INTEGRITY)
571     void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
572 #if PLATFORM(WIN)
573     void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestSerialization@WebCore@@6B@"));
574 #else
575     void* expectedVTablePointer = &_ZTVN7WebCore17TestSerializationE[2];
576 #endif
577
578     // If this fails TestSerialization does not have a vtable, so you need to add the
579     // ImplementationLacksVTable attribute to the interface definition
580     static_assert(std::is_polymorphic<TestSerialization>::value, "TestSerialization is not polymorphic");
581
582     // If you hit this assertion you either have a use after free bug, or
583     // TestSerialization has subclasses. If TestSerialization has subclasses that get passed
584     // to toJS() we currently require TestSerialization you to opt out of binding hardening
585     // by adding the SkipVTableValidation attribute to the interface IDL definition
586     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
587 #endif
588     return createWrapper<TestSerialization>(globalObject, WTFMove(impl));
589 }
590
591 JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestSerialization& impl)
592 {
593     return wrap(state, globalObject, impl);
594 }
595
596 TestSerialization* JSTestSerialization::toWrapped(JSC::VM& vm, JSC::JSValue value)
597 {
598     if (auto* wrapper = jsDynamicDowncast<JSTestSerialization*>(vm, value))
599         return &wrapper->wrapped();
600     return nullptr;
601 }
602
603 }