tizen beta release
[profile/ivi/webkit-efl.git] / DerivedSources / WebCore / JSSQLError.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 "JSSQLError.h"
26
27 #include "KURL.h"
28 #include "SQLError.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(JSSQLError);
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 JSSQLErrorTableValues[] =
51 {
52     { "code", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLErrorCode), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
53     { "message", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLErrorMessage), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
54     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
55 };
56
57 #undef THUNK_GENERATOR
58 static const HashTable JSSQLErrorTable = { 4, 3, JSSQLErrorTableValues, 0 };
59 /* Hash table for prototype */
60 #if ENABLE(JIT)
61 #define THUNK_GENERATOR(generator) , generator
62 #else
63 #define THUNK_GENERATOR(generator)
64 #endif
65 #if ENABLE(DFG_JIT)
66 #define INTRINSIC(intrinsic) , intrinsic
67 #else
68 #define INTRINSIC(intrinsic)
69 #endif
70
71 static const HashTableValue JSSQLErrorPrototypeTableValues[] =
72 {
73     { "UNKNOWN_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLErrorUNKNOWN_ERR), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
74     { "DATABASE_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLErrorDATABASE_ERR), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
75     { "VERSION_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLErrorVERSION_ERR), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
76     { "TOO_LARGE_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLErrorTOO_LARGE_ERR), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
77     { "QUOTA_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLErrorQUOTA_ERR), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
78     { "SYNTAX_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLErrorSYNTAX_ERR), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
79     { "CONSTRAINT_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLErrorCONSTRAINT_ERR), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
80     { "TIMEOUT_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLErrorTIMEOUT_ERR), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
81     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
82 };
83
84 #undef THUNK_GENERATOR
85 static const HashTable JSSQLErrorPrototypeTable = { 16, 15, JSSQLErrorPrototypeTableValues, 0 };
86 static const HashTable* getJSSQLErrorPrototypeTable(ExecState* exec)
87 {
88     return getHashTableForGlobalData(exec->globalData(), &JSSQLErrorPrototypeTable);
89 }
90
91 const ClassInfo JSSQLErrorPrototype::s_info = { "SQLErrorPrototype", &JSC::JSNonFinalObject::s_info, 0, getJSSQLErrorPrototypeTable, CREATE_METHOD_TABLE(JSSQLErrorPrototype) };
92
93 JSObject* JSSQLErrorPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
94 {
95     return getDOMPrototype<JSSQLError>(exec, globalObject);
96 }
97
98 bool JSSQLErrorPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
99 {
100     JSSQLErrorPrototype* thisObject = jsCast<JSSQLErrorPrototype*>(cell);
101     return getStaticValueSlot<JSSQLErrorPrototype, JSObject>(exec, getJSSQLErrorPrototypeTable(exec), thisObject, propertyName, slot);
102 }
103
104 bool JSSQLErrorPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
105 {
106     JSSQLErrorPrototype* thisObject = jsCast<JSSQLErrorPrototype*>(object);
107     return getStaticValueDescriptor<JSSQLErrorPrototype, JSObject>(exec, getJSSQLErrorPrototypeTable(exec), thisObject, propertyName, descriptor);
108 }
109
110 static const HashTable* getJSSQLErrorTable(ExecState* exec)
111 {
112     return getHashTableForGlobalData(exec->globalData(), &JSSQLErrorTable);
113 }
114
115 const ClassInfo JSSQLError::s_info = { "SQLError", &JSDOMWrapper::s_info, 0, getJSSQLErrorTable , CREATE_METHOD_TABLE(JSSQLError) };
116
117 JSSQLError::JSSQLError(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<SQLError> impl)
118     : JSDOMWrapper(structure, globalObject)
119     , m_impl(impl.leakRef())
120 {
121 }
122
123 void JSSQLError::finishCreation(JSGlobalData& globalData)
124 {
125     Base::finishCreation(globalData);
126     ASSERT(inherits(&s_info));
127 }
128
129 JSObject* JSSQLError::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
130 {
131     return JSSQLErrorPrototype::create(exec->globalData(), globalObject, JSSQLErrorPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
132 }
133
134 bool JSSQLError::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
135 {
136     JSSQLError* thisObject = jsCast<JSSQLError*>(cell);
137     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
138     return getStaticValueSlot<JSSQLError, Base>(exec, getJSSQLErrorTable(exec), thisObject, propertyName, slot);
139 }
140
141 bool JSSQLError::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
142 {
143     JSSQLError* thisObject = jsCast<JSSQLError*>(object);
144     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
145     return getStaticValueDescriptor<JSSQLError, Base>(exec, getJSSQLErrorTable(exec), thisObject, propertyName, descriptor);
146 }
147
148 JSValue jsSQLErrorCode(ExecState* exec, JSValue slotBase, const Identifier&)
149 {
150     JSSQLError* castedThis = static_cast<JSSQLError*>(asObject(slotBase));
151     UNUSED_PARAM(exec);
152     SQLError* imp = static_cast<SQLError*>(castedThis->impl());
153     JSValue result = jsNumber(imp->code());
154     return result;
155 }
156
157
158 JSValue jsSQLErrorMessage(ExecState* exec, JSValue slotBase, const Identifier&)
159 {
160     JSSQLError* castedThis = static_cast<JSSQLError*>(asObject(slotBase));
161     UNUSED_PARAM(exec);
162     SQLError* imp = static_cast<SQLError*>(castedThis->impl());
163     JSValue result = jsString(exec, imp->message());
164     return result;
165 }
166
167
168 // Constant getters
169
170 JSValue jsSQLErrorUNKNOWN_ERR(ExecState* exec, JSValue, const Identifier&)
171 {
172     UNUSED_PARAM(exec);
173     return jsNumber(static_cast<int>(0));
174 }
175
176 JSValue jsSQLErrorDATABASE_ERR(ExecState* exec, JSValue, const Identifier&)
177 {
178     UNUSED_PARAM(exec);
179     return jsNumber(static_cast<int>(1));
180 }
181
182 JSValue jsSQLErrorVERSION_ERR(ExecState* exec, JSValue, const Identifier&)
183 {
184     UNUSED_PARAM(exec);
185     return jsNumber(static_cast<int>(2));
186 }
187
188 JSValue jsSQLErrorTOO_LARGE_ERR(ExecState* exec, JSValue, const Identifier&)
189 {
190     UNUSED_PARAM(exec);
191     return jsNumber(static_cast<int>(3));
192 }
193
194 JSValue jsSQLErrorQUOTA_ERR(ExecState* exec, JSValue, const Identifier&)
195 {
196     UNUSED_PARAM(exec);
197     return jsNumber(static_cast<int>(4));
198 }
199
200 JSValue jsSQLErrorSYNTAX_ERR(ExecState* exec, JSValue, const Identifier&)
201 {
202     UNUSED_PARAM(exec);
203     return jsNumber(static_cast<int>(5));
204 }
205
206 JSValue jsSQLErrorCONSTRAINT_ERR(ExecState* exec, JSValue, const Identifier&)
207 {
208     UNUSED_PARAM(exec);
209     return jsNumber(static_cast<int>(6));
210 }
211
212 JSValue jsSQLErrorTIMEOUT_ERR(ExecState* exec, JSValue, const Identifier&)
213 {
214     UNUSED_PARAM(exec);
215     return jsNumber(static_cast<int>(7));
216 }
217
218 static inline bool isObservable(JSSQLError* jsSQLError)
219 {
220     if (jsSQLError->hasCustomProperties())
221         return true;
222     return false;
223 }
224
225 bool JSSQLErrorOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
226 {
227     JSSQLError* jsSQLError = static_cast<JSSQLError*>(handle.get().asCell());
228     if (!isObservable(jsSQLError))
229         return false;
230     UNUSED_PARAM(visitor);
231     return false;
232 }
233
234 void JSSQLErrorOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
235 {
236     JSSQLError* jsSQLError = static_cast<JSSQLError*>(handle.get().asCell());
237     DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
238     uncacheWrapper(world, jsSQLError->impl(), jsSQLError);
239     jsSQLError->releaseImpl();
240 }
241
242 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, SQLError* impl)
243 {
244     return wrap<JSSQLError>(exec, globalObject, impl);
245 }
246
247 SQLError* toSQLError(JSC::JSValue value)
248 {
249     return value.inherits(&JSSQLError::s_info) ? static_cast<JSSQLError*>(asObject(value))->impl() : 0;
250 }
251
252 }
253
254 #endif // ENABLE(SQL_DATABASE)