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 "JSSQLResultSetRowList.h"
23
24#include "JSDOMAttribute.h"
25#include "JSDOMBinding.h"
26#include "JSDOMConstructorNotConstructable.h"
27#include "JSDOMConvertNullable.h"
28#include "JSDOMConvertNumbers.h"
29#include "JSDOMConvertRecord.h"
30#include "JSDOMConvertStrings.h"
31#include "JSDOMConvertUnion.h"
32#include "JSDOMExceptionHandling.h"
33#include "JSDOMGlobalObject.h"
34#include "JSDOMOperation.h"
35#include "JSDOMWrapperCache.h"
36#include "ScriptExecutionContext.h"
37#include <JavaScriptCore/FunctionPrototype.h>
38#include <JavaScriptCore/HeapSnapshotBuilder.h>
39#include <JavaScriptCore/JSCInlines.h>
40#include <wtf/GetPtr.h>
41#include <wtf/PointerPreparations.h>
42#include <wtf/URL.h>
43#include <wtf/Variant.h>
44#include <wtf/Vector.h>
45
46
47namespace WebCore {
48using namespace JSC;
49
50// Functions
51
52JSC::EncodedJSValue JSC_HOST_CALL jsSQLResultSetRowListPrototypeFunctionItem(JSC::ExecState*);
53
54// Attributes
55
56JSC::EncodedJSValue jsSQLResultSetRowListConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
57bool setJSSQLResultSetRowListConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
58JSC::EncodedJSValue jsSQLResultSetRowListLength(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
59
60class JSSQLResultSetRowListPrototype : public JSC::JSNonFinalObject {
61public:
62 using Base = JSC::JSNonFinalObject;
63 static JSSQLResultSetRowListPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
64 {
65 JSSQLResultSetRowListPrototype* ptr = new (NotNull, JSC::allocateCell<JSSQLResultSetRowListPrototype>(vm.heap)) JSSQLResultSetRowListPrototype(vm, globalObject, structure);
66 ptr->finishCreation(vm);
67 return ptr;
68 }
69
70 DECLARE_INFO;
71 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
72 {
73 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
74 }
75
76private:
77 JSSQLResultSetRowListPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
78 : JSC::JSNonFinalObject(vm, structure)
79 {
80 }
81
82 void finishCreation(JSC::VM&);
83};
84
85using JSSQLResultSetRowListConstructor = JSDOMConstructorNotConstructable<JSSQLResultSetRowList>;
86
87template<> JSValue JSSQLResultSetRowListConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
88{
89 UNUSED_PARAM(vm);
90 return globalObject.functionPrototype();
91}
92
93template<> void JSSQLResultSetRowListConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
94{
95 putDirect(vm, vm.propertyNames->prototype, JSSQLResultSetRowList::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
96 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("SQLResultSetRowList"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
97 putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
98}
99
100template<> const ClassInfo JSSQLResultSetRowListConstructor::s_info = { "SQLResultSetRowList", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSQLResultSetRowListConstructor) };
101
102/* Hash table for prototype */
103
104static const HashTableValue JSSQLResultSetRowListPrototypeTableValues[] =
105{
106 { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLResultSetRowListConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSQLResultSetRowListConstructor) } },
107 { "length", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLResultSetRowListLength), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
108 { "item", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsSQLResultSetRowListPrototypeFunctionItem), (intptr_t) (1) } },
109};
110
111const ClassInfo JSSQLResultSetRowListPrototype::s_info = { "SQLResultSetRowListPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSQLResultSetRowListPrototype) };
112
113void JSSQLResultSetRowListPrototype::finishCreation(VM& vm)
114{
115 Base::finishCreation(vm);
116 reifyStaticProperties(vm, JSSQLResultSetRowList::info(), JSSQLResultSetRowListPrototypeTableValues, *this);
117}
118
119const ClassInfo JSSQLResultSetRowList::s_info = { "SQLResultSetRowList", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSSQLResultSetRowList) };
120
121JSSQLResultSetRowList::JSSQLResultSetRowList(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SQLResultSetRowList>&& impl)
122 : JSDOMWrapper<SQLResultSetRowList>(structure, globalObject, WTFMove(impl))
123{
124}
125
126void JSSQLResultSetRowList::finishCreation(VM& vm)
127{
128 Base::finishCreation(vm);
129 ASSERT(inherits(vm, info()));
130
131}
132
133JSObject* JSSQLResultSetRowList::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
134{
135 return JSSQLResultSetRowListPrototype::create(vm, &globalObject, JSSQLResultSetRowListPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
136}
137
138JSObject* JSSQLResultSetRowList::prototype(VM& vm, JSDOMGlobalObject& globalObject)
139{
140 return getDOMPrototype<JSSQLResultSetRowList>(vm, globalObject);
141}
142
143JSValue JSSQLResultSetRowList::getConstructor(VM& vm, const JSGlobalObject* globalObject)
144{
145 return getDOMConstructor<JSSQLResultSetRowListConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
146}
147
148void JSSQLResultSetRowList::destroy(JSC::JSCell* cell)
149{
150 JSSQLResultSetRowList* thisObject = static_cast<JSSQLResultSetRowList*>(cell);
151 thisObject->JSSQLResultSetRowList::~JSSQLResultSetRowList();
152}
153
154template<> inline JSSQLResultSetRowList* IDLAttribute<JSSQLResultSetRowList>::cast(ExecState& state, EncodedJSValue thisValue)
155{
156 return jsDynamicCast<JSSQLResultSetRowList*>(state.vm(), JSValue::decode(thisValue));
157}
158
159template<> inline JSSQLResultSetRowList* IDLOperation<JSSQLResultSetRowList>::cast(ExecState& state)
160{
161 return jsDynamicCast<JSSQLResultSetRowList*>(state.vm(), state.thisValue());
162}
163
164EncodedJSValue jsSQLResultSetRowListConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
165{
166 VM& vm = state->vm();
167 auto throwScope = DECLARE_THROW_SCOPE(vm);
168 auto* prototype = jsDynamicCast<JSSQLResultSetRowListPrototype*>(vm, JSValue::decode(thisValue));
169 if (UNLIKELY(!prototype))
170 return throwVMTypeError(state, throwScope);
171 return JSValue::encode(JSSQLResultSetRowList::getConstructor(state->vm(), prototype->globalObject()));
172}
173
174bool setJSSQLResultSetRowListConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
175{
176 VM& vm = state->vm();
177 auto throwScope = DECLARE_THROW_SCOPE(vm);
178 auto* prototype = jsDynamicCast<JSSQLResultSetRowListPrototype*>(vm, JSValue::decode(thisValue));
179 if (UNLIKELY(!prototype)) {
180 throwVMTypeError(state, throwScope);
181 return false;
182 }
183 // Shadowing a built-in constructor
184 return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
185}
186
187static inline JSValue jsSQLResultSetRowListLengthGetter(ExecState& state, JSSQLResultSetRowList& thisObject, ThrowScope& throwScope)
188{
189 UNUSED_PARAM(throwScope);
190 UNUSED_PARAM(state);
191 auto& impl = thisObject.wrapped();
192 JSValue result = toJS<IDLUnsignedLong>(state, throwScope, impl.length());
193 return result;
194}
195
196EncodedJSValue jsSQLResultSetRowListLength(ExecState* state, EncodedJSValue thisValue, PropertyName)
197{
198 return IDLAttribute<JSSQLResultSetRowList>::get<jsSQLResultSetRowListLengthGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "length");
199}
200
201static inline JSC::EncodedJSValue jsSQLResultSetRowListPrototypeFunctionItemBody(JSC::ExecState* state, typename IDLOperation<JSSQLResultSetRowList>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
202{
203 UNUSED_PARAM(state);
204 UNUSED_PARAM(throwScope);
205 auto& impl = castedThis->wrapped();
206 if (UNLIKELY(state->argumentCount() < 1))
207 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
208 auto index = convert<IDLUnsignedLong>(*state, state->uncheckedArgument(0));
209 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
210 return JSValue::encode(toJS<IDLRecord<IDLDOMString, IDLUnion<IDLNull, IDLDOMString, IDLUnrestrictedDouble>>>(*state, *castedThis->globalObject(), throwScope, impl.item(WTFMove(index))));
211}
212
213EncodedJSValue JSC_HOST_CALL jsSQLResultSetRowListPrototypeFunctionItem(ExecState* state)
214{
215 return IDLOperation<JSSQLResultSetRowList>::call<jsSQLResultSetRowListPrototypeFunctionItemBody>(*state, "item");
216}
217
218void JSSQLResultSetRowList::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder)
219{
220 auto* thisObject = jsCast<JSSQLResultSetRowList*>(cell);
221 builder.setWrappedObjectForCell(cell, &thisObject->wrapped());
222 if (thisObject->scriptExecutionContext())
223 builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
224 Base::heapSnapshot(cell, builder);
225}
226
227bool JSSQLResultSetRowListOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason)
228{
229 UNUSED_PARAM(handle);
230 UNUSED_PARAM(visitor);
231 UNUSED_PARAM(reason);
232 return false;
233}
234
235void JSSQLResultSetRowListOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
236{
237 auto* jsSQLResultSetRowList = static_cast<JSSQLResultSetRowList*>(handle.slot()->asCell());
238 auto& world = *static_cast<DOMWrapperWorld*>(context);
239 uncacheWrapper(world, &jsSQLResultSetRowList->wrapped(), jsSQLResultSetRowList);
240}
241
242JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<SQLResultSetRowList>&& impl)
243{
244 // If you hit this failure the interface definition has the ImplementationLacksVTable
245 // attribute. You should remove that attribute. If the class has subclasses
246 // that may be passed through this toJS() function you should use the SkipVTableValidation
247 // attribute to SQLResultSetRowList.
248 static_assert(!std::is_polymorphic<SQLResultSetRowList>::value, "SQLResultSetRowList is polymorphic but the IDL claims it is not");
249 return createWrapper<SQLResultSetRowList>(globalObject, WTFMove(impl));
250}
251
252JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, SQLResultSetRowList& impl)
253{
254 return wrap(state, globalObject, impl);
255}
256
257SQLResultSetRowList* JSSQLResultSetRowList::toWrapped(JSC::VM& vm, JSC::JSValue value)
258{
259 if (auto* wrapper = jsDynamicCast<JSSQLResultSetRowList*>(vm, value))
260 return &wrapper->wrapped();
261 return nullptr;
262}
263
264}
265