f6bf263e6f586f81485f975eeaeff2bd36124d34
[WebKit-https.git] / Source / WebCore / bindings / scripts / test / JS / JSTestNamedSetterWithUnforgableProperties.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 "JSTestNamedSetterWithUnforgableProperties.h"
23
24 #include "JSDOMAbstractOperations.h"
25 #include "JSDOMAttribute.h"
26 #include "JSDOMBinding.h"
27 #include "JSDOMConstructorNotConstructable.h"
28 #include "JSDOMConvertStrings.h"
29 #include "JSDOMExceptionHandling.h"
30 #include "JSDOMOperation.h"
31 #include "JSDOMWrapperCache.h"
32 #include "ScriptExecutionContext.h"
33 #include <JavaScriptCore/FunctionPrototype.h>
34 #include <JavaScriptCore/HeapAnalyzer.h>
35 #include <JavaScriptCore/JSCInlines.h>
36 #include <wtf/GetPtr.h>
37 #include <wtf/PointerPreparations.h>
38 #include <wtf/URL.h>
39
40
41 namespace WebCore {
42 using namespace JSC;
43
44 // Functions
45
46 JSC::EncodedJSValue JSC_HOST_CALL jsTestNamedSetterWithUnforgablePropertiesInstanceFunctionUnforgeableOperation(JSC::JSGlobalObject*, JSC::CallFrame*);
47
48 // Attributes
49
50 JSC::EncodedJSValue jsTestNamedSetterWithUnforgablePropertiesConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
51 bool setJSTestNamedSetterWithUnforgablePropertiesConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
52 JSC::EncodedJSValue jsTestNamedSetterWithUnforgablePropertiesUnforgeableAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
53
54 class JSTestNamedSetterWithUnforgablePropertiesPrototype : public JSC::JSNonFinalObject {
55 public:
56     using Base = JSC::JSNonFinalObject;
57     static JSTestNamedSetterWithUnforgablePropertiesPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
58     {
59         JSTestNamedSetterWithUnforgablePropertiesPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestNamedSetterWithUnforgablePropertiesPrototype>(vm.heap)) JSTestNamedSetterWithUnforgablePropertiesPrototype(vm, globalObject, structure);
60         ptr->finishCreation(vm);
61         return ptr;
62     }
63
64     DECLARE_INFO;
65     static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
66     {
67         return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
68     }
69
70 private:
71     JSTestNamedSetterWithUnforgablePropertiesPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
72         : JSC::JSNonFinalObject(vm, structure)
73     {
74     }
75
76     void finishCreation(JSC::VM&);
77 };
78
79 using JSTestNamedSetterWithUnforgablePropertiesConstructor = JSDOMConstructorNotConstructable<JSTestNamedSetterWithUnforgableProperties>;
80
81 /* Hash table */
82
83 static const struct CompactHashIndex JSTestNamedSetterWithUnforgablePropertiesTableIndex[4] = {
84     { -1, -1 },
85     { 1, -1 },
86     { -1, -1 },
87     { 0, -1 },
88 };
89
90
91 static const HashTableValue JSTestNamedSetterWithUnforgablePropertiesTableValues[] =
92 {
93     { "unforgeableAttribute", static_cast<unsigned>(JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestNamedSetterWithUnforgablePropertiesUnforgeableAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
94     { "unforgeableOperation", static_cast<unsigned>(JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestNamedSetterWithUnforgablePropertiesInstanceFunctionUnforgeableOperation), (intptr_t) (0) } },
95 };
96
97 static const HashTable JSTestNamedSetterWithUnforgablePropertiesTable = { 2, 3, true, JSTestNamedSetterWithUnforgableProperties::info(), JSTestNamedSetterWithUnforgablePropertiesTableValues, JSTestNamedSetterWithUnforgablePropertiesTableIndex };
98 template<> JSValue JSTestNamedSetterWithUnforgablePropertiesConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
99 {
100     UNUSED_PARAM(vm);
101     return globalObject.functionPrototype();
102 }
103
104 template<> void JSTestNamedSetterWithUnforgablePropertiesConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
105 {
106     putDirect(vm, vm.propertyNames->prototype, JSTestNamedSetterWithUnforgableProperties::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
107     putDirect(vm, vm.propertyNames->name, jsNontrivialString(vm, String("TestNamedSetterWithUnforgableProperties"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
108     putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
109 }
110
111 template<> const ClassInfo JSTestNamedSetterWithUnforgablePropertiesConstructor::s_info = { "TestNamedSetterWithUnforgableProperties", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamedSetterWithUnforgablePropertiesConstructor) };
112
113 /* Hash table for prototype */
114
115 static const HashTableValue JSTestNamedSetterWithUnforgablePropertiesPrototypeTableValues[] =
116 {
117     { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestNamedSetterWithUnforgablePropertiesConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestNamedSetterWithUnforgablePropertiesConstructor) } },
118 };
119
120 const ClassInfo JSTestNamedSetterWithUnforgablePropertiesPrototype::s_info = { "TestNamedSetterWithUnforgablePropertiesPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestNamedSetterWithUnforgablePropertiesPrototype) };
121
122 void JSTestNamedSetterWithUnforgablePropertiesPrototype::finishCreation(VM& vm)
123 {
124     Base::finishCreation(vm);
125     reifyStaticProperties(vm, JSTestNamedSetterWithUnforgableProperties::info(), JSTestNamedSetterWithUnforgablePropertiesPrototypeTableValues, *this);
126 }
127
128 const ClassInfo JSTestNamedSetterWithUnforgableProperties::s_info = { "TestNamedSetterWithUnforgableProperties", &Base::s_info, &JSTestNamedSetterWithUnforgablePropertiesTable, nullptr, CREATE_METHOD_TABLE(JSTestNamedSetterWithUnforgableProperties) };
129
130 JSTestNamedSetterWithUnforgableProperties::JSTestNamedSetterWithUnforgableProperties(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestNamedSetterWithUnforgableProperties>&& impl)
131     : JSDOMWrapper<TestNamedSetterWithUnforgableProperties>(structure, globalObject, WTFMove(impl))
132 {
133 }
134
135 void JSTestNamedSetterWithUnforgableProperties::finishCreation(VM& vm)
136 {
137     Base::finishCreation(vm);
138     ASSERT(inherits(vm, info()));
139
140 }
141
142 JSObject* JSTestNamedSetterWithUnforgableProperties::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
143 {
144     return JSTestNamedSetterWithUnforgablePropertiesPrototype::create(vm, &globalObject, JSTestNamedSetterWithUnforgablePropertiesPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
145 }
146
147 JSObject* JSTestNamedSetterWithUnforgableProperties::prototype(VM& vm, JSDOMGlobalObject& globalObject)
148 {
149     return getDOMPrototype<JSTestNamedSetterWithUnforgableProperties>(vm, globalObject);
150 }
151
152 JSValue JSTestNamedSetterWithUnforgableProperties::getConstructor(VM& vm, const JSGlobalObject* globalObject)
153 {
154     return getDOMConstructor<JSTestNamedSetterWithUnforgablePropertiesConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
155 }
156
157 void JSTestNamedSetterWithUnforgableProperties::destroy(JSC::JSCell* cell)
158 {
159     JSTestNamedSetterWithUnforgableProperties* thisObject = static_cast<JSTestNamedSetterWithUnforgableProperties*>(cell);
160     thisObject->JSTestNamedSetterWithUnforgableProperties::~JSTestNamedSetterWithUnforgableProperties();
161 }
162
163 bool JSTestNamedSetterWithUnforgableProperties::getOwnPropertySlot(JSObject* object, ExecState* state, PropertyName propertyName, PropertySlot& slot)
164 {
165     auto* thisObject = jsCast<JSTestNamedSetterWithUnforgableProperties*>(object);
166     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
167     using GetterIDLType = IDLDOMString;
168     auto getterFunctor = [] (auto& thisObject, auto propertyName) -> Optional<typename GetterIDLType::ImplementationType> {
169         auto result = thisObject.wrapped().namedItem(propertyNameToAtomString(propertyName));
170         if (!GetterIDLType::isNullValue(result))
171             return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) };
172         return WTF::nullopt;
173     };
174     if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) {
175         auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value()));
176         slot.setValue(thisObject, static_cast<unsigned>(0), value);
177         return true;
178     }
179     return JSObject::getOwnPropertySlot(object, state, propertyName, slot);
180 }
181
182 bool JSTestNamedSetterWithUnforgableProperties::getOwnPropertySlotByIndex(JSObject* object, ExecState* state, unsigned index, PropertySlot& slot)
183 {
184     VM& vm = state->vm();
185     auto* thisObject = jsCast<JSTestNamedSetterWithUnforgableProperties*>(object);
186     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
187     auto propertyName = Identifier::from(vm, index);
188     using GetterIDLType = IDLDOMString;
189     auto getterFunctor = [] (auto& thisObject, auto propertyName) -> Optional<typename GetterIDLType::ImplementationType> {
190         auto result = thisObject.wrapped().namedItem(propertyNameToAtomString(propertyName));
191         if (!GetterIDLType::isNullValue(result))
192             return typename GetterIDLType::ImplementationType { GetterIDLType::extractValueFromNullable(result) };
193         return WTF::nullopt;
194     };
195     if (auto namedProperty = accessVisibleNamedProperty<OverrideBuiltins::No>(*state, *thisObject, propertyName, getterFunctor)) {
196         auto value = toJS<IDLDOMString>(*state, WTFMove(namedProperty.value()));
197         slot.setValue(thisObject, static_cast<unsigned>(0), value);
198         return true;
199     }
200     return JSObject::getOwnPropertySlotByIndex(object, state, index, slot);
201 }
202
203 void JSTestNamedSetterWithUnforgableProperties::getOwnPropertyNames(JSObject* object, ExecState* state, PropertyNameArray& propertyNames, EnumerationMode mode)
204 {
205     VM& vm = state->vm();
206     auto* thisObject = jsCast<JSTestNamedSetterWithUnforgableProperties*>(object);
207     ASSERT_GC_OBJECT_INHERITS(object, info());
208     for (auto& propertyName : thisObject->wrapped().supportedPropertyNames())
209         propertyNames.add(Identifier::fromString(vm, propertyName));
210     JSObject::getOwnPropertyNames(object, state, propertyNames, mode);
211 }
212
213 bool JSTestNamedSetterWithUnforgableProperties::put(JSCell* cell, ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot& putPropertySlot)
214 {
215     auto* thisObject = jsCast<JSTestNamedSetterWithUnforgableProperties*>(cell);
216     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
217
218     if (!propertyName.isSymbol()) {
219         PropertySlot slot { thisObject, PropertySlot::InternalMethodType::VMInquiry };
220         JSValue prototype = thisObject->getPrototypeDirect(state->vm());
221         if (!(prototype.isObject() && asObject(prototype)->getPropertySlot(state, propertyName, slot))) {
222             auto throwScope = DECLARE_THROW_SCOPE(state->vm());
223             auto nativeValue = convert<IDLDOMString>(*state, value);
224             RETURN_IF_EXCEPTION(throwScope, true);
225             thisObject->wrapped().setNamedItem(propertyNameToString(propertyName), WTFMove(nativeValue));
226             return true;
227         }
228     }
229
230     return JSObject::put(thisObject, state, propertyName, value, putPropertySlot);
231 }
232
233 bool JSTestNamedSetterWithUnforgableProperties::putByIndex(JSCell* cell, ExecState* state, unsigned index, JSValue value, bool shouldThrow)
234 {
235     VM& vm = state->vm();
236     auto* thisObject = jsCast<JSTestNamedSetterWithUnforgableProperties*>(cell);
237     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
238
239     auto propertyName = Identifier::from(vm, index);
240     PropertySlot slot { thisObject, PropertySlot::InternalMethodType::VMInquiry };
241     JSValue prototype = thisObject->getPrototypeDirect(vm);
242     if (!(prototype.isObject() && asObject(prototype)->getPropertySlot(state, propertyName, slot))) {
243         auto throwScope = DECLARE_THROW_SCOPE(state->vm());
244         auto nativeValue = convert<IDLDOMString>(*state, value);
245         RETURN_IF_EXCEPTION(throwScope, true);
246         thisObject->wrapped().setNamedItem(propertyNameToString(propertyName), WTFMove(nativeValue));
247         return true;
248     }
249
250     return JSObject::putByIndex(cell, state, index, value, shouldThrow);
251 }
252
253 bool JSTestNamedSetterWithUnforgableProperties::defineOwnProperty(JSObject* object, ExecState* state, PropertyName propertyName, const PropertyDescriptor& propertyDescriptor, bool shouldThrow)
254 {
255     auto* thisObject = jsCast<JSTestNamedSetterWithUnforgableProperties*>(object);
256     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
257
258     if (!propertyName.isSymbol()) {
259 static bool isUnforgeablePropertyName(PropertyName propertyName)
260 {
261     return propertyName == "unforgeableAttribute" || propertyName == "unforgeableOperation";
262 }
263
264         if (!isUnforgeablePropertyName(propertyName)) {
265             PropertySlot slot { thisObject, PropertySlot::InternalMethodType::VMInquiry };
266             if (!JSObject::getOwnPropertySlot(thisObject, state, propertyName, slot)) {
267                 if (!propertyDescriptor.isDataDescriptor())
268                     return false;
269                 auto throwScope = DECLARE_THROW_SCOPE(state->vm());
270                 auto nativeValue = convert<IDLDOMString>(*state, propertyDescriptor.value());
271                 RETURN_IF_EXCEPTION(throwScope, true);
272                 thisObject->wrapped().setNamedItem(propertyNameToString(propertyName), WTFMove(nativeValue));
273                 return true;
274             }
275         }
276     }
277
278     PropertyDescriptor newPropertyDescriptor = propertyDescriptor;
279     newPropertyDescriptor.setConfigurable(true);
280     return JSObject::defineOwnProperty(object, state, propertyName, newPropertyDescriptor, shouldThrow);
281 }
282
283 template<> inline JSTestNamedSetterWithUnforgableProperties* IDLAttribute<JSTestNamedSetterWithUnforgableProperties>::cast(ExecState& state, EncodedJSValue thisValue)
284 {
285     return jsDynamicCast<JSTestNamedSetterWithUnforgableProperties*>(state.vm(), JSValue::decode(thisValue));
286 }
287
288 template<> inline JSTestNamedSetterWithUnforgableProperties* IDLOperation<JSTestNamedSetterWithUnforgableProperties>::cast(ExecState& state)
289 {
290     return jsDynamicCast<JSTestNamedSetterWithUnforgableProperties*>(state.vm(), state.thisValue());
291 }
292
293 EncodedJSValue jsTestNamedSetterWithUnforgablePropertiesConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
294 {
295     VM& vm = state->vm();
296     auto throwScope = DECLARE_THROW_SCOPE(vm);
297     auto* prototype = jsDynamicCast<JSTestNamedSetterWithUnforgablePropertiesPrototype*>(vm, JSValue::decode(thisValue));
298     if (UNLIKELY(!prototype))
299         return throwVMTypeError(state, throwScope);
300     return JSValue::encode(JSTestNamedSetterWithUnforgableProperties::getConstructor(state->vm(), prototype->globalObject()));
301 }
302
303 bool setJSTestNamedSetterWithUnforgablePropertiesConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
304 {
305     VM& vm = state->vm();
306     auto throwScope = DECLARE_THROW_SCOPE(vm);
307     auto* prototype = jsDynamicCast<JSTestNamedSetterWithUnforgablePropertiesPrototype*>(vm, JSValue::decode(thisValue));
308     if (UNLIKELY(!prototype)) {
309         throwVMTypeError(state, throwScope);
310         return false;
311     }
312     // Shadowing a built-in constructor
313     return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
314 }
315
316 static inline JSValue jsTestNamedSetterWithUnforgablePropertiesUnforgeableAttributeGetter(ExecState& state, JSTestNamedSetterWithUnforgableProperties& thisObject, ThrowScope& throwScope)
317 {
318     UNUSED_PARAM(throwScope);
319     UNUSED_PARAM(state);
320     auto& impl = thisObject.wrapped();
321     JSValue result = toJS<IDLDOMString>(state, throwScope, impl.unforgeableAttribute());
322     return result;
323 }
324
325 EncodedJSValue jsTestNamedSetterWithUnforgablePropertiesUnforgeableAttribute(ExecState* state, EncodedJSValue thisValue, PropertyName)
326 {
327     return IDLAttribute<JSTestNamedSetterWithUnforgableProperties>::get<jsTestNamedSetterWithUnforgablePropertiesUnforgeableAttributeGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "unforgeableAttribute");
328 }
329
330 static inline JSC::EncodedJSValue jsTestNamedSetterWithUnforgablePropertiesInstanceFunctionUnforgeableOperationBody(JSC::ExecState* state, typename IDLOperation<JSTestNamedSetterWithUnforgableProperties>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
331 {
332     UNUSED_PARAM(state);
333     UNUSED_PARAM(throwScope);
334     auto& impl = castedThis->wrapped();
335     impl.unforgeableOperation();
336     return JSValue::encode(jsUndefined());
337 }
338
339 EncodedJSValue JSC_HOST_CALL jsTestNamedSetterWithUnforgablePropertiesInstanceFunctionUnforgeableOperation(JSGlobalObject* globalObject, CallFrame* state)
340 {
341     UNUSED_PARAM(globalObject);
342     return IDLOperation<JSTestNamedSetterWithUnforgableProperties>::call<jsTestNamedSetterWithUnforgablePropertiesInstanceFunctionUnforgeableOperationBody>(*state, "unforgeableOperation");
343 }
344
345 void JSTestNamedSetterWithUnforgableProperties::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer)
346 {
347     auto* thisObject = jsCast<JSTestNamedSetterWithUnforgableProperties*>(cell);
348     analyzer.setWrappedObjectForCell(cell, &thisObject->wrapped());
349     if (thisObject->scriptExecutionContext())
350         analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
351     Base::analyzeHeap(cell, analyzer);
352 }
353
354 bool JSTestNamedSetterWithUnforgablePropertiesOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason)
355 {
356     UNUSED_PARAM(handle);
357     UNUSED_PARAM(visitor);
358     UNUSED_PARAM(reason);
359     return false;
360 }
361
362 void JSTestNamedSetterWithUnforgablePropertiesOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
363 {
364     auto* jsTestNamedSetterWithUnforgableProperties = static_cast<JSTestNamedSetterWithUnforgableProperties*>(handle.slot()->asCell());
365     auto& world = *static_cast<DOMWrapperWorld*>(context);
366     uncacheWrapper(world, &jsTestNamedSetterWithUnforgableProperties->wrapped(), jsTestNamedSetterWithUnforgableProperties);
367 }
368
369 #if ENABLE(BINDING_INTEGRITY)
370 #if PLATFORM(WIN)
371 #pragma warning(disable: 4483)
372 extern "C" { extern void (*const __identifier("??_7TestNamedSetterWithUnforgableProperties@WebCore@@6B@")[])(); }
373 #else
374 extern "C" { extern void* _ZTVN7WebCore39TestNamedSetterWithUnforgablePropertiesE[]; }
375 #endif
376 #endif
377
378 JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestNamedSetterWithUnforgableProperties>&& impl)
379 {
380
381 #if ENABLE(BINDING_INTEGRITY)
382     void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
383 #if PLATFORM(WIN)
384     void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(__identifier("??_7TestNamedSetterWithUnforgableProperties@WebCore@@6B@"));
385 #else
386     void* expectedVTablePointer = WTF_PREPARE_VTBL_POINTER_FOR_INSPECTION(&_ZTVN7WebCore39TestNamedSetterWithUnforgablePropertiesE[2]);
387 #endif
388
389     // If this fails TestNamedSetterWithUnforgableProperties does not have a vtable, so you need to add the
390     // ImplementationLacksVTable attribute to the interface definition
391     static_assert(std::is_polymorphic<TestNamedSetterWithUnforgableProperties>::value, "TestNamedSetterWithUnforgableProperties is not polymorphic");
392
393     // If you hit this assertion you either have a use after free bug, or
394     // TestNamedSetterWithUnforgableProperties has subclasses. If TestNamedSetterWithUnforgableProperties has subclasses that get passed
395     // to toJS() we currently require TestNamedSetterWithUnforgableProperties you to opt out of binding hardening
396     // by adding the SkipVTableValidation attribute to the interface IDL definition
397     RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
398 #endif
399     return createWrapper<TestNamedSetterWithUnforgableProperties>(globalObject, WTFMove(impl));
400 }
401
402 JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestNamedSetterWithUnforgableProperties& impl)
403 {
404     return wrap(state, globalObject, impl);
405 }
406
407 TestNamedSetterWithUnforgableProperties* JSTestNamedSetterWithUnforgableProperties::toWrapped(JSC::VM& vm, JSC::JSValue value)
408 {
409     if (auto* wrapper = jsDynamicCast<JSTestNamedSetterWithUnforgableProperties*>(vm, value))
410         return &wrapper->wrapped();
411     return nullptr;
412 }
413
414 }