tizen beta release
[profile/ivi/webkit-efl.git] / DerivedSources / WebCore / JSSQLException.cpp
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(SQL_DATABASE)
24
25 #include "JSSQLException.h"
26
27 #include "KURL.h"
28 #include "SQLException.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(JSSQLException);
37
38 /* Hash table */
39 #if ENABLE(JIT)
40 #define THUNK_GENERATOR(generator) , generator
41 #else
42 #define THUNK_GENERATOR(generator)
43 #endif
44 #if ENABLE(DFG_JIT)
45 #define INTRINSIC(intrinsic) , intrinsic
46 #else
47 #define INTRINSIC(intrinsic)
48 #endif
49
50 static const HashTableValue JSSQLExceptionTableValues[] =
51 {
52     { "code", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLExceptionCode), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
53     { "message", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLExceptionMessage), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
54     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLExceptionConstructor), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
55     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
56 };
57
58 #undef THUNK_GENERATOR
59 static const HashTable JSSQLExceptionTable = { 9, 7, JSSQLExceptionTableValues, 0 };
60 /* Hash table for constructor */
61 #if ENABLE(JIT)
62 #define THUNK_GENERATOR(generator) , generator
63 #else
64 #define THUNK_GENERATOR(generator)
65 #endif
66 #if ENABLE(DFG_JIT)
67 #define INTRINSIC(intrinsic) , intrinsic
68 #else
69 #define INTRINSIC(intrinsic)
70 #endif
71
72 static const HashTableValue JSSQLExceptionConstructorTableValues[] =
73 {
74     { "UNKNOWN_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLExceptionUNKNOWN_ERR), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
75     { "DATABASE_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLExceptionDATABASE_ERR), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
76     { "VERSION_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLExceptionVERSION_ERR), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
77     { "TOO_LARGE_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLExceptionTOO_LARGE_ERR), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
78     { "QUOTA_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLExceptionQUOTA_ERR), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
79     { "SYNTAX_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLExceptionSYNTAX_ERR), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
80     { "CONSTRAINT_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLExceptionCONSTRAINT_ERR), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
81     { "TIMEOUT_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLExceptionTIMEOUT_ERR), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
82     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
83 };
84
85 #undef THUNK_GENERATOR
86 static const HashTable JSSQLExceptionConstructorTable = { 16, 15, JSSQLExceptionConstructorTableValues, 0 };
87 const ClassInfo JSSQLExceptionConstructor::s_info = { "SQLExceptionConstructor", &DOMConstructorObject::s_info, &JSSQLExceptionConstructorTable, 0, CREATE_METHOD_TABLE(JSSQLExceptionConstructor) };
88
89 JSSQLExceptionConstructor::JSSQLExceptionConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
90     : DOMConstructorObject(structure, globalObject)
91 {
92 }
93
94 void JSSQLExceptionConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
95 {
96     Base::finishCreation(exec->globalData());
97     ASSERT(inherits(&s_info));
98     putDirect(exec->globalData(), exec->propertyNames().prototype, JSSQLExceptionPrototype::self(exec, globalObject), DontDelete | ReadOnly);
99 }
100
101 bool JSSQLExceptionConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
102 {
103     return getStaticValueSlot<JSSQLExceptionConstructor, JSDOMWrapper>(exec, &JSSQLExceptionConstructorTable, static_cast<JSSQLExceptionConstructor*>(cell), propertyName, slot);
104 }
105
106 bool JSSQLExceptionConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
107 {
108     return getStaticValueDescriptor<JSSQLExceptionConstructor, JSDOMWrapper>(exec, &JSSQLExceptionConstructorTable, static_cast<JSSQLExceptionConstructor*>(object), propertyName, descriptor);
109 }
110
111 /* Hash table for prototype */
112 #if ENABLE(JIT)
113 #define THUNK_GENERATOR(generator) , generator
114 #else
115 #define THUNK_GENERATOR(generator)
116 #endif
117 #if ENABLE(DFG_JIT)
118 #define INTRINSIC(intrinsic) , intrinsic
119 #else
120 #define INTRINSIC(intrinsic)
121 #endif
122
123 static const HashTableValue JSSQLExceptionPrototypeTableValues[] =
124 {
125     { "UNKNOWN_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLExceptionUNKNOWN_ERR), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
126     { "DATABASE_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLExceptionDATABASE_ERR), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
127     { "VERSION_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLExceptionVERSION_ERR), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
128     { "TOO_LARGE_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLExceptionTOO_LARGE_ERR), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
129     { "QUOTA_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLExceptionQUOTA_ERR), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
130     { "SYNTAX_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLExceptionSYNTAX_ERR), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
131     { "CONSTRAINT_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLExceptionCONSTRAINT_ERR), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
132     { "TIMEOUT_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLExceptionTIMEOUT_ERR), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
133     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
134 };
135
136 #undef THUNK_GENERATOR
137 static const HashTable JSSQLExceptionPrototypeTable = { 16, 15, JSSQLExceptionPrototypeTableValues, 0 };
138 static const HashTable* getJSSQLExceptionPrototypeTable(ExecState* exec)
139 {
140     return getHashTableForGlobalData(exec->globalData(), &JSSQLExceptionPrototypeTable);
141 }
142
143 const ClassInfo JSSQLExceptionPrototype::s_info = { "SQLExceptionPrototype", &JSC::JSNonFinalObject::s_info, 0, getJSSQLExceptionPrototypeTable, CREATE_METHOD_TABLE(JSSQLExceptionPrototype) };
144
145 JSObject* JSSQLExceptionPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
146 {
147     return getDOMPrototype<JSSQLException>(exec, globalObject);
148 }
149
150 bool JSSQLExceptionPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
151 {
152     JSSQLExceptionPrototype* thisObject = jsCast<JSSQLExceptionPrototype*>(cell);
153     return getStaticValueSlot<JSSQLExceptionPrototype, JSObject>(exec, getJSSQLExceptionPrototypeTable(exec), thisObject, propertyName, slot);
154 }
155
156 bool JSSQLExceptionPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
157 {
158     JSSQLExceptionPrototype* thisObject = jsCast<JSSQLExceptionPrototype*>(object);
159     return getStaticValueDescriptor<JSSQLExceptionPrototype, JSObject>(exec, getJSSQLExceptionPrototypeTable(exec), thisObject, propertyName, descriptor);
160 }
161
162 static const HashTable* getJSSQLExceptionTable(ExecState* exec)
163 {
164     return getHashTableForGlobalData(exec->globalData(), &JSSQLExceptionTable);
165 }
166
167 const ClassInfo JSSQLException::s_info = { "SQLException", &JSDOMWrapper::s_info, 0, getJSSQLExceptionTable , CREATE_METHOD_TABLE(JSSQLException) };
168
169 JSSQLException::JSSQLException(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<SQLException> impl)
170     : JSDOMWrapper(structure, globalObject)
171     , m_impl(impl.leakRef())
172 {
173 }
174
175 void JSSQLException::finishCreation(JSGlobalData& globalData)
176 {
177     Base::finishCreation(globalData);
178     ASSERT(inherits(&s_info));
179 }
180
181 JSObject* JSSQLException::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
182 {
183     return JSSQLExceptionPrototype::create(exec->globalData(), globalObject, JSSQLExceptionPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
184 }
185
186 bool JSSQLException::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
187 {
188     JSSQLException* thisObject = jsCast<JSSQLException*>(cell);
189     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
190     return getStaticValueSlot<JSSQLException, Base>(exec, getJSSQLExceptionTable(exec), thisObject, propertyName, slot);
191 }
192
193 bool JSSQLException::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
194 {
195     JSSQLException* thisObject = jsCast<JSSQLException*>(object);
196     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
197     return getStaticValueDescriptor<JSSQLException, Base>(exec, getJSSQLExceptionTable(exec), thisObject, propertyName, descriptor);
198 }
199
200 JSValue jsSQLExceptionCode(ExecState* exec, JSValue slotBase, const Identifier&)
201 {
202     JSSQLException* castedThis = static_cast<JSSQLException*>(asObject(slotBase));
203     UNUSED_PARAM(exec);
204     SQLException* imp = static_cast<SQLException*>(castedThis->impl());
205     JSValue result = jsNumber(imp->code());
206     return result;
207 }
208
209
210 JSValue jsSQLExceptionMessage(ExecState* exec, JSValue slotBase, const Identifier&)
211 {
212     JSSQLException* castedThis = static_cast<JSSQLException*>(asObject(slotBase));
213     UNUSED_PARAM(exec);
214     SQLException* imp = static_cast<SQLException*>(castedThis->impl());
215     JSValue result = jsString(exec, imp->message());
216     return result;
217 }
218
219
220 JSValue jsSQLExceptionConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
221 {
222     JSSQLException* domObject = static_cast<JSSQLException*>(asObject(slotBase));
223     return JSSQLException::getConstructor(exec, domObject->globalObject());
224 }
225
226 JSValue JSSQLException::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
227 {
228     return getDOMConstructor<JSSQLExceptionConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
229 }
230
231 // Constant getters
232
233 JSValue jsSQLExceptionUNKNOWN_ERR(ExecState* exec, JSValue, const Identifier&)
234 {
235     UNUSED_PARAM(exec);
236     return jsNumber(static_cast<int>(0));
237 }
238
239 JSValue jsSQLExceptionDATABASE_ERR(ExecState* exec, JSValue, const Identifier&)
240 {
241     UNUSED_PARAM(exec);
242     return jsNumber(static_cast<int>(1));
243 }
244
245 JSValue jsSQLExceptionVERSION_ERR(ExecState* exec, JSValue, const Identifier&)
246 {
247     UNUSED_PARAM(exec);
248     return jsNumber(static_cast<int>(2));
249 }
250
251 JSValue jsSQLExceptionTOO_LARGE_ERR(ExecState* exec, JSValue, const Identifier&)
252 {
253     UNUSED_PARAM(exec);
254     return jsNumber(static_cast<int>(3));
255 }
256
257 JSValue jsSQLExceptionQUOTA_ERR(ExecState* exec, JSValue, const Identifier&)
258 {
259     UNUSED_PARAM(exec);
260     return jsNumber(static_cast<int>(4));
261 }
262
263 JSValue jsSQLExceptionSYNTAX_ERR(ExecState* exec, JSValue, const Identifier&)
264 {
265     UNUSED_PARAM(exec);
266     return jsNumber(static_cast<int>(5));
267 }
268
269 JSValue jsSQLExceptionCONSTRAINT_ERR(ExecState* exec, JSValue, const Identifier&)
270 {
271     UNUSED_PARAM(exec);
272     return jsNumber(static_cast<int>(6));
273 }
274
275 JSValue jsSQLExceptionTIMEOUT_ERR(ExecState* exec, JSValue, const Identifier&)
276 {
277     UNUSED_PARAM(exec);
278     return jsNumber(static_cast<int>(7));
279 }
280
281 static inline bool isObservable(JSSQLException* jsSQLException)
282 {
283     if (jsSQLException->hasCustomProperties())
284         return true;
285     return false;
286 }
287
288 bool JSSQLExceptionOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
289 {
290     JSSQLException* jsSQLException = static_cast<JSSQLException*>(handle.get().asCell());
291     if (!isObservable(jsSQLException))
292         return false;
293     UNUSED_PARAM(visitor);
294     return false;
295 }
296
297 void JSSQLExceptionOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
298 {
299     JSSQLException* jsSQLException = static_cast<JSSQLException*>(handle.get().asCell());
300     DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
301     uncacheWrapper(world, jsSQLException->impl(), jsSQLException);
302     jsSQLException->releaseImpl();
303 }
304
305 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, SQLException* impl)
306 {
307     return wrap<JSSQLException>(exec, globalObject, impl);
308 }
309
310 SQLException* toSQLException(JSC::JSValue value)
311 {
312     return value.inherits(&JSSQLException::s_info) ? static_cast<JSSQLException*>(asObject(value))->impl() : 0;
313 }
314
315 }
316
317 #endif // ENABLE(SQL_DATABASE)