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