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 "JSProgressEvent.h"
24 #include "JSDictionary.h"
25 #include "ProgressEvent.h"
26 #include <runtime/Error.h>
27 #include <wtf/GetPtr.h>
33 ASSERT_CLASS_FITS_IN_CELL(JSProgressEvent);
37 #define THUNK_GENERATOR(generator) , generator
39 #define THUNK_GENERATOR(generator)
42 #define INTRINSIC(intrinsic) , intrinsic
44 #define INTRINSIC(intrinsic)
47 static const HashTableValue JSProgressEventTableValues[] =
49 { "lengthComputable", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsProgressEventLengthComputable), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
50 { "loaded", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsProgressEventLoaded), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
51 { "total", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsProgressEventTotal), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
52 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsProgressEventConstructor), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
53 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
56 #undef THUNK_GENERATOR
57 static const HashTable JSProgressEventTable = { 9, 7, JSProgressEventTableValues, 0 };
58 /* Hash table for constructor */
60 #define THUNK_GENERATOR(generator) , generator
62 #define THUNK_GENERATOR(generator)
65 #define INTRINSIC(intrinsic) , intrinsic
67 #define INTRINSIC(intrinsic)
70 static const HashTableValue JSProgressEventConstructorTableValues[] =
72 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
75 #undef THUNK_GENERATOR
76 static const HashTable JSProgressEventConstructorTable = { 1, 0, JSProgressEventConstructorTableValues, 0 };
77 const ClassInfo JSProgressEventConstructor::s_info = { "ProgressEventConstructor", &DOMConstructorObject::s_info, &JSProgressEventConstructorTable, 0, CREATE_METHOD_TABLE(JSProgressEventConstructor) };
79 JSProgressEventConstructor::JSProgressEventConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
80 : DOMConstructorObject(structure, globalObject)
84 void JSProgressEventConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
86 Base::finishCreation(exec->globalData());
87 ASSERT(inherits(&s_info));
88 putDirect(exec->globalData(), exec->propertyNames().prototype, JSProgressEventPrototype::self(exec, globalObject), DontDelete | ReadOnly);
91 bool JSProgressEventConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
93 return getStaticValueSlot<JSProgressEventConstructor, JSDOMWrapper>(exec, &JSProgressEventConstructorTable, static_cast<JSProgressEventConstructor*>(cell), propertyName, slot);
96 bool JSProgressEventConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
98 return getStaticValueDescriptor<JSProgressEventConstructor, JSDOMWrapper>(exec, &JSProgressEventConstructorTable, static_cast<JSProgressEventConstructor*>(object), propertyName, descriptor);
101 EncodedJSValue JSC_HOST_CALL JSProgressEventConstructor::constructJSProgressEvent(ExecState* exec)
103 JSProgressEventConstructor* jsConstructor = static_cast<JSProgressEventConstructor*>(exec->callee());
105 ScriptExecutionContext* executionContext = jsConstructor->scriptExecutionContext();
106 if (!executionContext)
107 return throwVMError(exec, createReferenceError(exec, "Constructor associated execution context is unavailable"));
109 AtomicString eventType = ustringToAtomicString(exec->argument(0).toString(exec));
110 if (exec->hadException())
111 return JSValue::encode(jsUndefined());
113 ProgressEventInit eventInit;
115 JSValue initializerValue = exec->argument(1);
116 if (!initializerValue.isUndefinedOrNull()) {
117 // Given the above test, this will always yield an object.
118 JSObject* initializerObject = initializerValue.toObject(exec);
120 // Create the dictionary wrapper from the initializer object.
121 JSDictionary dictionary(exec, initializerObject);
123 // Attempt to fill in the EventInit.
124 if (!fillProgressEventInit(eventInit, dictionary))
125 return JSValue::encode(jsUndefined());
128 RefPtr<ProgressEvent> event = ProgressEvent::create(eventType, eventInit);
129 return JSValue::encode(toJS(exec, jsConstructor->globalObject(), event.get()));
132 bool fillProgressEventInit(ProgressEventInit& eventInit, JSDictionary& dictionary)
134 if (!fillEventInit(eventInit, dictionary))
137 if (!dictionary.tryGetProperty("lengthComputable", eventInit.lengthComputable))
139 if (!dictionary.tryGetProperty("loaded", eventInit.loaded))
141 if (!dictionary.tryGetProperty("total", eventInit.total))
146 ConstructType JSProgressEventConstructor::getConstructData(JSCell*, ConstructData& constructData)
148 constructData.native.function = constructJSProgressEvent;
149 return ConstructTypeHost;
152 /* Hash table for prototype */
154 #define THUNK_GENERATOR(generator) , generator
156 #define THUNK_GENERATOR(generator)
159 #define INTRINSIC(intrinsic) , intrinsic
161 #define INTRINSIC(intrinsic)
164 static const HashTableValue JSProgressEventPrototypeTableValues[] =
166 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
169 #undef THUNK_GENERATOR
170 static const HashTable JSProgressEventPrototypeTable = { 1, 0, JSProgressEventPrototypeTableValues, 0 };
171 const ClassInfo JSProgressEventPrototype::s_info = { "ProgressEventPrototype", &JSC::JSNonFinalObject::s_info, &JSProgressEventPrototypeTable, 0, CREATE_METHOD_TABLE(JSProgressEventPrototype) };
173 JSObject* JSProgressEventPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
175 return getDOMPrototype<JSProgressEvent>(exec, globalObject);
178 const ClassInfo JSProgressEvent::s_info = { "ProgressEvent", &JSEvent::s_info, &JSProgressEventTable, 0 , CREATE_METHOD_TABLE(JSProgressEvent) };
180 JSProgressEvent::JSProgressEvent(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<ProgressEvent> impl)
181 : JSEvent(structure, globalObject, impl)
185 void JSProgressEvent::finishCreation(JSGlobalData& globalData)
187 Base::finishCreation(globalData);
188 ASSERT(inherits(&s_info));
191 JSObject* JSProgressEvent::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
193 return JSProgressEventPrototype::create(exec->globalData(), globalObject, JSProgressEventPrototype::createStructure(exec->globalData(), globalObject, JSEventPrototype::self(exec, globalObject)));
196 bool JSProgressEvent::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
198 JSProgressEvent* thisObject = jsCast<JSProgressEvent*>(cell);
199 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
200 return getStaticValueSlot<JSProgressEvent, Base>(exec, &JSProgressEventTable, thisObject, propertyName, slot);
203 bool JSProgressEvent::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
205 JSProgressEvent* thisObject = jsCast<JSProgressEvent*>(object);
206 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
207 return getStaticValueDescriptor<JSProgressEvent, Base>(exec, &JSProgressEventTable, thisObject, propertyName, descriptor);
210 JSValue jsProgressEventLengthComputable(ExecState* exec, JSValue slotBase, const Identifier&)
212 JSProgressEvent* castedThis = static_cast<JSProgressEvent*>(asObject(slotBase));
214 ProgressEvent* imp = static_cast<ProgressEvent*>(castedThis->impl());
215 JSValue result = jsBoolean(imp->lengthComputable());
220 JSValue jsProgressEventLoaded(ExecState* exec, JSValue slotBase, const Identifier&)
222 JSProgressEvent* castedThis = static_cast<JSProgressEvent*>(asObject(slotBase));
224 ProgressEvent* imp = static_cast<ProgressEvent*>(castedThis->impl());
225 JSValue result = jsNumber(imp->loaded());
230 JSValue jsProgressEventTotal(ExecState* exec, JSValue slotBase, const Identifier&)
232 JSProgressEvent* castedThis = static_cast<JSProgressEvent*>(asObject(slotBase));
234 ProgressEvent* imp = static_cast<ProgressEvent*>(castedThis->impl());
235 JSValue result = jsNumber(imp->total());
240 JSValue jsProgressEventConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
242 JSProgressEvent* domObject = static_cast<JSProgressEvent*>(asObject(slotBase));
243 return JSProgressEvent::getConstructor(exec, domObject->globalObject());
246 JSValue JSProgressEvent::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
248 return getDOMConstructor<JSProgressEventConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));