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