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