[WebIDL] Overloaded functions should throw this object check exception before argumen...
[WebKit-https.git] / Source / WebCore / bindings / scripts / test / JS / JSTestSerializedScriptValueInterface.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
23 #if ENABLE(Condition1) || ENABLE(Condition2)
24
25 #include "JSTestSerializedScriptValueInterface.h"
26
27 #include "JSDOMAttribute.h"
28 #include "JSDOMBinding.h"
29 #include "JSDOMConstructorNotConstructable.h"
30 #include "JSDOMConvert.h"
31 #include "JSDOMExceptionHandling.h"
32 #include "JSDOMOperation.h"
33 #include "JSDOMWrapperCache.h"
34 #include "JSMessagePort.h"
35 #include "SerializedScriptValue.h"
36 #include <runtime/FunctionPrototype.h>
37 #include <runtime/JSArray.h>
38 #include <wtf/GetPtr.h>
39
40 using namespace JSC;
41
42 namespace WebCore {
43
44 // Functions
45
46 JSC::EncodedJSValue JSC_HOST_CALL jsTestSerializedScriptValueInterfacePrototypeFunctionFunction(JSC::ExecState*);
47 JSC::EncodedJSValue JSC_HOST_CALL jsTestSerializedScriptValueInterfacePrototypeFunctionFunctionReturning(JSC::ExecState*);
48
49 // Attributes
50
51 JSC::EncodedJSValue jsTestSerializedScriptValueInterfaceConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
52 bool setJSTestSerializedScriptValueInterfaceConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
53 JSC::EncodedJSValue jsTestSerializedScriptValueInterfaceValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
54 bool setJSTestSerializedScriptValueInterfaceValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
55 JSC::EncodedJSValue jsTestSerializedScriptValueInterfaceReadonlyValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
56 JSC::EncodedJSValue jsTestSerializedScriptValueInterfaceCachedValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
57 bool setJSTestSerializedScriptValueInterfaceCachedValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
58 JSC::EncodedJSValue jsTestSerializedScriptValueInterfacePorts(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
59 JSC::EncodedJSValue jsTestSerializedScriptValueInterfaceCachedReadonlyValue(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
60
61 class JSTestSerializedScriptValueInterfacePrototype : public JSC::JSNonFinalObject {
62 public:
63     using Base = JSC::JSNonFinalObject;
64     static JSTestSerializedScriptValueInterfacePrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
65     {
66         JSTestSerializedScriptValueInterfacePrototype* ptr = new (NotNull, JSC::allocateCell<JSTestSerializedScriptValueInterfacePrototype>(vm.heap)) JSTestSerializedScriptValueInterfacePrototype(vm, globalObject, structure);
67         ptr->finishCreation(vm);
68         return ptr;
69     }
70
71     DECLARE_INFO;
72     static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
73     {
74         return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
75     }
76
77 private:
78     JSTestSerializedScriptValueInterfacePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
79         : JSC::JSNonFinalObject(vm, structure)
80     {
81     }
82
83     void finishCreation(JSC::VM&);
84 };
85
86 using JSTestSerializedScriptValueInterfaceConstructor = JSDOMConstructorNotConstructable<JSTestSerializedScriptValueInterface>;
87
88 template<> JSValue JSTestSerializedScriptValueInterfaceConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
89 {
90     UNUSED_PARAM(vm);
91     return globalObject.functionPrototype();
92 }
93
94 template<> void JSTestSerializedScriptValueInterfaceConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
95 {
96     putDirect(vm, vm.propertyNames->prototype, JSTestSerializedScriptValueInterface::prototype(vm, globalObject), DontDelete | ReadOnly | DontEnum);
97     putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("TestSerializedScriptValueInterface"))), ReadOnly | DontEnum);
98     putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
99 }
100
101 template<> const ClassInfo JSTestSerializedScriptValueInterfaceConstructor::s_info = { "TestSerializedScriptValueInterface", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestSerializedScriptValueInterfaceConstructor) };
102
103 /* Hash table for prototype */
104
105 static const HashTableValue JSTestSerializedScriptValueInterfacePrototypeTableValues[] =
106 {
107     { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializedScriptValueInterfaceConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestSerializedScriptValueInterfaceConstructor) } },
108     { "value", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializedScriptValueInterfaceValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestSerializedScriptValueInterfaceValue) } },
109     { "readonlyValue", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializedScriptValueInterfaceReadonlyValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
110     { "cachedValue", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializedScriptValueInterfaceCachedValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestSerializedScriptValueInterfaceCachedValue) } },
111     { "ports", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializedScriptValueInterfacePorts), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
112     { "cachedReadonlyValue", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializedScriptValueInterfaceCachedReadonlyValue), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
113     { "function", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestSerializedScriptValueInterfacePrototypeFunctionFunction), (intptr_t) (1) } },
114     { "functionReturning", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestSerializedScriptValueInterfacePrototypeFunctionFunctionReturning), (intptr_t) (0) } },
115 };
116
117 const ClassInfo JSTestSerializedScriptValueInterfacePrototype::s_info = { "TestSerializedScriptValueInterfacePrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestSerializedScriptValueInterfacePrototype) };
118
119 void JSTestSerializedScriptValueInterfacePrototype::finishCreation(VM& vm)
120 {
121     Base::finishCreation(vm);
122     reifyStaticProperties(vm, JSTestSerializedScriptValueInterfacePrototypeTableValues, *this);
123 }
124
125 const ClassInfo JSTestSerializedScriptValueInterface::s_info = { "TestSerializedScriptValueInterface", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestSerializedScriptValueInterface) };
126
127 JSTestSerializedScriptValueInterface::JSTestSerializedScriptValueInterface(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestSerializedScriptValueInterface>&& impl)
128     : JSDOMWrapper<TestSerializedScriptValueInterface>(structure, globalObject, WTFMove(impl))
129 {
130 }
131
132 void JSTestSerializedScriptValueInterface::finishCreation(VM& vm)
133 {
134     Base::finishCreation(vm);
135     ASSERT(inherits(vm, info()));
136
137 }
138
139 JSObject* JSTestSerializedScriptValueInterface::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
140 {
141     return JSTestSerializedScriptValueInterfacePrototype::create(vm, &globalObject, JSTestSerializedScriptValueInterfacePrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
142 }
143
144 JSObject* JSTestSerializedScriptValueInterface::prototype(VM& vm, JSDOMGlobalObject& globalObject)
145 {
146     return getDOMPrototype<JSTestSerializedScriptValueInterface>(vm, globalObject);
147 }
148
149 JSValue JSTestSerializedScriptValueInterface::getConstructor(VM& vm, const JSGlobalObject* globalObject)
150 {
151     return getDOMConstructor<JSTestSerializedScriptValueInterfaceConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
152 }
153
154 void JSTestSerializedScriptValueInterface::destroy(JSC::JSCell* cell)
155 {
156     JSTestSerializedScriptValueInterface* thisObject = static_cast<JSTestSerializedScriptValueInterface*>(cell);
157     thisObject->JSTestSerializedScriptValueInterface::~JSTestSerializedScriptValueInterface();
158 }
159
160 template<> inline JSTestSerializedScriptValueInterface* IDLAttribute<JSTestSerializedScriptValueInterface>::cast(ExecState& state, EncodedJSValue thisValue)
161 {
162     return jsDynamicDowncast<JSTestSerializedScriptValueInterface*>(state.vm(), JSValue::decode(thisValue));
163 }
164
165 template<> inline JSTestSerializedScriptValueInterface* IDLOperation<JSTestSerializedScriptValueInterface>::cast(ExecState& state)
166 {
167     return jsDynamicDowncast<JSTestSerializedScriptValueInterface*>(state.vm(), state.thisValue());
168 }
169
170 EncodedJSValue jsTestSerializedScriptValueInterfaceConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
171 {
172     VM& vm = state->vm();
173     auto throwScope = DECLARE_THROW_SCOPE(vm);
174     auto* prototype = jsDynamicDowncast<JSTestSerializedScriptValueInterfacePrototype*>(vm, JSValue::decode(thisValue));
175     if (UNLIKELY(!prototype))
176         return throwVMTypeError(state, throwScope);
177     return JSValue::encode(JSTestSerializedScriptValueInterface::getConstructor(state->vm(), prototype->globalObject()));
178 }
179
180 bool setJSTestSerializedScriptValueInterfaceConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
181 {
182     VM& vm = state->vm();
183     auto throwScope = DECLARE_THROW_SCOPE(vm);
184     auto* prototype = jsDynamicDowncast<JSTestSerializedScriptValueInterfacePrototype*>(vm, JSValue::decode(thisValue));
185     if (UNLIKELY(!prototype)) {
186         throwVMTypeError(state, throwScope);
187         return false;
188     }
189     // Shadowing a built-in constructor
190     return prototype->putDirect(state->vm(), state->propertyNames().constructor, JSValue::decode(encodedValue));
191 }
192
193 static inline JSValue jsTestSerializedScriptValueInterfaceValueGetter(ExecState& state, JSTestSerializedScriptValueInterface& thisObject, ThrowScope& throwScope)
194 {
195     UNUSED_PARAM(throwScope);
196     UNUSED_PARAM(state);
197     auto& impl = thisObject.wrapped();
198     JSValue result = toJS<IDLSerializedScriptValue<SerializedScriptValue>>(state, *thisObject.globalObject(), impl.value());
199     return result;
200 }
201
202 EncodedJSValue jsTestSerializedScriptValueInterfaceValue(ExecState* state, EncodedJSValue thisValue, PropertyName)
203 {
204     return IDLAttribute<JSTestSerializedScriptValueInterface>::get<jsTestSerializedScriptValueInterfaceValueGetter>(*state, thisValue, "value");
205 }
206
207 static inline bool setJSTestSerializedScriptValueInterfaceValueSetter(ExecState& state, JSTestSerializedScriptValueInterface& thisObject, JSValue value, ThrowScope& throwScope)
208 {
209     UNUSED_PARAM(state);
210     UNUSED_PARAM(throwScope);
211     auto& impl = thisObject.wrapped();
212     auto nativeValue = convert<IDLSerializedScriptValue<SerializedScriptValue>>(state, value);
213     RETURN_IF_EXCEPTION(throwScope, false);
214     impl.setValue(WTFMove(nativeValue));
215     return true;
216 }
217
218 bool setJSTestSerializedScriptValueInterfaceValue(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
219 {
220     return IDLAttribute<JSTestSerializedScriptValueInterface>::set<setJSTestSerializedScriptValueInterfaceValueSetter>(*state, thisValue, encodedValue, "value");
221 }
222
223 static inline JSValue jsTestSerializedScriptValueInterfaceReadonlyValueGetter(ExecState& state, JSTestSerializedScriptValueInterface& thisObject, ThrowScope& throwScope)
224 {
225     UNUSED_PARAM(throwScope);
226     UNUSED_PARAM(state);
227     auto& impl = thisObject.wrapped();
228     JSValue result = toJS<IDLSerializedScriptValue<SerializedScriptValue>>(state, *thisObject.globalObject(), impl.readonlyValue());
229     return result;
230 }
231
232 EncodedJSValue jsTestSerializedScriptValueInterfaceReadonlyValue(ExecState* state, EncodedJSValue thisValue, PropertyName)
233 {
234     return IDLAttribute<JSTestSerializedScriptValueInterface>::get<jsTestSerializedScriptValueInterfaceReadonlyValueGetter>(*state, thisValue, "readonlyValue");
235 }
236
237 static inline JSValue jsTestSerializedScriptValueInterfaceCachedValueGetter(ExecState& state, JSTestSerializedScriptValueInterface& thisObject, ThrowScope& throwScope)
238 {
239     UNUSED_PARAM(throwScope);
240     UNUSED_PARAM(state);
241     if (JSValue cachedValue = thisObject.m_cachedValue.get())
242         return cachedValue;
243     auto& impl = thisObject.wrapped();
244     JSValue result = toJS<IDLSerializedScriptValue<SerializedScriptValue>>(state, *thisObject.globalObject(), impl.cachedValue());
245     thisObject.m_cachedValue.set(state.vm(), &thisObject, result);
246     return result;
247 }
248
249 EncodedJSValue jsTestSerializedScriptValueInterfaceCachedValue(ExecState* state, EncodedJSValue thisValue, PropertyName)
250 {
251     return IDLAttribute<JSTestSerializedScriptValueInterface>::get<jsTestSerializedScriptValueInterfaceCachedValueGetter>(*state, thisValue, "cachedValue");
252 }
253
254 static inline bool setJSTestSerializedScriptValueInterfaceCachedValueSetter(ExecState& state, JSTestSerializedScriptValueInterface& thisObject, JSValue value, ThrowScope& throwScope)
255 {
256     UNUSED_PARAM(state);
257     UNUSED_PARAM(throwScope);
258     auto& impl = thisObject.wrapped();
259     auto nativeValue = convert<IDLSerializedScriptValue<SerializedScriptValue>>(state, value);
260     RETURN_IF_EXCEPTION(throwScope, false);
261     impl.setCachedValue(WTFMove(nativeValue));
262     return true;
263 }
264
265 bool setJSTestSerializedScriptValueInterfaceCachedValue(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
266 {
267     return IDLAttribute<JSTestSerializedScriptValueInterface>::set<setJSTestSerializedScriptValueInterfaceCachedValueSetter>(*state, thisValue, encodedValue, "cachedValue");
268 }
269
270 static inline JSValue jsTestSerializedScriptValueInterfacePortsGetter(ExecState& state, JSTestSerializedScriptValueInterface& thisObject, ThrowScope& throwScope)
271 {
272     UNUSED_PARAM(throwScope);
273     UNUSED_PARAM(state);
274     auto& impl = thisObject.wrapped();
275     JSValue result = toJS<IDLSequence<IDLInterface<MessagePort>>>(state, *thisObject.globalObject(), impl.ports());
276     return result;
277 }
278
279 EncodedJSValue jsTestSerializedScriptValueInterfacePorts(ExecState* state, EncodedJSValue thisValue, PropertyName)
280 {
281     return IDLAttribute<JSTestSerializedScriptValueInterface>::get<jsTestSerializedScriptValueInterfacePortsGetter>(*state, thisValue, "ports");
282 }
283
284 static inline JSValue jsTestSerializedScriptValueInterfaceCachedReadonlyValueGetter(ExecState& state, JSTestSerializedScriptValueInterface& thisObject, ThrowScope& throwScope)
285 {
286     UNUSED_PARAM(throwScope);
287     UNUSED_PARAM(state);
288     if (JSValue cachedValue = thisObject.m_cachedReadonlyValue.get())
289         return cachedValue;
290     auto& impl = thisObject.wrapped();
291     JSValue result = toJS<IDLSerializedScriptValue<SerializedScriptValue>>(state, *thisObject.globalObject(), impl.cachedReadonlyValue());
292     thisObject.m_cachedReadonlyValue.set(state.vm(), &thisObject, result);
293     return result;
294 }
295
296 EncodedJSValue jsTestSerializedScriptValueInterfaceCachedReadonlyValue(ExecState* state, EncodedJSValue thisValue, PropertyName)
297 {
298     return IDLAttribute<JSTestSerializedScriptValueInterface>::get<jsTestSerializedScriptValueInterfaceCachedReadonlyValueGetter>(*state, thisValue, "cachedReadonlyValue");
299 }
300
301 static inline JSC::EncodedJSValue jsTestSerializedScriptValueInterfacePrototypeFunctionFunctionBody(JSC::ExecState* state, typename IDLOperation<JSTestSerializedScriptValueInterface>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
302 {
303     UNUSED_PARAM(state);
304     UNUSED_PARAM(throwScope);
305     auto& impl = castedThis->wrapped();
306     if (UNLIKELY(state->argumentCount() < 1))
307         return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
308     auto value = convert<IDLSerializedScriptValue<SerializedScriptValue>>(*state, state->uncheckedArgument(0));
309     RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
310     impl.function(WTFMove(value));
311     return JSValue::encode(jsUndefined());
312 }
313
314 EncodedJSValue JSC_HOST_CALL jsTestSerializedScriptValueInterfacePrototypeFunctionFunction(ExecState* state)
315 {
316     return IDLOperation<JSTestSerializedScriptValueInterface>::call<jsTestSerializedScriptValueInterfacePrototypeFunctionFunctionBody>(*state, "function");
317 }
318
319 static inline JSC::EncodedJSValue jsTestSerializedScriptValueInterfacePrototypeFunctionFunctionReturningBody(JSC::ExecState* state, typename IDLOperation<JSTestSerializedScriptValueInterface>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
320 {
321     UNUSED_PARAM(state);
322     UNUSED_PARAM(throwScope);
323     auto& impl = castedThis->wrapped();
324     return JSValue::encode(toJS<IDLSerializedScriptValue<SerializedScriptValue>>(*state, *castedThis->globalObject(), impl.functionReturning()));
325 }
326
327 EncodedJSValue JSC_HOST_CALL jsTestSerializedScriptValueInterfacePrototypeFunctionFunctionReturning(ExecState* state)
328 {
329     return IDLOperation<JSTestSerializedScriptValueInterface>::call<jsTestSerializedScriptValueInterfacePrototypeFunctionFunctionReturningBody>(*state, "functionReturning");
330 }
331
332 void JSTestSerializedScriptValueInterface::visitChildren(JSCell* cell, SlotVisitor& visitor)
333 {
334     auto* thisObject = jsCast<JSTestSerializedScriptValueInterface*>(cell);
335     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
336     Base::visitChildren(thisObject, visitor);
337     visitor.append(thisObject->m_cachedValue);
338     visitor.append(thisObject->m_cachedReadonlyValue);
339 }
340
341 bool JSTestSerializedScriptValueInterfaceOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
342 {
343     UNUSED_PARAM(handle);
344     UNUSED_PARAM(visitor);
345     return false;
346 }
347
348 void JSTestSerializedScriptValueInterfaceOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
349 {
350     auto* jsTestSerializedScriptValueInterface = static_cast<JSTestSerializedScriptValueInterface*>(handle.slot()->asCell());
351     auto& world = *static_cast<DOMWrapperWorld*>(context);
352     uncacheWrapper(world, &jsTestSerializedScriptValueInterface->wrapped(), jsTestSerializedScriptValueInterface);
353 }
354
355 #if ENABLE(BINDING_INTEGRITY)
356 #if PLATFORM(WIN)
357 #pragma warning(disable: 4483)
358 extern "C" { extern void (*const __identifier("??_7TestSerializedScriptValueInterface@WebCore@@6B@")[])(); }
359 #else
360 extern "C" { extern void* _ZTVN7WebCore34TestSerializedScriptValueInterfaceE[]; }
361 #endif
362 #endif
363
364 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestSerializedScriptValueInterface>&& impl)
365 {
366
367 #if ENABLE(BINDING_INTEGRITY)
368     void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
369 #if PLATFORM(WIN)
370     void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestSerializedScriptValueInterface@WebCore@@6B@"));
371 #else
372     void* expectedVTablePointer = &_ZTVN7WebCore34TestSerializedScriptValueInterfaceE[2];
373 #if COMPILER(CLANG)
374     // If this fails TestSerializedScriptValueInterface does not have a vtable, so you need to add the
375     // ImplementationLacksVTable attribute to the interface definition
376     static_assert(__is_polymorphic(TestSerializedScriptValueInterface), "TestSerializedScriptValueInterface is not polymorphic");
377 #endif
378 #endif
379     // If you hit this assertion you either have a use after free bug, or
380     // TestSerializedScriptValueInterface has subclasses. If TestSerializedScriptValueInterface has subclasses that get passed
381     // to toJS() we currently require TestSerializedScriptValueInterface you to opt out of binding hardening
382     // by adding the SkipVTableValidation attribute to the interface IDL definition
383     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
384 #endif
385     return createWrapper<TestSerializedScriptValueInterface>(globalObject, WTFMove(impl));
386 }
387
388 JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestSerializedScriptValueInterface& impl)
389 {
390     return wrap(state, globalObject, impl);
391 }
392
393 TestSerializedScriptValueInterface* JSTestSerializedScriptValueInterface::toWrapped(JSC::VM& vm, JSC::JSValue value)
394 {
395     if (auto* wrapper = jsDynamicDowncast<JSTestSerializedScriptValueInterface*>(vm, value))
396         return &wrapper->wrapped();
397     return nullptr;
398 }
399
400 }
401
402 #endif // ENABLE(Condition1) || ENABLE(Condition2)