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 "JSFileList.h"
24 #include "ExceptionCode.h"
27 #include "JSDOMBinding.h"
29 #include <runtime/Error.h>
30 #include <runtime/PropertyNameArray.h>
31 #include <wtf/GetPtr.h>
37 ASSERT_CLASS_FITS_IN_CELL(JSFileList);
41 #define THUNK_GENERATOR(generator) , generator
43 #define THUNK_GENERATOR(generator)
46 #define INTRINSIC(intrinsic) , intrinsic
48 #define INTRINSIC(intrinsic)
51 static const HashTableValue JSFileListTableValues[] =
53 { "length", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsFileListLength), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
54 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsFileListConstructor), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
55 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
58 #undef THUNK_GENERATOR
59 static const HashTable JSFileListTable = { 5, 3, JSFileListTableValues, 0 };
60 /* Hash table for constructor */
62 #define THUNK_GENERATOR(generator) , generator
64 #define THUNK_GENERATOR(generator)
67 #define INTRINSIC(intrinsic) , intrinsic
69 #define INTRINSIC(intrinsic)
72 static const HashTableValue JSFileListConstructorTableValues[] =
74 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
77 #undef THUNK_GENERATOR
78 static const HashTable JSFileListConstructorTable = { 1, 0, JSFileListConstructorTableValues, 0 };
79 const ClassInfo JSFileListConstructor::s_info = { "FileListConstructor", &DOMConstructorObject::s_info, &JSFileListConstructorTable, 0, CREATE_METHOD_TABLE(JSFileListConstructor) };
81 JSFileListConstructor::JSFileListConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
82 : DOMConstructorObject(structure, globalObject)
86 void JSFileListConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
88 Base::finishCreation(exec->globalData());
89 ASSERT(inherits(&s_info));
90 putDirect(exec->globalData(), exec->propertyNames().prototype, JSFileListPrototype::self(exec, globalObject), DontDelete | ReadOnly);
93 bool JSFileListConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
95 return getStaticValueSlot<JSFileListConstructor, JSDOMWrapper>(exec, &JSFileListConstructorTable, static_cast<JSFileListConstructor*>(cell), propertyName, slot);
98 bool JSFileListConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
100 return getStaticValueDescriptor<JSFileListConstructor, JSDOMWrapper>(exec, &JSFileListConstructorTable, static_cast<JSFileListConstructor*>(object), propertyName, descriptor);
103 /* Hash table for prototype */
105 #define THUNK_GENERATOR(generator) , generator
107 #define THUNK_GENERATOR(generator)
110 #define INTRINSIC(intrinsic) , intrinsic
112 #define INTRINSIC(intrinsic)
115 static const HashTableValue JSFileListPrototypeTableValues[] =
117 { "item", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsFileListPrototypeFunctionItem), (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 JSFileListPrototypeTable = { 2, 1, JSFileListPrototypeTableValues, 0 };
123 static const HashTable* getJSFileListPrototypeTable(ExecState* exec)
125 return getHashTableForGlobalData(exec->globalData(), &JSFileListPrototypeTable);
128 const ClassInfo JSFileListPrototype::s_info = { "FileListPrototype", &JSC::JSNonFinalObject::s_info, 0, getJSFileListPrototypeTable, CREATE_METHOD_TABLE(JSFileListPrototype) };
130 JSObject* JSFileListPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
132 return getDOMPrototype<JSFileList>(exec, globalObject);
135 bool JSFileListPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
137 JSFileListPrototype* thisObject = jsCast<JSFileListPrototype*>(cell);
138 return getStaticFunctionSlot<JSObject>(exec, getJSFileListPrototypeTable(exec), thisObject, propertyName, slot);
141 bool JSFileListPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
143 JSFileListPrototype* thisObject = jsCast<JSFileListPrototype*>(object);
144 return getStaticFunctionDescriptor<JSObject>(exec, getJSFileListPrototypeTable(exec), thisObject, propertyName, descriptor);
147 static const HashTable* getJSFileListTable(ExecState* exec)
149 return getHashTableForGlobalData(exec->globalData(), &JSFileListTable);
152 const ClassInfo JSFileList::s_info = { "FileList", &JSDOMWrapper::s_info, 0, getJSFileListTable , CREATE_METHOD_TABLE(JSFileList) };
154 JSFileList::JSFileList(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<FileList> impl)
155 : JSDOMWrapper(structure, globalObject)
156 , m_impl(impl.leakRef())
160 void JSFileList::finishCreation(JSGlobalData& globalData)
162 Base::finishCreation(globalData);
163 ASSERT(inherits(&s_info));
166 JSObject* JSFileList::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
168 return JSFileListPrototype::create(exec->globalData(), globalObject, JSFileListPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
171 bool JSFileList::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
173 JSFileList* thisObject = jsCast<JSFileList*>(cell);
174 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
175 const HashEntry* entry = JSFileListTable.entry(exec, propertyName);
177 slot.setCustom(thisObject, entry->propertyGetter());
181 unsigned index = propertyName.toUInt32(ok);
182 if (ok && index < static_cast<FileList*>(thisObject->impl())->length()) {
183 slot.setCustomIndex(thisObject, index, indexGetter);
186 return getStaticValueSlot<JSFileList, Base>(exec, getJSFileListTable(exec), thisObject, propertyName, slot);
189 bool JSFileList::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
191 JSFileList* thisObject = jsCast<JSFileList*>(object);
192 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
193 const HashEntry* entry = JSFileListTable.entry(exec, propertyName);
196 slot.setCustom(thisObject, entry->propertyGetter());
197 descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
201 unsigned index = propertyName.toUInt32(ok);
202 if (ok && index < static_cast<FileList*>(thisObject->impl())->length()) {
204 slot.setCustomIndex(thisObject, index, indexGetter);
205 descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete | ReadOnly);
208 return getStaticValueDescriptor<JSFileList, Base>(exec, getJSFileListTable(exec), thisObject, propertyName, descriptor);
211 bool JSFileList::getOwnPropertySlotByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, PropertySlot& slot)
213 JSFileList* thisObject = jsCast<JSFileList*>(cell);
214 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
215 if (propertyName < static_cast<FileList*>(thisObject->impl())->length()) {
216 slot.setCustomIndex(thisObject, propertyName, thisObject->indexGetter);
219 return thisObject->methodTable()->getOwnPropertySlot(thisObject, exec, Identifier::from(exec, propertyName), slot);
222 JSValue jsFileListLength(ExecState* exec, JSValue slotBase, const Identifier&)
224 JSFileList* castedThis = static_cast<JSFileList*>(asObject(slotBase));
226 FileList* imp = static_cast<FileList*>(castedThis->impl());
227 JSValue result = jsNumber(imp->length());
232 JSValue jsFileListConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
234 JSFileList* domObject = static_cast<JSFileList*>(asObject(slotBase));
235 return JSFileList::getConstructor(exec, domObject->globalObject());
238 void JSFileList::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
240 JSFileList* thisObject = jsCast<JSFileList*>(object);
241 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
242 for (unsigned i = 0; i < static_cast<FileList*>(thisObject->impl())->length(); ++i)
243 propertyNames.add(Identifier::from(exec, i));
244 Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode);
247 JSValue JSFileList::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
249 return getDOMConstructor<JSFileListConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
252 EncodedJSValue JSC_HOST_CALL jsFileListPrototypeFunctionItem(ExecState* exec)
254 JSValue thisValue = exec->hostThisValue();
255 if (!thisValue.inherits(&JSFileList::s_info))
256 return throwVMTypeError(exec);
257 JSFileList* castedThis = static_cast<JSFileList*>(asObject(thisValue));
258 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSFileList::s_info);
259 FileList* imp = static_cast<FileList*>(castedThis->impl());
260 if (exec->argumentCount() < 1)
261 return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
262 int index(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toUInt32(exec));
264 setDOMException(exec, INDEX_SIZE_ERR);
265 return JSValue::encode(jsUndefined());
267 if (exec->hadException())
268 return JSValue::encode(jsUndefined());
270 JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->item(index)));
271 return JSValue::encode(result);
275 JSValue JSFileList::indexGetter(ExecState* exec, JSValue slotBase, unsigned index)
277 JSFileList* thisObj = static_cast<JSFileList*>(asObject(slotBase));
278 ASSERT_GC_OBJECT_INHERITS(thisObj, &s_info);
279 return toJS(exec, thisObj->globalObject(), static_cast<FileList*>(thisObj->impl())->item(index));
282 static inline bool isObservable(JSFileList* jsFileList)
284 if (jsFileList->hasCustomProperties())
289 bool JSFileListOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
291 JSFileList* jsFileList = static_cast<JSFileList*>(handle.get().asCell());
292 if (!isObservable(jsFileList))
294 UNUSED_PARAM(visitor);
298 void JSFileListOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
300 JSFileList* jsFileList = static_cast<JSFileList*>(handle.get().asCell());
301 DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
302 uncacheWrapper(world, jsFileList->impl(), jsFileList);
303 jsFileList->releaseImpl();
306 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, FileList* impl)
308 return wrap<JSFileList>(exec, globalObject, impl);
311 FileList* toFileList(JSC::JSValue value)
313 return value.inherits(&JSFileList::s_info) ? static_cast<JSFileList*>(asObject(value))->impl() : 0;