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