|
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(DATABASE) |
|
24 |
|
25 #include "JSSQLError.h" |
|
26 |
|
27 #include "KURL.h" |
|
28 #include "SQLError.h" |
|
29 #include <runtime/JSNumberCell.h> |
|
30 #include <runtime/JSString.h> |
|
31 #include <wtf/GetPtr.h> |
|
32 |
|
33 using namespace JSC; |
|
34 |
|
35 namespace WebCore { |
|
36 |
|
37 ASSERT_CLASS_FITS_IN_CELL(JSSQLError); |
|
38 |
|
39 /* Hash table */ |
|
40 #if ENABLE(JIT) |
|
41 #define THUNK_GENERATOR(generator) , generator |
|
42 #else |
|
43 #define THUNK_GENERATOR(generator) |
|
44 #endif |
|
45 |
|
46 static const HashTableValue JSSQLErrorTableValues[3] = |
|
47 { |
|
48 { "code", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLErrorCode), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
49 { "message", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLErrorMessage), (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 JSSQLErrorTable = { 4, 3, JSSQLErrorTableValues, 0 }; |
|
55 /* Hash table for prototype */ |
|
56 #if ENABLE(JIT) |
|
57 #define THUNK_GENERATOR(generator) , generator |
|
58 #else |
|
59 #define THUNK_GENERATOR(generator) |
|
60 #endif |
|
61 |
|
62 static const HashTableValue JSSQLErrorPrototypeTableValues[9] = |
|
63 { |
|
64 { "UNKNOWN_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLErrorUNKNOWN_ERR), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
65 { "DATABASE_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLErrorDATABASE_ERR), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
66 { "VERSION_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLErrorVERSION_ERR), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
67 { "TOO_LARGE_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLErrorTOO_LARGE_ERR), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
68 { "QUOTA_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLErrorQUOTA_ERR), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
69 { "SYNTAX_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLErrorSYNTAX_ERR), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
70 { "CONSTRAINT_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLErrorCONSTRAINT_ERR), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
71 { "TIMEOUT_ERR", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLErrorTIMEOUT_ERR), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
72 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
73 }; |
|
74 |
|
75 #undef THUNK_GENERATOR |
|
76 static JSC_CONST_HASHTABLE HashTable JSSQLErrorPrototypeTable = { 16, 15, JSSQLErrorPrototypeTableValues, 0 }; |
|
77 static const HashTable* getJSSQLErrorPrototypeTable(ExecState* exec) |
|
78 { |
|
79 return getHashTableForGlobalData(exec->globalData(), &JSSQLErrorPrototypeTable); |
|
80 } |
|
81 const ClassInfo JSSQLErrorPrototype::s_info = { "SQLErrorPrototype", 0, 0, getJSSQLErrorPrototypeTable }; |
|
82 |
|
83 JSObject* JSSQLErrorPrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
84 { |
|
85 return getDOMPrototype<JSSQLError>(exec, globalObject); |
|
86 } |
|
87 |
|
88 bool JSSQLErrorPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
89 { |
|
90 return getStaticValueSlot<JSSQLErrorPrototype, JSObject>(exec, getJSSQLErrorPrototypeTable(exec), this, propertyName, slot); |
|
91 } |
|
92 |
|
93 bool JSSQLErrorPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
94 { |
|
95 return getStaticValueDescriptor<JSSQLErrorPrototype, JSObject>(exec, getJSSQLErrorPrototypeTable(exec), this, propertyName, descriptor); |
|
96 } |
|
97 |
|
98 static const HashTable* getJSSQLErrorTable(ExecState* exec) |
|
99 { |
|
100 return getHashTableForGlobalData(exec->globalData(), &JSSQLErrorTable); |
|
101 } |
|
102 const ClassInfo JSSQLError::s_info = { "SQLError", 0, 0, getJSSQLErrorTable }; |
|
103 |
|
104 JSSQLError::JSSQLError(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<SQLError> impl) |
|
105 : DOMObjectWithGlobalPointer(structure, globalObject) |
|
106 , m_impl(impl) |
|
107 { |
|
108 } |
|
109 |
|
110 JSSQLError::~JSSQLError() |
|
111 { |
|
112 forgetDOMObject(this, impl()); |
|
113 } |
|
114 |
|
115 JSObject* JSSQLError::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
116 { |
|
117 return new (exec) JSSQLErrorPrototype(globalObject, JSSQLErrorPrototype::createStructure(globalObject->objectPrototype())); |
|
118 } |
|
119 |
|
120 bool JSSQLError::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
121 { |
|
122 return getStaticValueSlot<JSSQLError, Base>(exec, getJSSQLErrorTable(exec), this, propertyName, slot); |
|
123 } |
|
124 |
|
125 bool JSSQLError::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
126 { |
|
127 return getStaticValueDescriptor<JSSQLError, Base>(exec, getJSSQLErrorTable(exec), this, propertyName, descriptor); |
|
128 } |
|
129 |
|
130 JSValue jsSQLErrorCode(ExecState* exec, JSValue slotBase, const Identifier&) |
|
131 { |
|
132 JSSQLError* castedThis = static_cast<JSSQLError*>(asObject(slotBase)); |
|
133 UNUSED_PARAM(exec); |
|
134 SQLError* imp = static_cast<SQLError*>(castedThis->impl()); |
|
135 JSValue result = jsNumber(exec, imp->code()); |
|
136 return result; |
|
137 } |
|
138 |
|
139 JSValue jsSQLErrorMessage(ExecState* exec, JSValue slotBase, const Identifier&) |
|
140 { |
|
141 JSSQLError* castedThis = static_cast<JSSQLError*>(asObject(slotBase)); |
|
142 UNUSED_PARAM(exec); |
|
143 SQLError* imp = static_cast<SQLError*>(castedThis->impl()); |
|
144 JSValue result = jsString(exec, imp->message()); |
|
145 return result; |
|
146 } |
|
147 |
|
148 // Constant getters |
|
149 |
|
150 JSValue jsSQLErrorUNKNOWN_ERR(ExecState* exec, JSValue, const Identifier&) |
|
151 { |
|
152 return jsNumber(exec, static_cast<int>(0)); |
|
153 } |
|
154 |
|
155 JSValue jsSQLErrorDATABASE_ERR(ExecState* exec, JSValue, const Identifier&) |
|
156 { |
|
157 return jsNumber(exec, static_cast<int>(1)); |
|
158 } |
|
159 |
|
160 JSValue jsSQLErrorVERSION_ERR(ExecState* exec, JSValue, const Identifier&) |
|
161 { |
|
162 return jsNumber(exec, static_cast<int>(2)); |
|
163 } |
|
164 |
|
165 JSValue jsSQLErrorTOO_LARGE_ERR(ExecState* exec, JSValue, const Identifier&) |
|
166 { |
|
167 return jsNumber(exec, static_cast<int>(3)); |
|
168 } |
|
169 |
|
170 JSValue jsSQLErrorQUOTA_ERR(ExecState* exec, JSValue, const Identifier&) |
|
171 { |
|
172 return jsNumber(exec, static_cast<int>(4)); |
|
173 } |
|
174 |
|
175 JSValue jsSQLErrorSYNTAX_ERR(ExecState* exec, JSValue, const Identifier&) |
|
176 { |
|
177 return jsNumber(exec, static_cast<int>(5)); |
|
178 } |
|
179 |
|
180 JSValue jsSQLErrorCONSTRAINT_ERR(ExecState* exec, JSValue, const Identifier&) |
|
181 { |
|
182 return jsNumber(exec, static_cast<int>(6)); |
|
183 } |
|
184 |
|
185 JSValue jsSQLErrorTIMEOUT_ERR(ExecState* exec, JSValue, const Identifier&) |
|
186 { |
|
187 return jsNumber(exec, static_cast<int>(7)); |
|
188 } |
|
189 |
|
190 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, SQLError* object) |
|
191 { |
|
192 return getDOMObjectWrapper<JSSQLError>(exec, globalObject, object); |
|
193 } |
|
194 SQLError* toSQLError(JSC::JSValue value) |
|
195 { |
|
196 return value.inherits(&JSSQLError::s_info) ? static_cast<JSSQLError*>(asObject(value))->impl() : 0; |
|
197 } |
|
198 |
|
199 } |
|
200 |
|
201 #endif // ENABLE(DATABASE) |