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