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