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