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