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 "JSDOMPluginArray.h"
24 #include "DOMPlugin.h"
25 #include "DOMPluginArray.h"
26 #include "ExceptionCode.h"
27 #include "JSDOMBinding.h"
28 #include "JSDOMPlugin.h"
29 #include "wtf/text/AtomicString.h"
30 #include <runtime/Error.h>
31 #include <runtime/PropertyNameArray.h>
32 #include <wtf/GetPtr.h>
38 ASSERT_CLASS_FITS_IN_CELL(JSDOMPluginArray);
42 #define THUNK_GENERATOR(generator) , generator
44 #define THUNK_GENERATOR(generator)
47 #define INTRINSIC(intrinsic) , intrinsic
49 #define INTRINSIC(intrinsic)
52 static const HashTableValue JSDOMPluginArrayTableValues[] =
54 { "length", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMPluginArrayLength), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
55 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsDOMPluginArrayConstructor), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
56 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
59 #undef THUNK_GENERATOR
60 static const HashTable JSDOMPluginArrayTable = { 5, 3, JSDOMPluginArrayTableValues, 0 };
61 /* Hash table for constructor */
63 #define THUNK_GENERATOR(generator) , generator
65 #define THUNK_GENERATOR(generator)
68 #define INTRINSIC(intrinsic) , intrinsic
70 #define INTRINSIC(intrinsic)
73 static const HashTableValue JSDOMPluginArrayConstructorTableValues[] =
75 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
78 #undef THUNK_GENERATOR
79 static const HashTable JSDOMPluginArrayConstructorTable = { 1, 0, JSDOMPluginArrayConstructorTableValues, 0 };
80 const ClassInfo JSDOMPluginArrayConstructor::s_info = { "PluginArrayConstructor", &DOMConstructorObject::s_info, &JSDOMPluginArrayConstructorTable, 0, CREATE_METHOD_TABLE(JSDOMPluginArrayConstructor) };
82 JSDOMPluginArrayConstructor::JSDOMPluginArrayConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
83 : DOMConstructorObject(structure, globalObject)
87 void JSDOMPluginArrayConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
89 Base::finishCreation(exec->globalData());
90 ASSERT(inherits(&s_info));
91 putDirect(exec->globalData(), exec->propertyNames().prototype, JSDOMPluginArrayPrototype::self(exec, globalObject), DontDelete | ReadOnly);
94 bool JSDOMPluginArrayConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
96 return getStaticValueSlot<JSDOMPluginArrayConstructor, JSDOMWrapper>(exec, &JSDOMPluginArrayConstructorTable, static_cast<JSDOMPluginArrayConstructor*>(cell), propertyName, slot);
99 bool JSDOMPluginArrayConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
101 return getStaticValueDescriptor<JSDOMPluginArrayConstructor, JSDOMWrapper>(exec, &JSDOMPluginArrayConstructorTable, static_cast<JSDOMPluginArrayConstructor*>(object), propertyName, descriptor);
104 /* Hash table for prototype */
106 #define THUNK_GENERATOR(generator) , generator
108 #define THUNK_GENERATOR(generator)
111 #define INTRINSIC(intrinsic) , intrinsic
113 #define INTRINSIC(intrinsic)
116 static const HashTableValue JSDOMPluginArrayPrototypeTableValues[] =
118 { "item", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDOMPluginArrayPrototypeFunctionItem), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
119 { "namedItem", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDOMPluginArrayPrototypeFunctionNamedItem), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
120 { "refresh", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsDOMPluginArrayPrototypeFunctionRefresh), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
121 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
124 #undef THUNK_GENERATOR
125 static const HashTable JSDOMPluginArrayPrototypeTable = { 8, 7, JSDOMPluginArrayPrototypeTableValues, 0 };
126 const ClassInfo JSDOMPluginArrayPrototype::s_info = { "PluginArrayPrototype", &JSC::JSNonFinalObject::s_info, &JSDOMPluginArrayPrototypeTable, 0, CREATE_METHOD_TABLE(JSDOMPluginArrayPrototype) };
128 JSObject* JSDOMPluginArrayPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
130 return getDOMPrototype<JSDOMPluginArray>(exec, globalObject);
133 bool JSDOMPluginArrayPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
135 JSDOMPluginArrayPrototype* thisObject = jsCast<JSDOMPluginArrayPrototype*>(cell);
136 return getStaticFunctionSlot<JSObject>(exec, &JSDOMPluginArrayPrototypeTable, thisObject, propertyName, slot);
139 bool JSDOMPluginArrayPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
141 JSDOMPluginArrayPrototype* thisObject = jsCast<JSDOMPluginArrayPrototype*>(object);
142 return getStaticFunctionDescriptor<JSObject>(exec, &JSDOMPluginArrayPrototypeTable, thisObject, propertyName, descriptor);
145 const ClassInfo JSDOMPluginArray::s_info = { "PluginArray", &JSDOMWrapper::s_info, &JSDOMPluginArrayTable, 0 , CREATE_METHOD_TABLE(JSDOMPluginArray) };
147 JSDOMPluginArray::JSDOMPluginArray(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<DOMPluginArray> impl)
148 : JSDOMWrapper(structure, globalObject)
149 , m_impl(impl.leakRef())
153 void JSDOMPluginArray::finishCreation(JSGlobalData& globalData)
155 Base::finishCreation(globalData);
156 ASSERT(inherits(&s_info));
159 JSObject* JSDOMPluginArray::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
161 return JSDOMPluginArrayPrototype::create(exec->globalData(), globalObject, JSDOMPluginArrayPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
164 bool JSDOMPluginArray::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
166 JSDOMPluginArray* thisObject = jsCast<JSDOMPluginArray*>(cell);
167 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
168 const HashEntry* entry = JSDOMPluginArrayTable.entry(exec, propertyName);
170 slot.setCustom(thisObject, entry->propertyGetter());
174 unsigned index = propertyName.toUInt32(ok);
175 if (ok && index < static_cast<DOMPluginArray*>(thisObject->impl())->length()) {
176 slot.setCustomIndex(thisObject, index, indexGetter);
179 if (canGetItemsForName(exec, static_cast<DOMPluginArray*>(thisObject->impl()), propertyName)) {
180 slot.setCustom(thisObject, thisObject->nameGetter);
183 return getStaticValueSlot<JSDOMPluginArray, Base>(exec, &JSDOMPluginArrayTable, thisObject, propertyName, slot);
186 bool JSDOMPluginArray::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
188 JSDOMPluginArray* thisObject = jsCast<JSDOMPluginArray*>(object);
189 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
190 const HashEntry* entry = JSDOMPluginArrayTable.entry(exec, propertyName);
193 slot.setCustom(thisObject, entry->propertyGetter());
194 descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
198 unsigned index = propertyName.toUInt32(ok);
199 if (ok && index < static_cast<DOMPluginArray*>(thisObject->impl())->length()) {
201 slot.setCustomIndex(thisObject, index, indexGetter);
202 descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete | ReadOnly);
205 if (canGetItemsForName(exec, static_cast<DOMPluginArray*>(thisObject->impl()), propertyName)) {
207 slot.setCustom(thisObject, nameGetter);
208 descriptor.setDescriptor(slot.getValue(exec, propertyName), ReadOnly | DontDelete | DontEnum);
211 return getStaticValueDescriptor<JSDOMPluginArray, Base>(exec, &JSDOMPluginArrayTable, thisObject, propertyName, descriptor);
214 bool JSDOMPluginArray::getOwnPropertySlotByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, PropertySlot& slot)
216 JSDOMPluginArray* thisObject = jsCast<JSDOMPluginArray*>(cell);
217 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
218 if (propertyName < static_cast<DOMPluginArray*>(thisObject->impl())->length()) {
219 slot.setCustomIndex(thisObject, propertyName, thisObject->indexGetter);
222 return thisObject->methodTable()->getOwnPropertySlot(thisObject, exec, Identifier::from(exec, propertyName), slot);
225 JSValue jsDOMPluginArrayLength(ExecState* exec, JSValue slotBase, const Identifier&)
227 JSDOMPluginArray* castedThis = static_cast<JSDOMPluginArray*>(asObject(slotBase));
229 DOMPluginArray* imp = static_cast<DOMPluginArray*>(castedThis->impl());
230 JSValue result = jsNumber(imp->length());
235 JSValue jsDOMPluginArrayConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
237 JSDOMPluginArray* domObject = static_cast<JSDOMPluginArray*>(asObject(slotBase));
238 return JSDOMPluginArray::getConstructor(exec, domObject->globalObject());
241 void JSDOMPluginArray::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
243 JSDOMPluginArray* thisObject = jsCast<JSDOMPluginArray*>(object);
244 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
245 for (unsigned i = 0; i < static_cast<DOMPluginArray*>(thisObject->impl())->length(); ++i)
246 propertyNames.add(Identifier::from(exec, i));
247 Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode);
250 JSValue JSDOMPluginArray::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
252 return getDOMConstructor<JSDOMPluginArrayConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
255 EncodedJSValue JSC_HOST_CALL jsDOMPluginArrayPrototypeFunctionItem(ExecState* exec)
257 JSValue thisValue = exec->hostThisValue();
258 if (!thisValue.inherits(&JSDOMPluginArray::s_info))
259 return throwVMTypeError(exec);
260 JSDOMPluginArray* castedThis = static_cast<JSDOMPluginArray*>(asObject(thisValue));
261 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSDOMPluginArray::s_info);
262 DOMPluginArray* imp = static_cast<DOMPluginArray*>(castedThis->impl());
263 unsigned index(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toUInt32(exec));
264 if (exec->hadException())
265 return JSValue::encode(jsUndefined());
267 JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->item(index)));
268 return JSValue::encode(result);
271 EncodedJSValue JSC_HOST_CALL jsDOMPluginArrayPrototypeFunctionNamedItem(ExecState* exec)
273 JSValue thisValue = exec->hostThisValue();
274 if (!thisValue.inherits(&JSDOMPluginArray::s_info))
275 return throwVMTypeError(exec);
276 JSDOMPluginArray* castedThis = static_cast<JSDOMPluginArray*>(asObject(thisValue));
277 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSDOMPluginArray::s_info);
278 DOMPluginArray* imp = static_cast<DOMPluginArray*>(castedThis->impl());
279 const String& name(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec)));
280 if (exec->hadException())
281 return JSValue::encode(jsUndefined());
283 JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->namedItem(name)));
284 return JSValue::encode(result);
287 EncodedJSValue JSC_HOST_CALL jsDOMPluginArrayPrototypeFunctionRefresh(ExecState* exec)
289 JSValue thisValue = exec->hostThisValue();
290 if (!thisValue.inherits(&JSDOMPluginArray::s_info))
291 return throwVMTypeError(exec);
292 JSDOMPluginArray* castedThis = static_cast<JSDOMPluginArray*>(asObject(thisValue));
293 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSDOMPluginArray::s_info);
294 DOMPluginArray* imp = static_cast<DOMPluginArray*>(castedThis->impl());
295 bool reload(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toBoolean(exec));
296 if (exec->hadException())
297 return JSValue::encode(jsUndefined());
298 imp->refresh(reload);
299 return JSValue::encode(jsUndefined());
303 JSValue JSDOMPluginArray::indexGetter(ExecState* exec, JSValue slotBase, unsigned index)
305 JSDOMPluginArray* thisObj = static_cast<JSDOMPluginArray*>(asObject(slotBase));
306 ASSERT_GC_OBJECT_INHERITS(thisObj, &s_info);
307 return toJS(exec, thisObj->globalObject(), static_cast<DOMPluginArray*>(thisObj->impl())->item(index));
310 static inline bool isObservable(JSDOMPluginArray* jsDOMPluginArray)
312 if (jsDOMPluginArray->hasCustomProperties())
317 bool JSDOMPluginArrayOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
319 JSDOMPluginArray* jsDOMPluginArray = static_cast<JSDOMPluginArray*>(handle.get().asCell());
320 if (!isObservable(jsDOMPluginArray))
322 Frame* root = jsDOMPluginArray->impl()->frame();
325 return visitor.containsOpaqueRoot(root);
328 void JSDOMPluginArrayOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
330 JSDOMPluginArray* jsDOMPluginArray = static_cast<JSDOMPluginArray*>(handle.get().asCell());
331 DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
332 uncacheWrapper(world, jsDOMPluginArray->impl(), jsDOMPluginArray);
333 jsDOMPluginArray->releaseImpl();
336 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, DOMPluginArray* impl)
338 return wrap<JSDOMPluginArray>(exec, globalObject, impl);
341 DOMPluginArray* toDOMPluginArray(JSC::JSValue value)
343 return value.inherits(&JSDOMPluginArray::s_info) ? static_cast<JSDOMPluginArray*>(asObject(value))->impl() : 0;