2 This file is part of the WebKit open source project.
3 This file has been generated by generate-bindings.pl. DO NOT MODIFY!
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.
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.
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.
22 #include "JSDOMStringList.h"
24 #include "DOMStringList.h"
25 #include "ExceptionCode.h"
26 #include "JSDOMBinding.h"
28 #include <runtime/Error.h>
29 #include <runtime/PropertyNameArray.h>
30 #include <wtf/GetPtr.h>
36 ASSERT_CLASS_FITS_IN_CELL(JSDOMStringList);
40 #define THUNK_GENERATOR(generator) , generator
42 #define THUNK_GENERATOR(generator)
45 #define INTRINSIC(intrinsic) , intrinsic
47 #define INTRINSIC(intrinsic)
50 static const HashTableValue JSDOMStringListTableValues[] =
52 { "length", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMStringListLength), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
53 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMStringListConstructor), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
54 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
57 #undef THUNK_GENERATOR
58 static const HashTable JSDOMStringListTable = { 5, 3, JSDOMStringListTableValues, 0 };
59 /* Hash table for constructor */
61 #define THUNK_GENERATOR(generator) , generator
63 #define THUNK_GENERATOR(generator)
66 #define INTRINSIC(intrinsic) , intrinsic
68 #define INTRINSIC(intrinsic)
71 static const HashTableValue JSDOMStringListConstructorTableValues[] =
73 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
76 #undef THUNK_GENERATOR
77 static const HashTable JSDOMStringListConstructorTable = { 1, 0, JSDOMStringListConstructorTableValues, 0 };
78 const ClassInfo JSDOMStringListConstructor::s_info = { "DOMStringListConstructor", &DOMConstructorObject::s_info, &JSDOMStringListConstructorTable, 0, CREATE_METHOD_TABLE(JSDOMStringListConstructor) };
80 JSDOMStringListConstructor::JSDOMStringListConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
81 : DOMConstructorObject(structure, globalObject)
85 void JSDOMStringListConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
87 Base::finishCreation(exec->globalData());
88 ASSERT(inherits(&s_info));
89 putDirect(exec->globalData(), exec->propertyNames().prototype, JSDOMStringListPrototype::self(exec, globalObject), DontDelete | ReadOnly);
92 bool JSDOMStringListConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
94 return getStaticValueSlot<JSDOMStringListConstructor, JSDOMWrapper>(exec, &JSDOMStringListConstructorTable, static_cast<JSDOMStringListConstructor*>(cell), propertyName, slot);
97 bool JSDOMStringListConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
99 return getStaticValueDescriptor<JSDOMStringListConstructor, JSDOMWrapper>(exec, &JSDOMStringListConstructorTable, static_cast<JSDOMStringListConstructor*>(object), propertyName, descriptor);
102 /* Hash table for prototype */
104 #define THUNK_GENERATOR(generator) , generator
106 #define THUNK_GENERATOR(generator)
109 #define INTRINSIC(intrinsic) , intrinsic
111 #define INTRINSIC(intrinsic)
114 static const HashTableValue JSDOMStringListPrototypeTableValues[] =
116 { "item", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDOMStringListPrototypeFunctionItem), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
117 { "contains", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDOMStringListPrototypeFunctionContains), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
118 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
121 #undef THUNK_GENERATOR
122 static const HashTable JSDOMStringListPrototypeTable = { 4, 3, JSDOMStringListPrototypeTableValues, 0 };
123 const ClassInfo JSDOMStringListPrototype::s_info = { "DOMStringListPrototype", &JSC::JSNonFinalObject::s_info, &JSDOMStringListPrototypeTable, 0, CREATE_METHOD_TABLE(JSDOMStringListPrototype) };
125 JSObject* JSDOMStringListPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
127 return getDOMPrototype<JSDOMStringList>(exec, globalObject);
130 bool JSDOMStringListPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
132 JSDOMStringListPrototype* thisObject = jsCast<JSDOMStringListPrototype*>(cell);
133 return getStaticFunctionSlot<JSObject>(exec, &JSDOMStringListPrototypeTable, thisObject, propertyName, slot);
136 bool JSDOMStringListPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
138 JSDOMStringListPrototype* thisObject = jsCast<JSDOMStringListPrototype*>(object);
139 return getStaticFunctionDescriptor<JSObject>(exec, &JSDOMStringListPrototypeTable, thisObject, propertyName, descriptor);
142 const ClassInfo JSDOMStringList::s_info = { "DOMStringList", &JSDOMWrapper::s_info, &JSDOMStringListTable, 0 , CREATE_METHOD_TABLE(JSDOMStringList) };
144 JSDOMStringList::JSDOMStringList(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<DOMStringList> impl)
145 : JSDOMWrapper(structure, globalObject)
146 , m_impl(impl.leakRef())
150 void JSDOMStringList::finishCreation(JSGlobalData& globalData)
152 Base::finishCreation(globalData);
153 ASSERT(inherits(&s_info));
156 JSObject* JSDOMStringList::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
158 return JSDOMStringListPrototype::create(exec->globalData(), globalObject, JSDOMStringListPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
161 bool JSDOMStringList::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
163 JSDOMStringList* thisObject = jsCast<JSDOMStringList*>(cell);
164 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
165 const HashEntry* entry = JSDOMStringListTable.entry(exec, propertyName);
167 slot.setCustom(thisObject, entry->propertyGetter());
171 unsigned index = propertyName.toUInt32(ok);
173 slot.setCustomIndex(thisObject, index, indexGetter);
176 return getStaticValueSlot<JSDOMStringList, Base>(exec, &JSDOMStringListTable, thisObject, propertyName, slot);
179 bool JSDOMStringList::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
181 JSDOMStringList* thisObject = jsCast<JSDOMStringList*>(object);
182 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
183 const HashEntry* entry = JSDOMStringListTable.entry(exec, propertyName);
186 slot.setCustom(thisObject, entry->propertyGetter());
187 descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
191 unsigned index = propertyName.toUInt32(ok);
192 if (ok && index < static_cast<DOMStringList*>(thisObject->impl())->length()) {
194 slot.setCustomIndex(thisObject, index, indexGetter);
195 descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete | ReadOnly);
198 return getStaticValueDescriptor<JSDOMStringList, Base>(exec, &JSDOMStringListTable, thisObject, propertyName, descriptor);
201 bool JSDOMStringList::getOwnPropertySlotByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, PropertySlot& slot)
203 JSDOMStringList* thisObject = jsCast<JSDOMStringList*>(cell);
204 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
205 if (propertyName < static_cast<DOMStringList*>(thisObject->impl())->length()) {
206 slot.setCustomIndex(thisObject, propertyName, thisObject->indexGetter);
209 return thisObject->methodTable()->getOwnPropertySlot(thisObject, exec, Identifier::from(exec, propertyName), slot);
212 JSValue jsDOMStringListLength(ExecState* exec, JSValue slotBase, const Identifier&)
214 JSDOMStringList* castedThis = static_cast<JSDOMStringList*>(asObject(slotBase));
216 DOMStringList* imp = static_cast<DOMStringList*>(castedThis->impl());
217 JSValue result = jsNumber(imp->length());
222 JSValue jsDOMStringListConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
224 JSDOMStringList* domObject = static_cast<JSDOMStringList*>(asObject(slotBase));
225 return JSDOMStringList::getConstructor(exec, domObject->globalObject());
228 void JSDOMStringList::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
230 JSDOMStringList* thisObject = jsCast<JSDOMStringList*>(object);
231 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
232 for (unsigned i = 0; i < static_cast<DOMStringList*>(thisObject->impl())->length(); ++i)
233 propertyNames.add(Identifier::from(exec, i));
234 Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode);
237 JSValue JSDOMStringList::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
239 return getDOMConstructor<JSDOMStringListConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
242 EncodedJSValue JSC_HOST_CALL jsDOMStringListPrototypeFunctionItem(ExecState* exec)
244 JSValue thisValue = exec->hostThisValue();
245 if (!thisValue.inherits(&JSDOMStringList::s_info))
246 return throwVMTypeError(exec);
247 JSDOMStringList* castedThis = static_cast<JSDOMStringList*>(asObject(thisValue));
248 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSDOMStringList::s_info);
249 DOMStringList* imp = static_cast<DOMStringList*>(castedThis->impl());
250 int index(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toUInt32(exec));
252 setDOMException(exec, INDEX_SIZE_ERR);
253 return JSValue::encode(jsUndefined());
255 if (exec->hadException())
256 return JSValue::encode(jsUndefined());
258 JSC::JSValue result = jsStringOrNull(exec, imp->item(index));
259 return JSValue::encode(result);
262 EncodedJSValue JSC_HOST_CALL jsDOMStringListPrototypeFunctionContains(ExecState* exec)
264 JSValue thisValue = exec->hostThisValue();
265 if (!thisValue.inherits(&JSDOMStringList::s_info))
266 return throwVMTypeError(exec);
267 JSDOMStringList* castedThis = static_cast<JSDOMStringList*>(asObject(thisValue));
268 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSDOMStringList::s_info);
269 DOMStringList* imp = static_cast<DOMStringList*>(castedThis->impl());
270 const String& string(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec)));
271 if (exec->hadException())
272 return JSValue::encode(jsUndefined());
274 JSC::JSValue result = jsBoolean(imp->contains(string));
275 return JSValue::encode(result);
279 JSValue JSDOMStringList::indexGetter(ExecState* exec, JSValue slotBase, unsigned index)
281 JSDOMStringList* thisObj = static_cast<JSDOMStringList*>(asObject(slotBase));
282 ASSERT_GC_OBJECT_INHERITS(thisObj, &s_info);
283 return jsStringOrNull(exec, thisObj->impl()->item(index));
286 static inline bool isObservable(JSDOMStringList* jsDOMStringList)
288 if (jsDOMStringList->hasCustomProperties())
293 bool JSDOMStringListOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
295 JSDOMStringList* jsDOMStringList = static_cast<JSDOMStringList*>(handle.get().asCell());
296 if (!isObservable(jsDOMStringList))
298 UNUSED_PARAM(visitor);
302 void JSDOMStringListOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
304 JSDOMStringList* jsDOMStringList = static_cast<JSDOMStringList*>(handle.get().asCell());
305 DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
306 uncacheWrapper(world, jsDOMStringList->impl(), jsDOMStringList);
307 jsDOMStringList->releaseImpl();
310 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, DOMStringList* impl)
312 return wrap<JSDOMStringList>(exec, globalObject, impl);
315 DOMStringList* toDOMStringList(JSC::JSValue value)
317 return value.inherits(&JSDOMStringList::s_info) ? static_cast<JSDOMStringList*>(asObject(value))->impl() : 0;