[WebIDL] Remove GetterMayThrowException
[WebKit-https.git] / Source / WebCore / bindings / scripts / test / JS / JSTestCallTracer.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 "JSTestCallTracer.h"
23
24 #include "CallTracer.h"
25 #include "JSDOMAttribute.h"
26 #include "JSDOMBinding.h"
27 #include "JSDOMConstructorNotConstructable.h"
28 #include "JSDOMConvertBoolean.h"
29 #include "JSDOMConvertInterface.h"
30 #include "JSDOMConvertNullable.h"
31 #include "JSDOMConvertNumbers.h"
32 #include "JSDOMConvertStrings.h"
33 #include "JSDOMConvertUnion.h"
34 #include "JSDOMExceptionHandling.h"
35 #include "JSDOMGlobalObject.h"
36 #include "JSDOMOperation.h"
37 #include "JSDOMWrapperCache.h"
38 #include "JSNode.h"
39 #include <runtime/FunctionPrototype.h>
40 #include <runtime/JSCInlines.h>
41 #include <wtf/GetPtr.h>
42 #include <wtf/Variant.h>
43
44 using namespace JSC;
45
46 namespace WebCore {
47
48 // Functions
49
50 JSC::EncodedJSValue JSC_HOST_CALL jsTestCallTracerPrototypeFunctionTestOperationInterface(JSC::ExecState*);
51 JSC::EncodedJSValue JSC_HOST_CALL jsTestCallTracerPrototypeFunctionTestOperationSpecified(JSC::ExecState*);
52 JSC::EncodedJSValue JSC_HOST_CALL jsTestCallTracerPrototypeFunctionTestOperationWithArguments(JSC::ExecState*);
53 JSC::EncodedJSValue JSC_HOST_CALL jsTestCallTracerPrototypeFunctionTestOperationWithNullableArgument(JSC::ExecState*);
54 JSC::EncodedJSValue JSC_HOST_CALL jsTestCallTracerPrototypeFunctionTestOperationWithVariantArgument(JSC::ExecState*);
55 JSC::EncodedJSValue JSC_HOST_CALL jsTestCallTracerPrototypeFunctionTestOperationWithNullableVariantArgument(JSC::ExecState*);
56 JSC::EncodedJSValue JSC_HOST_CALL jsTestCallTracerPrototypeFunctionTestOperationWithOptionalVariantArgument(JSC::ExecState*);
57 JSC::EncodedJSValue JSC_HOST_CALL jsTestCallTracerPrototypeFunctionTestOperationWithDefaultVariantArgument(JSC::ExecState*);
58
59 // Attributes
60
61 JSC::EncodedJSValue jsTestCallTracerConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
62 bool setJSTestCallTracerConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
63 JSC::EncodedJSValue jsTestCallTracerTestAttributeInterface(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
64 bool setJSTestCallTracerTestAttributeInterface(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
65 JSC::EncodedJSValue jsTestCallTracerTestAttributeSpecified(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
66 bool setJSTestCallTracerTestAttributeSpecified(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
67 JSC::EncodedJSValue jsTestCallTracerTestAttributeWithVariant(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
68 bool setJSTestCallTracerTestAttributeWithVariant(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
69 JSC::EncodedJSValue jsTestCallTracerTestReadonlyAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
70
71 class JSTestCallTracerPrototype : public JSC::JSNonFinalObject {
72 public:
73     using Base = JSC::JSNonFinalObject;
74     static JSTestCallTracerPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
75     {
76         JSTestCallTracerPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestCallTracerPrototype>(vm.heap)) JSTestCallTracerPrototype(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     JSTestCallTracerPrototype(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 JSTestCallTracerConstructor = JSDOMConstructorNotConstructable<JSTestCallTracer>;
97
98 /* Hash table for constructor */
99
100 static const HashTableValue JSTestCallTracerConstructorTableValues[] =
101 {
102     { "testConstValue", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(false) } },
103 };
104
105 static_assert(TestCallTracer::testConstValue == false, "testConstValue in TestCallTracer does not match value from IDL");
106
107 template<> JSValue JSTestCallTracerConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
108 {
109     UNUSED_PARAM(vm);
110     return globalObject.functionPrototype();
111 }
112
113 template<> void JSTestCallTracerConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
114 {
115     putDirect(vm, vm.propertyNames->prototype, JSTestCallTracer::prototype(vm, globalObject), DontDelete | ReadOnly | DontEnum);
116     putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("TestCallTracer"))), ReadOnly | DontEnum);
117     putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
118     reifyStaticProperties(vm, JSTestCallTracer::info(), JSTestCallTracerConstructorTableValues, *this);
119 }
120
121 template<> const ClassInfo JSTestCallTracerConstructor::s_info = { "TestCallTracer", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestCallTracerConstructor) };
122
123 /* Hash table for prototype */
124
125 static const HashTableValue JSTestCallTracerPrototypeTableValues[] =
126 {
127     { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestCallTracerConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestCallTracerConstructor) } },
128     { "testAttributeInterface", CustomAccessor | DOMAttribute, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestCallTracerTestAttributeInterface), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestCallTracerTestAttributeInterface) } },
129     { "testAttributeSpecified", CustomAccessor | DOMAttribute, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestCallTracerTestAttributeSpecified), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestCallTracerTestAttributeSpecified) } },
130     { "testAttributeWithVariant", CustomAccessor | DOMAttribute, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestCallTracerTestAttributeWithVariant), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestCallTracerTestAttributeWithVariant) } },
131     { "testReadonlyAttribute", ReadOnly | CustomAccessor | DOMAttribute, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestCallTracerTestReadonlyAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
132     { "testOperationInterface", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestCallTracerPrototypeFunctionTestOperationInterface), (intptr_t) (0) } },
133     { "testOperationSpecified", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestCallTracerPrototypeFunctionTestOperationSpecified), (intptr_t) (0) } },
134     { "testOperationWithArguments", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestCallTracerPrototypeFunctionTestOperationWithArguments), (intptr_t) (3) } },
135     { "testOperationWithNullableArgument", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestCallTracerPrototypeFunctionTestOperationWithNullableArgument), (intptr_t) (1) } },
136     { "testOperationWithVariantArgument", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestCallTracerPrototypeFunctionTestOperationWithVariantArgument), (intptr_t) (1) } },
137     { "testOperationWithNullableVariantArgument", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestCallTracerPrototypeFunctionTestOperationWithNullableVariantArgument), (intptr_t) (1) } },
138     { "testOperationWithOptionalVariantArgument", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestCallTracerPrototypeFunctionTestOperationWithOptionalVariantArgument), (intptr_t) (0) } },
139     { "testOperationWithDefaultVariantArgument", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestCallTracerPrototypeFunctionTestOperationWithDefaultVariantArgument), (intptr_t) (0) } },
140     { "testConstValue", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(false) } },
141 };
142
143 const ClassInfo JSTestCallTracerPrototype::s_info = { "TestCallTracerPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestCallTracerPrototype) };
144
145 void JSTestCallTracerPrototype::finishCreation(VM& vm)
146 {
147     Base::finishCreation(vm);
148     reifyStaticProperties(vm, JSTestCallTracer::info(), JSTestCallTracerPrototypeTableValues, *this);
149 }
150
151 const ClassInfo JSTestCallTracer::s_info = { "TestCallTracer", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestCallTracer) };
152
153 JSTestCallTracer::JSTestCallTracer(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestCallTracer>&& impl)
154     : JSDOMWrapper<TestCallTracer>(structure, globalObject, WTFMove(impl))
155 {
156 }
157
158 void JSTestCallTracer::finishCreation(VM& vm)
159 {
160     Base::finishCreation(vm);
161     ASSERT(inherits(vm, info()));
162
163 }
164
165 JSObject* JSTestCallTracer::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
166 {
167     return JSTestCallTracerPrototype::create(vm, &globalObject, JSTestCallTracerPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
168 }
169
170 JSObject* JSTestCallTracer::prototype(VM& vm, JSDOMGlobalObject& globalObject)
171 {
172     return getDOMPrototype<JSTestCallTracer>(vm, globalObject);
173 }
174
175 JSValue JSTestCallTracer::getConstructor(VM& vm, const JSGlobalObject* globalObject)
176 {
177     return getDOMConstructor<JSTestCallTracerConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
178 }
179
180 void JSTestCallTracer::destroy(JSC::JSCell* cell)
181 {
182     JSTestCallTracer* thisObject = static_cast<JSTestCallTracer*>(cell);
183     thisObject->JSTestCallTracer::~JSTestCallTracer();
184 }
185
186 template<> inline JSTestCallTracer* IDLAttribute<JSTestCallTracer>::cast(ExecState& state, EncodedJSValue thisValue)
187 {
188     return jsDynamicDowncast<JSTestCallTracer*>(state.vm(), JSValue::decode(thisValue));
189 }
190
191 template<> inline JSTestCallTracer* IDLOperation<JSTestCallTracer>::cast(ExecState& state)
192 {
193     return jsDynamicDowncast<JSTestCallTracer*>(state.vm(), state.thisValue());
194 }
195
196 EncodedJSValue jsTestCallTracerConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
197 {
198     VM& vm = state->vm();
199     auto throwScope = DECLARE_THROW_SCOPE(vm);
200     auto* prototype = jsDynamicDowncast<JSTestCallTracerPrototype*>(vm, JSValue::decode(thisValue));
201     if (UNLIKELY(!prototype))
202         return throwVMTypeError(state, throwScope);
203     return JSValue::encode(JSTestCallTracer::getConstructor(state->vm(), prototype->globalObject()));
204 }
205
206 bool setJSTestCallTracerConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
207 {
208     VM& vm = state->vm();
209     auto throwScope = DECLARE_THROW_SCOPE(vm);
210     auto* prototype = jsDynamicDowncast<JSTestCallTracerPrototype*>(vm, JSValue::decode(thisValue));
211     if (UNLIKELY(!prototype)) {
212         throwVMTypeError(state, throwScope);
213         return false;
214     }
215     // Shadowing a built-in constructor
216     return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
217 }
218
219 static inline JSValue jsTestCallTracerTestAttributeInterfaceGetter(ExecState& state, JSTestCallTracer& thisObject, ThrowScope& throwScope)
220 {
221     UNUSED_PARAM(throwScope);
222     UNUSED_PARAM(state);
223     auto& impl = thisObject.wrapped();
224     if (UNLIKELY(impl.callTracingActive()))
225         CallTracer::testCallTracerInterface(impl, ASCIILiteral("testAttributeInterface"));
226     JSValue result = toJS<IDLBoolean>(state, throwScope, impl.testAttributeInterface());
227     return result;
228 }
229
230 EncodedJSValue jsTestCallTracerTestAttributeInterface(ExecState* state, EncodedJSValue thisValue, PropertyName)
231 {
232     return IDLAttribute<JSTestCallTracer>::get<jsTestCallTracerTestAttributeInterfaceGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "testAttributeInterface");
233 }
234
235 static inline bool setJSTestCallTracerTestAttributeInterfaceSetter(ExecState& state, JSTestCallTracer& thisObject, JSValue value, ThrowScope& throwScope)
236 {
237     UNUSED_PARAM(throwScope);
238     auto& impl = thisObject.wrapped();
239     auto nativeValue = convert<IDLBoolean>(state, value);
240     RETURN_IF_EXCEPTION(throwScope, false);
241     if (UNLIKELY(impl.callTracingActive())) {
242         Vector<TestCallTracerInterfaceVariant> callTracerParameters;
243         callTracerParameters.append(nativeValue);
244         CallTracer::testCallTracerInterface(impl, ASCIILiteral("testAttributeInterface"), WTFMove(callTracerParameters));
245     }
246     AttributeSetter::call(state, throwScope, [&] {
247         return impl.setTestAttributeInterface(WTFMove(nativeValue));
248     });
249     return true;
250 }
251
252 bool setJSTestCallTracerTestAttributeInterface(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
253 {
254     return IDLAttribute<JSTestCallTracer>::set<setJSTestCallTracerTestAttributeInterfaceSetter>(*state, thisValue, encodedValue, "testAttributeInterface");
255 }
256
257 static inline JSValue jsTestCallTracerTestAttributeSpecifiedGetter(ExecState& state, JSTestCallTracer& thisObject, ThrowScope& throwScope)
258 {
259     UNUSED_PARAM(throwScope);
260     UNUSED_PARAM(state);
261     auto& impl = thisObject.wrapped();
262     if (UNLIKELY(impl.callTracingActive()))
263         CallTracer::testCallTracerAttribute(impl, ASCIILiteral("testAttributeSpecified"));
264     JSValue result = toJS<IDLBoolean>(state, throwScope, impl.testAttributeSpecified());
265     return result;
266 }
267
268 EncodedJSValue jsTestCallTracerTestAttributeSpecified(ExecState* state, EncodedJSValue thisValue, PropertyName)
269 {
270     return IDLAttribute<JSTestCallTracer>::get<jsTestCallTracerTestAttributeSpecifiedGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "testAttributeSpecified");
271 }
272
273 static inline bool setJSTestCallTracerTestAttributeSpecifiedSetter(ExecState& state, JSTestCallTracer& thisObject, JSValue value, ThrowScope& throwScope)
274 {
275     UNUSED_PARAM(throwScope);
276     auto& impl = thisObject.wrapped();
277     auto nativeValue = convert<IDLBoolean>(state, value);
278     RETURN_IF_EXCEPTION(throwScope, false);
279     if (UNLIKELY(impl.callTracingActive())) {
280         Vector<TestCallTracerAttributeVariant> callTracerParameters;
281         callTracerParameters.append(nativeValue);
282         CallTracer::testCallTracerAttribute(impl, ASCIILiteral("testAttributeSpecified"), WTFMove(callTracerParameters));
283     }
284     AttributeSetter::call(state, throwScope, [&] {
285         return impl.setTestAttributeSpecified(WTFMove(nativeValue));
286     });
287     return true;
288 }
289
290 bool setJSTestCallTracerTestAttributeSpecified(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
291 {
292     return IDLAttribute<JSTestCallTracer>::set<setJSTestCallTracerTestAttributeSpecifiedSetter>(*state, thisValue, encodedValue, "testAttributeSpecified");
293 }
294
295 static inline JSValue jsTestCallTracerTestAttributeWithVariantGetter(ExecState& state, JSTestCallTracer& thisObject, ThrowScope& throwScope)
296 {
297     UNUSED_PARAM(throwScope);
298     UNUSED_PARAM(state);
299     auto& impl = thisObject.wrapped();
300     if (UNLIKELY(impl.callTracingActive()))
301         CallTracer::testCallTracerInterface(impl, ASCIILiteral("testAttributeWithVariant"));
302     JSValue result = toJS<IDLUnion<IDLBoolean, IDLFloat, IDLDOMString>>(state, *thisObject.globalObject(), throwScope, impl.testAttributeWithVariant());
303     return result;
304 }
305
306 EncodedJSValue jsTestCallTracerTestAttributeWithVariant(ExecState* state, EncodedJSValue thisValue, PropertyName)
307 {
308     return IDLAttribute<JSTestCallTracer>::get<jsTestCallTracerTestAttributeWithVariantGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "testAttributeWithVariant");
309 }
310
311 static inline bool setJSTestCallTracerTestAttributeWithVariantSetter(ExecState& state, JSTestCallTracer& thisObject, JSValue value, ThrowScope& throwScope)
312 {
313     UNUSED_PARAM(throwScope);
314     auto& impl = thisObject.wrapped();
315     auto nativeValue = convert<IDLUnion<IDLBoolean, IDLFloat, IDLDOMString>>(state, value);
316     RETURN_IF_EXCEPTION(throwScope, false);
317     if (UNLIKELY(impl.callTracingActive())) {
318         Vector<TestCallTracerInterfaceVariant> callTracerParameters;
319         WTF::visit([&] (auto& value) { callTracerParameters.append(value); }, nativeValue);
320         CallTracer::testCallTracerInterface(impl, ASCIILiteral("testAttributeWithVariant"), WTFMove(callTracerParameters));
321     }
322     AttributeSetter::call(state, throwScope, [&] {
323         return impl.setTestAttributeWithVariant(WTFMove(nativeValue));
324     });
325     return true;
326 }
327
328 bool setJSTestCallTracerTestAttributeWithVariant(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
329 {
330     return IDLAttribute<JSTestCallTracer>::set<setJSTestCallTracerTestAttributeWithVariantSetter>(*state, thisValue, encodedValue, "testAttributeWithVariant");
331 }
332
333 static inline JSValue jsTestCallTracerTestReadonlyAttributeGetter(ExecState& state, JSTestCallTracer& thisObject, ThrowScope& throwScope)
334 {
335     UNUSED_PARAM(throwScope);
336     UNUSED_PARAM(state);
337     auto& impl = thisObject.wrapped();
338     JSValue result = toJS<IDLBoolean>(state, throwScope, impl.testReadonlyAttribute());
339     return result;
340 }
341
342 EncodedJSValue jsTestCallTracerTestReadonlyAttribute(ExecState* state, EncodedJSValue thisValue, PropertyName)
343 {
344     return IDLAttribute<JSTestCallTracer>::get<jsTestCallTracerTestReadonlyAttributeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "testReadonlyAttribute");
345 }
346
347 static inline JSC::EncodedJSValue jsTestCallTracerPrototypeFunctionTestOperationInterfaceBody(JSC::ExecState* state, typename IDLOperation<JSTestCallTracer>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
348 {
349     UNUSED_PARAM(state);
350     UNUSED_PARAM(throwScope);
351     auto& impl = castedThis->wrapped();
352     if (UNLIKELY(impl.callTracingActive()))
353         CallTracer::testCallTracerInterface(impl, ASCIILiteral("testOperationInterface"));
354     impl.testOperationInterface();
355     return JSValue::encode(jsUndefined());
356 }
357
358 EncodedJSValue JSC_HOST_CALL jsTestCallTracerPrototypeFunctionTestOperationInterface(ExecState* state)
359 {
360     return IDLOperation<JSTestCallTracer>::call<jsTestCallTracerPrototypeFunctionTestOperationInterfaceBody>(*state, "testOperationInterface");
361 }
362
363 static inline JSC::EncodedJSValue jsTestCallTracerPrototypeFunctionTestOperationSpecifiedBody(JSC::ExecState* state, typename IDLOperation<JSTestCallTracer>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
364 {
365     UNUSED_PARAM(state);
366     UNUSED_PARAM(throwScope);
367     auto& impl = castedThis->wrapped();
368     if (UNLIKELY(impl.callTracingActive()))
369         CallTracer::testCallTracerOperation(impl, ASCIILiteral("testOperationSpecified"));
370     impl.testOperationSpecified();
371     return JSValue::encode(jsUndefined());
372 }
373
374 EncodedJSValue JSC_HOST_CALL jsTestCallTracerPrototypeFunctionTestOperationSpecified(ExecState* state)
375 {
376     return IDLOperation<JSTestCallTracer>::call<jsTestCallTracerPrototypeFunctionTestOperationSpecifiedBody>(*state, "testOperationSpecified");
377 }
378
379 static inline JSC::EncodedJSValue jsTestCallTracerPrototypeFunctionTestOperationWithArgumentsBody(JSC::ExecState* state, typename IDLOperation<JSTestCallTracer>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
380 {
381     UNUSED_PARAM(state);
382     UNUSED_PARAM(throwScope);
383     auto& impl = castedThis->wrapped();
384     if (UNLIKELY(state->argumentCount() < 3))
385         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
386     auto a = convert<IDLBoolean>(*state, state->uncheckedArgument(0));
387     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
388     auto b = convert<IDLFloat>(*state, state->uncheckedArgument(1));
389     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
390     auto c = convert<IDLDOMString>(*state, state->uncheckedArgument(2));
391     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
392     if (UNLIKELY(impl.callTracingActive())) {
393         Vector<TestCallTracerInterfaceVariant> callTracerParameters;
394         callTracerParameters.append(a);
395         callTracerParameters.append(b);
396         callTracerParameters.append(c);
397         CallTracer::testCallTracerInterface(impl, ASCIILiteral("testOperationWithArguments"), WTFMove(callTracerParameters));
398     }
399     impl.testOperationWithArguments(WTFMove(a), WTFMove(b), WTFMove(c));
400     return JSValue::encode(jsUndefined());
401 }
402
403 EncodedJSValue JSC_HOST_CALL jsTestCallTracerPrototypeFunctionTestOperationWithArguments(ExecState* state)
404 {
405     return IDLOperation<JSTestCallTracer>::call<jsTestCallTracerPrototypeFunctionTestOperationWithArgumentsBody>(*state, "testOperationWithArguments");
406 }
407
408 static inline JSC::EncodedJSValue jsTestCallTracerPrototypeFunctionTestOperationWithNullableArgumentBody(JSC::ExecState* state, typename IDLOperation<JSTestCallTracer>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
409 {
410     UNUSED_PARAM(state);
411     UNUSED_PARAM(throwScope);
412     auto& impl = castedThis->wrapped();
413     if (UNLIKELY(state->argumentCount() < 1))
414         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
415     auto nodeNullableArg = convert<IDLNullable<IDLInterface<Node>>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "nodeNullableArg", "TestCallTracer", "testOperationWithNullableArgument", "Node"); });
416     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
417     if (UNLIKELY(impl.callTracingActive())) {
418         Vector<TestCallTracerInterfaceVariant> callTracerParameters;
419         if (nodeNullableArg)
420             callTracerParameters.append(nodeNullableArg);
421         CallTracer::testCallTracerInterface(impl, ASCIILiteral("testOperationWithNullableArgument"), WTFMove(callTracerParameters));
422     }
423     impl.testOperationWithNullableArgument(WTFMove(nodeNullableArg));
424     return JSValue::encode(jsUndefined());
425 }
426
427 EncodedJSValue JSC_HOST_CALL jsTestCallTracerPrototypeFunctionTestOperationWithNullableArgument(ExecState* state)
428 {
429     return IDLOperation<JSTestCallTracer>::call<jsTestCallTracerPrototypeFunctionTestOperationWithNullableArgumentBody>(*state, "testOperationWithNullableArgument");
430 }
431
432 static inline JSC::EncodedJSValue jsTestCallTracerPrototypeFunctionTestOperationWithVariantArgumentBody(JSC::ExecState* state, typename IDLOperation<JSTestCallTracer>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
433 {
434     UNUSED_PARAM(state);
435     UNUSED_PARAM(throwScope);
436     auto& impl = castedThis->wrapped();
437     if (UNLIKELY(state->argumentCount() < 1))
438         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
439     auto variantArg = convert<IDLUnion<IDLBoolean, IDLFloat, IDLDOMString>>(*state, state->uncheckedArgument(0));
440     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
441     if (UNLIKELY(impl.callTracingActive())) {
442         Vector<TestCallTracerInterfaceVariant> callTracerParameters;
443         WTF::visit([&] (auto& value) { callTracerParameters.append(value); }, variantArg);
444         CallTracer::testCallTracerInterface(impl, ASCIILiteral("testOperationWithVariantArgument"), WTFMove(callTracerParameters));
445     }
446     impl.testOperationWithVariantArgument(WTFMove(variantArg));
447     return JSValue::encode(jsUndefined());
448 }
449
450 EncodedJSValue JSC_HOST_CALL jsTestCallTracerPrototypeFunctionTestOperationWithVariantArgument(ExecState* state)
451 {
452     return IDLOperation<JSTestCallTracer>::call<jsTestCallTracerPrototypeFunctionTestOperationWithVariantArgumentBody>(*state, "testOperationWithVariantArgument");
453 }
454
455 static inline JSC::EncodedJSValue jsTestCallTracerPrototypeFunctionTestOperationWithNullableVariantArgumentBody(JSC::ExecState* state, typename IDLOperation<JSTestCallTracer>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
456 {
457     UNUSED_PARAM(state);
458     UNUSED_PARAM(throwScope);
459     auto& impl = castedThis->wrapped();
460     if (UNLIKELY(state->argumentCount() < 1))
461         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
462     auto variantNullableArg = convert<IDLNullable<IDLUnion<IDLBoolean, IDLFloat, IDLDOMString>>>(*state, state->uncheckedArgument(0));
463     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
464     if (UNLIKELY(impl.callTracingActive())) {
465         Vector<TestCallTracerInterfaceVariant> callTracerParameters;
466         if (variantNullableArg)
467             WTF::visit([&] (auto& value) { callTracerParameters.append(value); }, *variantNullableArg);
468         CallTracer::testCallTracerInterface(impl, ASCIILiteral("testOperationWithNullableVariantArgument"), WTFMove(callTracerParameters));
469     }
470     impl.testOperationWithNullableVariantArgument(WTFMove(variantNullableArg));
471     return JSValue::encode(jsUndefined());
472 }
473
474 EncodedJSValue JSC_HOST_CALL jsTestCallTracerPrototypeFunctionTestOperationWithNullableVariantArgument(ExecState* state)
475 {
476     return IDLOperation<JSTestCallTracer>::call<jsTestCallTracerPrototypeFunctionTestOperationWithNullableVariantArgumentBody>(*state, "testOperationWithNullableVariantArgument");
477 }
478
479 static inline JSC::EncodedJSValue jsTestCallTracerPrototypeFunctionTestOperationWithOptionalVariantArgumentBody(JSC::ExecState* state, typename IDLOperation<JSTestCallTracer>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
480 {
481     UNUSED_PARAM(state);
482     UNUSED_PARAM(throwScope);
483     auto& impl = castedThis->wrapped();
484     auto variantOptionalArg = state->argument(0).isUndefined() ? std::optional<Converter<IDLUnion<IDLBoolean, IDLFloat, IDLDOMString>>::ReturnType>() : std::optional<Converter<IDLUnion<IDLBoolean, IDLFloat, IDLDOMString>>::ReturnType>(convert<IDLUnion<IDLBoolean, IDLFloat, IDLDOMString>>(*state, state->uncheckedArgument(0)));
485     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
486     if (UNLIKELY(impl.callTracingActive())) {
487         Vector<TestCallTracerInterfaceVariant> callTracerParameters;
488         if (variantOptionalArg)
489             WTF::visit([&] (auto& value) { callTracerParameters.append(value); }, *variantOptionalArg);
490         CallTracer::testCallTracerInterface(impl, ASCIILiteral("testOperationWithOptionalVariantArgument"), WTFMove(callTracerParameters));
491     }
492     impl.testOperationWithOptionalVariantArgument(WTFMove(variantOptionalArg));
493     return JSValue::encode(jsUndefined());
494 }
495
496 EncodedJSValue JSC_HOST_CALL jsTestCallTracerPrototypeFunctionTestOperationWithOptionalVariantArgument(ExecState* state)
497 {
498     return IDLOperation<JSTestCallTracer>::call<jsTestCallTracerPrototypeFunctionTestOperationWithOptionalVariantArgumentBody>(*state, "testOperationWithOptionalVariantArgument");
499 }
500
501 static inline JSC::EncodedJSValue jsTestCallTracerPrototypeFunctionTestOperationWithDefaultVariantArgumentBody(JSC::ExecState* state, typename IDLOperation<JSTestCallTracer>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
502 {
503     UNUSED_PARAM(state);
504     UNUSED_PARAM(throwScope);
505     auto& impl = castedThis->wrapped();
506     auto variantDefaultArg = state->argument(0).isUndefined() ? "" : convert<IDLUnion<IDLBoolean, IDLFloat, IDLDOMString>>(*state, state->uncheckedArgument(0));
507     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
508     if (UNLIKELY(impl.callTracingActive())) {
509         Vector<TestCallTracerInterfaceVariant> callTracerParameters;
510         WTF::visit([&] (auto& value) { callTracerParameters.append(value); }, variantDefaultArg);
511         CallTracer::testCallTracerInterface(impl, ASCIILiteral("testOperationWithDefaultVariantArgument"), WTFMove(callTracerParameters));
512     }
513     impl.testOperationWithDefaultVariantArgument(WTFMove(variantDefaultArg));
514     return JSValue::encode(jsUndefined());
515 }
516
517 EncodedJSValue JSC_HOST_CALL jsTestCallTracerPrototypeFunctionTestOperationWithDefaultVariantArgument(ExecState* state)
518 {
519     return IDLOperation<JSTestCallTracer>::call<jsTestCallTracerPrototypeFunctionTestOperationWithDefaultVariantArgumentBody>(*state, "testOperationWithDefaultVariantArgument");
520 }
521
522 bool JSTestCallTracerOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
523 {
524     UNUSED_PARAM(handle);
525     UNUSED_PARAM(visitor);
526     return false;
527 }
528
529 void JSTestCallTracerOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
530 {
531     auto* jsTestCallTracer = static_cast<JSTestCallTracer*>(handle.slot()->asCell());
532     auto& world = *static_cast<DOMWrapperWorld*>(context);
533     uncacheWrapper(world, &jsTestCallTracer->wrapped(), jsTestCallTracer);
534 }
535
536 #if ENABLE(BINDING_INTEGRITY)
537 #if PLATFORM(WIN)
538 #pragma warning(disable: 4483)
539 extern "C" { extern void (*const __identifier("??_7TestCallTracer@WebCore@@6B@")[])(); }
540 #else
541 extern "C" { extern void* _ZTVN7WebCore14TestCallTracerE[]; }
542 #endif
543 #endif
544
545 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestCallTracer>&& impl)
546 {
547
548 #if ENABLE(BINDING_INTEGRITY)
549     void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
550 #if PLATFORM(WIN)
551     void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestCallTracer@WebCore@@6B@"));
552 #else
553     void* expectedVTablePointer = &_ZTVN7WebCore14TestCallTracerE[2];
554 #endif
555
556     // If this fails TestCallTracer does not have a vtable, so you need to add the
557     // ImplementationLacksVTable attribute to the interface definition
558     static_assert(std::is_polymorphic<TestCallTracer>::value, "TestCallTracer is not polymorphic");
559
560     // If you hit this assertion you either have a use after free bug, or
561     // TestCallTracer has subclasses. If TestCallTracer has subclasses that get passed
562     // to toJS() we currently require TestCallTracer you to opt out of binding hardening
563     // by adding the SkipVTableValidation attribute to the interface IDL definition
564     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
565 #endif
566     return createWrapper<TestCallTracer>(globalObject, WTFMove(impl));
567 }
568
569 JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestCallTracer& impl)
570 {
571     return wrap(state, globalObject, impl);
572 }
573
574 TestCallTracer* JSTestCallTracer::toWrapped(JSC::VM& vm, JSC::JSValue value)
575 {
576     if (auto* wrapper = jsDynamicDowncast<JSTestCallTracer*>(vm, value))
577         return &wrapper->wrapped();
578     return nullptr;
579 }
580
581 }