|
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 "JSIDBDatabaseRequest.h" |
|
26 |
|
27 #include "DOMStringList.h" |
|
28 #include "IDBDatabaseRequest.h" |
|
29 #include "IDBObjectStoreRequest.h" |
|
30 #include "IDBRequest.h" |
|
31 #include "JSDOMStringList.h" |
|
32 #include "JSIDBObjectStoreRequest.h" |
|
33 #include "JSIDBRequest.h" |
|
34 #include "KURL.h" |
|
35 #include <runtime/Error.h> |
|
36 #include <runtime/JSString.h> |
|
37 #include <wtf/GetPtr.h> |
|
38 |
|
39 using namespace JSC; |
|
40 |
|
41 namespace WebCore { |
|
42 |
|
43 ASSERT_CLASS_FITS_IN_CELL(JSIDBDatabaseRequest); |
|
44 |
|
45 /* Hash table */ |
|
46 #if ENABLE(JIT) |
|
47 #define THUNK_GENERATOR(generator) , generator |
|
48 #else |
|
49 #define THUNK_GENERATOR(generator) |
|
50 #endif |
|
51 |
|
52 static const HashTableValue JSIDBDatabaseRequestTableValues[6] = |
|
53 { |
|
54 { "name", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBDatabaseRequestName), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
55 { "description", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBDatabaseRequestDescription), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
56 { "version", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBDatabaseRequestVersion), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
57 { "objectStores", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBDatabaseRequestObjectStores), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
58 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBDatabaseRequestConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
59 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
60 }; |
|
61 |
|
62 #undef THUNK_GENERATOR |
|
63 static JSC_CONST_HASHTABLE HashTable JSIDBDatabaseRequestTable = { 18, 15, JSIDBDatabaseRequestTableValues, 0 }; |
|
64 /* Hash table for constructor */ |
|
65 #if ENABLE(JIT) |
|
66 #define THUNK_GENERATOR(generator) , generator |
|
67 #else |
|
68 #define THUNK_GENERATOR(generator) |
|
69 #endif |
|
70 |
|
71 static const HashTableValue JSIDBDatabaseRequestConstructorTableValues[1] = |
|
72 { |
|
73 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
74 }; |
|
75 |
|
76 #undef THUNK_GENERATOR |
|
77 static JSC_CONST_HASHTABLE HashTable JSIDBDatabaseRequestConstructorTable = { 1, 0, JSIDBDatabaseRequestConstructorTableValues, 0 }; |
|
78 class JSIDBDatabaseRequestConstructor : public DOMConstructorObject { |
|
79 public: |
|
80 JSIDBDatabaseRequestConstructor(JSC::ExecState*, JSDOMGlobalObject*); |
|
81 |
|
82 virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); |
|
83 virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); |
|
84 virtual const JSC::ClassInfo* classInfo() const { return &s_info; } |
|
85 static const JSC::ClassInfo s_info; |
|
86 static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) |
|
87 { |
|
88 return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); |
|
89 } |
|
90 protected: |
|
91 static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; |
|
92 }; |
|
93 |
|
94 const ClassInfo JSIDBDatabaseRequestConstructor::s_info = { "IDBDatabaseRequestConstructor", 0, &JSIDBDatabaseRequestConstructorTable, 0 }; |
|
95 |
|
96 JSIDBDatabaseRequestConstructor::JSIDBDatabaseRequestConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) |
|
97 : DOMConstructorObject(JSIDBDatabaseRequestConstructor::createStructure(globalObject->objectPrototype()), globalObject) |
|
98 { |
|
99 putDirect(exec->propertyNames().prototype, JSIDBDatabaseRequestPrototype::self(exec, globalObject), DontDelete | ReadOnly); |
|
100 } |
|
101 |
|
102 bool JSIDBDatabaseRequestConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
103 { |
|
104 return getStaticValueSlot<JSIDBDatabaseRequestConstructor, DOMObject>(exec, &JSIDBDatabaseRequestConstructorTable, this, propertyName, slot); |
|
105 } |
|
106 |
|
107 bool JSIDBDatabaseRequestConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
108 { |
|
109 return getStaticValueDescriptor<JSIDBDatabaseRequestConstructor, DOMObject>(exec, &JSIDBDatabaseRequestConstructorTable, this, propertyName, descriptor); |
|
110 } |
|
111 |
|
112 /* Hash table for prototype */ |
|
113 #if ENABLE(JIT) |
|
114 #define THUNK_GENERATOR(generator) , generator |
|
115 #else |
|
116 #define THUNK_GENERATOR(generator) |
|
117 #endif |
|
118 |
|
119 static const HashTableValue JSIDBDatabaseRequestPrototypeTableValues[4] = |
|
120 { |
|
121 { "createObjectStore", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsIDBDatabaseRequestPrototypeFunctionCreateObjectStore), (intptr_t)3 THUNK_GENERATOR(0) }, |
|
122 { "objectStore", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsIDBDatabaseRequestPrototypeFunctionObjectStore), (intptr_t)2 THUNK_GENERATOR(0) }, |
|
123 { "removeObjectStore", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsIDBDatabaseRequestPrototypeFunctionRemoveObjectStore), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
124 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
125 }; |
|
126 |
|
127 #undef THUNK_GENERATOR |
|
128 static JSC_CONST_HASHTABLE HashTable JSIDBDatabaseRequestPrototypeTable = { 8, 7, JSIDBDatabaseRequestPrototypeTableValues, 0 }; |
|
129 const ClassInfo JSIDBDatabaseRequestPrototype::s_info = { "IDBDatabaseRequestPrototype", 0, &JSIDBDatabaseRequestPrototypeTable, 0 }; |
|
130 |
|
131 JSObject* JSIDBDatabaseRequestPrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
132 { |
|
133 return getDOMPrototype<JSIDBDatabaseRequest>(exec, globalObject); |
|
134 } |
|
135 |
|
136 bool JSIDBDatabaseRequestPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
137 { |
|
138 return getStaticFunctionSlot<JSObject>(exec, &JSIDBDatabaseRequestPrototypeTable, this, propertyName, slot); |
|
139 } |
|
140 |
|
141 bool JSIDBDatabaseRequestPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
142 { |
|
143 return getStaticFunctionDescriptor<JSObject>(exec, &JSIDBDatabaseRequestPrototypeTable, this, propertyName, descriptor); |
|
144 } |
|
145 |
|
146 const ClassInfo JSIDBDatabaseRequest::s_info = { "IDBDatabaseRequest", 0, &JSIDBDatabaseRequestTable, 0 }; |
|
147 |
|
148 JSIDBDatabaseRequest::JSIDBDatabaseRequest(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<IDBDatabaseRequest> impl) |
|
149 : DOMObjectWithGlobalPointer(structure, globalObject) |
|
150 , m_impl(impl) |
|
151 { |
|
152 } |
|
153 |
|
154 JSIDBDatabaseRequest::~JSIDBDatabaseRequest() |
|
155 { |
|
156 forgetDOMObject(this, impl()); |
|
157 } |
|
158 |
|
159 JSObject* JSIDBDatabaseRequest::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
160 { |
|
161 return new (exec) JSIDBDatabaseRequestPrototype(globalObject, JSIDBDatabaseRequestPrototype::createStructure(globalObject->objectPrototype())); |
|
162 } |
|
163 |
|
164 bool JSIDBDatabaseRequest::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
165 { |
|
166 return getStaticValueSlot<JSIDBDatabaseRequest, Base>(exec, &JSIDBDatabaseRequestTable, this, propertyName, slot); |
|
167 } |
|
168 |
|
169 bool JSIDBDatabaseRequest::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
170 { |
|
171 return getStaticValueDescriptor<JSIDBDatabaseRequest, Base>(exec, &JSIDBDatabaseRequestTable, this, propertyName, descriptor); |
|
172 } |
|
173 |
|
174 JSValue jsIDBDatabaseRequestName(ExecState* exec, JSValue slotBase, const Identifier&) |
|
175 { |
|
176 JSIDBDatabaseRequest* castedThis = static_cast<JSIDBDatabaseRequest*>(asObject(slotBase)); |
|
177 UNUSED_PARAM(exec); |
|
178 IDBDatabaseRequest* imp = static_cast<IDBDatabaseRequest*>(castedThis->impl()); |
|
179 JSValue result = jsString(exec, imp->name()); |
|
180 return result; |
|
181 } |
|
182 |
|
183 JSValue jsIDBDatabaseRequestDescription(ExecState* exec, JSValue slotBase, const Identifier&) |
|
184 { |
|
185 JSIDBDatabaseRequest* castedThis = static_cast<JSIDBDatabaseRequest*>(asObject(slotBase)); |
|
186 UNUSED_PARAM(exec); |
|
187 IDBDatabaseRequest* imp = static_cast<IDBDatabaseRequest*>(castedThis->impl()); |
|
188 JSValue result = jsString(exec, imp->description()); |
|
189 return result; |
|
190 } |
|
191 |
|
192 JSValue jsIDBDatabaseRequestVersion(ExecState* exec, JSValue slotBase, const Identifier&) |
|
193 { |
|
194 JSIDBDatabaseRequest* castedThis = static_cast<JSIDBDatabaseRequest*>(asObject(slotBase)); |
|
195 UNUSED_PARAM(exec); |
|
196 IDBDatabaseRequest* imp = static_cast<IDBDatabaseRequest*>(castedThis->impl()); |
|
197 JSValue result = jsString(exec, imp->version()); |
|
198 return result; |
|
199 } |
|
200 |
|
201 JSValue jsIDBDatabaseRequestObjectStores(ExecState* exec, JSValue slotBase, const Identifier&) |
|
202 { |
|
203 JSIDBDatabaseRequest* castedThis = static_cast<JSIDBDatabaseRequest*>(asObject(slotBase)); |
|
204 UNUSED_PARAM(exec); |
|
205 IDBDatabaseRequest* imp = static_cast<IDBDatabaseRequest*>(castedThis->impl()); |
|
206 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->objectStores())); |
|
207 return result; |
|
208 } |
|
209 |
|
210 JSValue jsIDBDatabaseRequestConstructor(ExecState* exec, JSValue slotBase, const Identifier&) |
|
211 { |
|
212 JSIDBDatabaseRequest* domObject = static_cast<JSIDBDatabaseRequest*>(asObject(slotBase)); |
|
213 return JSIDBDatabaseRequest::getConstructor(exec, domObject->globalObject()); |
|
214 } |
|
215 JSValue JSIDBDatabaseRequest::getConstructor(ExecState* exec, JSGlobalObject* globalObject) |
|
216 { |
|
217 return getDOMConstructor<JSIDBDatabaseRequestConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); |
|
218 } |
|
219 |
|
220 EncodedJSValue JSC_HOST_CALL jsIDBDatabaseRequestPrototypeFunctionCreateObjectStore(ExecState* exec) |
|
221 { |
|
222 JSValue thisValue = exec->hostThisValue(); |
|
223 if (!thisValue.inherits(&JSIDBDatabaseRequest::s_info)) |
|
224 return throwVMTypeError(exec); |
|
225 JSIDBDatabaseRequest* castedThis = static_cast<JSIDBDatabaseRequest*>(asObject(thisValue)); |
|
226 IDBDatabaseRequest* imp = static_cast<IDBDatabaseRequest*>(castedThis->impl()); |
|
227 ScriptExecutionContext* scriptContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext(); |
|
228 if (!scriptContext) |
|
229 return JSValue::encode(jsUndefined()); |
|
230 const String& name = ustringToString(exec->argument(0).toString(exec)); |
|
231 |
|
232 int argsCount = exec->argumentCount(); |
|
233 if (argsCount < 2) { |
|
234 |
|
235 JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->createObjectStore(scriptContext, name))); |
|
236 return JSValue::encode(result); |
|
237 } |
|
238 |
|
239 const String& keyPath = valueToStringWithNullCheck(exec, exec->argument(1)); |
|
240 if (argsCount < 3) { |
|
241 |
|
242 JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->createObjectStore(scriptContext, name, keyPath))); |
|
243 return JSValue::encode(result); |
|
244 } |
|
245 |
|
246 bool autoIncrement = exec->argument(2).toBoolean(exec); |
|
247 |
|
248 |
|
249 JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->createObjectStore(scriptContext, name, keyPath, autoIncrement))); |
|
250 return JSValue::encode(result); |
|
251 } |
|
252 |
|
253 EncodedJSValue JSC_HOST_CALL jsIDBDatabaseRequestPrototypeFunctionObjectStore(ExecState* exec) |
|
254 { |
|
255 JSValue thisValue = exec->hostThisValue(); |
|
256 if (!thisValue.inherits(&JSIDBDatabaseRequest::s_info)) |
|
257 return throwVMTypeError(exec); |
|
258 JSIDBDatabaseRequest* castedThis = static_cast<JSIDBDatabaseRequest*>(asObject(thisValue)); |
|
259 IDBDatabaseRequest* imp = static_cast<IDBDatabaseRequest*>(castedThis->impl()); |
|
260 const String& name = ustringToString(exec->argument(0).toString(exec)); |
|
261 |
|
262 int argsCount = exec->argumentCount(); |
|
263 if (argsCount < 2) { |
|
264 |
|
265 JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->objectStore(name))); |
|
266 return JSValue::encode(result); |
|
267 } |
|
268 |
|
269 unsigned short mode = exec->argument(1).toInt32(exec); |
|
270 |
|
271 |
|
272 JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->objectStore(name, mode))); |
|
273 return JSValue::encode(result); |
|
274 } |
|
275 |
|
276 EncodedJSValue JSC_HOST_CALL jsIDBDatabaseRequestPrototypeFunctionRemoveObjectStore(ExecState* exec) |
|
277 { |
|
278 JSValue thisValue = exec->hostThisValue(); |
|
279 if (!thisValue.inherits(&JSIDBDatabaseRequest::s_info)) |
|
280 return throwVMTypeError(exec); |
|
281 JSIDBDatabaseRequest* castedThis = static_cast<JSIDBDatabaseRequest*>(asObject(thisValue)); |
|
282 IDBDatabaseRequest* imp = static_cast<IDBDatabaseRequest*>(castedThis->impl()); |
|
283 ScriptExecutionContext* scriptContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext(); |
|
284 if (!scriptContext) |
|
285 return JSValue::encode(jsUndefined()); |
|
286 const String& name = ustringToString(exec->argument(0).toString(exec)); |
|
287 |
|
288 |
|
289 JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->removeObjectStore(scriptContext, name))); |
|
290 return JSValue::encode(result); |
|
291 } |
|
292 |
|
293 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, IDBDatabaseRequest* object) |
|
294 { |
|
295 return getDOMObjectWrapper<JSIDBDatabaseRequest>(exec, globalObject, object); |
|
296 } |
|
297 IDBDatabaseRequest* toIDBDatabaseRequest(JSC::JSValue value) |
|
298 { |
|
299 return value.inherits(&JSIDBDatabaseRequest::s_info) ? static_cast<JSIDBDatabaseRequest*>(asObject(value))->impl() : 0; |
|
300 } |
|
301 |
|
302 } |
|
303 |
|
304 #endif // ENABLE(INDEXED_DATABASE) |