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