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 
23 #if ENABLE(INDEXED_DATABASE)
24 
25 #include "JSIDBDatabaseError.h"
26 
27 #include "IDBDatabaseError.h"
28 #include "KURL.h"
29 #include <runtime/JSString.h>
30 #include <wtf/GetPtr.h>
31 
32 using namespace JSC;
33 
34 namespace WebCore {
35 
36 ASSERT_CLASS_FITS_IN_CELL(JSIDBDatabaseError);
37 
38 /* Hash table */
39 #if ENABLE(JIT)
40 #define THUNK_GENERATOR(generator) , generator
41 #else
42 #define THUNK_GENERATOR(generator)
43 #endif
44 
45 static const HashTableValue JSIDBDatabaseErrorTableValues[4] =
46 {
47     { "code", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBDatabaseErrorCode), (intptr_t)setJSIDBDatabaseErrorCode THUNK_GENERATOR(0) },
48     { "message", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBDatabaseErrorMessage), (intptr_t)setJSIDBDatabaseErrorMessage THUNK_GENERATOR(0) },
49     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBDatabaseErrorConstructor), (intptr_t)0 THUNK_GENERATOR(0) },
50     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
51 };
52 
53 #undef THUNK_GENERATOR
54 static JSC_CONST_HASHTABLE HashTable JSIDBDatabaseErrorTable = { 9, 7, JSIDBDatabaseErrorTableValues, 0 };
55 /* Hash table for constructor */
56 #if ENABLE(JIT)
57 #define THUNK_GENERATOR(generator) , generator
58 #else
59 #define THUNK_GENERATOR(generator)
60 #endif
61 
62 static const HashTableValue JSIDBDatabaseErrorConstructorTableValues[1] =
63 {
64     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
65 };
66 
67 #undef THUNK_GENERATOR
68 static JSC_CONST_HASHTABLE HashTable JSIDBDatabaseErrorConstructorTable = { 1, 0, JSIDBDatabaseErrorConstructorTableValues, 0 };
69 class JSIDBDatabaseErrorConstructor : public DOMConstructorObject {
70 public:
71     JSIDBDatabaseErrorConstructor(JSC::ExecState*, JSC::Structure*, JSDOMGlobalObject*);
72 
73     virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);
74     virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);
75     static const JSC::ClassInfo s_info;
createStructure(JSC::JSGlobalData & globalData,JSC::JSValue prototype)76     static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype)
77     {
78         return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
79     }
80 protected:
81     static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags;
82 };
83 
84 const ClassInfo JSIDBDatabaseErrorConstructor::s_info = { "IDBDatabaseErrorConstructor", &DOMConstructorObject::s_info, &JSIDBDatabaseErrorConstructorTable, 0 };
85 
JSIDBDatabaseErrorConstructor(ExecState * exec,Structure * structure,JSDOMGlobalObject * globalObject)86 JSIDBDatabaseErrorConstructor::JSIDBDatabaseErrorConstructor(ExecState* exec, Structure* structure, JSDOMGlobalObject* globalObject)
87     : DOMConstructorObject(structure, globalObject)
88 {
89     ASSERT(inherits(&s_info));
90     putDirect(exec->globalData(), exec->propertyNames().prototype, JSIDBDatabaseErrorPrototype::self(exec, globalObject), DontDelete | ReadOnly);
91 }
92 
getOwnPropertySlot(ExecState * exec,const Identifier & propertyName,PropertySlot & slot)93 bool JSIDBDatabaseErrorConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
94 {
95     return getStaticValueSlot<JSIDBDatabaseErrorConstructor, JSDOMWrapper>(exec, &JSIDBDatabaseErrorConstructorTable, this, propertyName, slot);
96 }
97 
getOwnPropertyDescriptor(ExecState * exec,const Identifier & propertyName,PropertyDescriptor & descriptor)98 bool JSIDBDatabaseErrorConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
99 {
100     return getStaticValueDescriptor<JSIDBDatabaseErrorConstructor, JSDOMWrapper>(exec, &JSIDBDatabaseErrorConstructorTable, this, propertyName, descriptor);
101 }
102 
103 /* Hash table for prototype */
104 #if ENABLE(JIT)
105 #define THUNK_GENERATOR(generator) , generator
106 #else
107 #define THUNK_GENERATOR(generator)
108 #endif
109 
110 static const HashTableValue JSIDBDatabaseErrorPrototypeTableValues[1] =
111 {
112     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
113 };
114 
115 #undef THUNK_GENERATOR
116 static JSC_CONST_HASHTABLE HashTable JSIDBDatabaseErrorPrototypeTable = { 1, 0, JSIDBDatabaseErrorPrototypeTableValues, 0 };
117 const ClassInfo JSIDBDatabaseErrorPrototype::s_info = { "IDBDatabaseErrorPrototype", &JSC::JSObjectWithGlobalObject::s_info, &JSIDBDatabaseErrorPrototypeTable, 0 };
118 
self(ExecState * exec,JSGlobalObject * globalObject)119 JSObject* JSIDBDatabaseErrorPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
120 {
121     return getDOMPrototype<JSIDBDatabaseError>(exec, globalObject);
122 }
123 
124 const ClassInfo JSIDBDatabaseError::s_info = { "IDBDatabaseError", &JSDOMWrapper::s_info, &JSIDBDatabaseErrorTable, 0 };
125 
JSIDBDatabaseError(Structure * structure,JSDOMGlobalObject * globalObject,PassRefPtr<IDBDatabaseError> impl)126 JSIDBDatabaseError::JSIDBDatabaseError(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<IDBDatabaseError> impl)
127     : JSDOMWrapper(structure, globalObject)
128     , m_impl(impl)
129 {
130     ASSERT(inherits(&s_info));
131 }
132 
createPrototype(ExecState * exec,JSGlobalObject * globalObject)133 JSObject* JSIDBDatabaseError::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
134 {
135     return new (exec) JSIDBDatabaseErrorPrototype(exec->globalData(), globalObject, JSIDBDatabaseErrorPrototype::createStructure(globalObject->globalData(), globalObject->objectPrototype()));
136 }
137 
getOwnPropertySlot(ExecState * exec,const Identifier & propertyName,PropertySlot & slot)138 bool JSIDBDatabaseError::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
139 {
140     return getStaticValueSlot<JSIDBDatabaseError, Base>(exec, &JSIDBDatabaseErrorTable, this, propertyName, slot);
141 }
142 
getOwnPropertyDescriptor(ExecState * exec,const Identifier & propertyName,PropertyDescriptor & descriptor)143 bool JSIDBDatabaseError::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
144 {
145     return getStaticValueDescriptor<JSIDBDatabaseError, Base>(exec, &JSIDBDatabaseErrorTable, this, propertyName, descriptor);
146 }
147 
jsIDBDatabaseErrorCode(ExecState * exec,JSValue slotBase,const Identifier &)148 JSValue jsIDBDatabaseErrorCode(ExecState* exec, JSValue slotBase, const Identifier&)
149 {
150     JSIDBDatabaseError* castedThis = static_cast<JSIDBDatabaseError*>(asObject(slotBase));
151     UNUSED_PARAM(exec);
152     IDBDatabaseError* imp = static_cast<IDBDatabaseError*>(castedThis->impl());
153     JSValue result = jsNumber(imp->code());
154     return result;
155 }
156 
157 
jsIDBDatabaseErrorMessage(ExecState * exec,JSValue slotBase,const Identifier &)158 JSValue jsIDBDatabaseErrorMessage(ExecState* exec, JSValue slotBase, const Identifier&)
159 {
160     JSIDBDatabaseError* castedThis = static_cast<JSIDBDatabaseError*>(asObject(slotBase));
161     UNUSED_PARAM(exec);
162     IDBDatabaseError* imp = static_cast<IDBDatabaseError*>(castedThis->impl());
163     JSValue result = jsString(exec, imp->message());
164     return result;
165 }
166 
167 
jsIDBDatabaseErrorConstructor(ExecState * exec,JSValue slotBase,const Identifier &)168 JSValue jsIDBDatabaseErrorConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
169 {
170     JSIDBDatabaseError* domObject = static_cast<JSIDBDatabaseError*>(asObject(slotBase));
171     return JSIDBDatabaseError::getConstructor(exec, domObject->globalObject());
172 }
173 
put(ExecState * exec,const Identifier & propertyName,JSValue value,PutPropertySlot & slot)174 void JSIDBDatabaseError::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
175 {
176     lookupPut<JSIDBDatabaseError, Base>(exec, propertyName, value, &JSIDBDatabaseErrorTable, this, slot);
177 }
178 
setJSIDBDatabaseErrorCode(ExecState * exec,JSObject * thisObject,JSValue value)179 void setJSIDBDatabaseErrorCode(ExecState* exec, JSObject* thisObject, JSValue value)
180 {
181     JSIDBDatabaseError* castedThis = static_cast<JSIDBDatabaseError*>(thisObject);
182     IDBDatabaseError* imp = static_cast<IDBDatabaseError*>(castedThis->impl());
183     imp->setCode(value.toUInt32(exec));
184 }
185 
186 
setJSIDBDatabaseErrorMessage(ExecState * exec,JSObject * thisObject,JSValue value)187 void setJSIDBDatabaseErrorMessage(ExecState* exec, JSObject* thisObject, JSValue value)
188 {
189     JSIDBDatabaseError* castedThis = static_cast<JSIDBDatabaseError*>(thisObject);
190     IDBDatabaseError* imp = static_cast<IDBDatabaseError*>(castedThis->impl());
191     imp->setMessage(ustringToString(value.toString(exec)));
192 }
193 
194 
getConstructor(ExecState * exec,JSGlobalObject * globalObject)195 JSValue JSIDBDatabaseError::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
196 {
197     return getDOMConstructor<JSIDBDatabaseErrorConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
198 }
199 
toJS(JSC::ExecState * exec,JSDOMGlobalObject * globalObject,IDBDatabaseError * impl)200 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, IDBDatabaseError* impl)
201 {
202     return wrap<JSIDBDatabaseError>(exec, globalObject, impl);
203 }
204 
toIDBDatabaseError(JSC::JSValue value)205 IDBDatabaseError* toIDBDatabaseError(JSC::JSValue value)
206 {
207     return value.inherits(&JSIDBDatabaseError::s_info) ? static_cast<JSIDBDatabaseError*>(asObject(value))->impl() : 0;
208 }
209 
210 }
211 
212 #endif // ENABLE(INDEXED_DATABASE)
213