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 "JSIDBObjectStore.h" |
26 | |
27 | #include "JSDOMAttribute.h" |
28 | #include "JSDOMBinding.h" |
29 | #include "JSDOMConstructorNotConstructable.h" |
30 | #include "JSDOMConvertAny.h" |
31 | #include "JSDOMConvertBoolean.h" |
32 | #include "JSDOMConvertEnumeration.h" |
33 | #include "JSDOMConvertInterface.h" |
34 | #include "JSDOMConvertNullable.h" |
35 | #include "JSDOMConvertNumbers.h" |
36 | #include "JSDOMConvertSequences.h" |
37 | #include "JSDOMConvertStrings.h" |
38 | #include "JSDOMConvertUnion.h" |
39 | #include "JSDOMExceptionHandling.h" |
40 | #include "JSDOMGlobalObject.h" |
41 | #include "JSDOMOperation.h" |
42 | #include "JSDOMStringList.h" |
43 | #include "JSDOMWrapperCache.h" |
44 | #include "JSIDBCursorDirection.h" |
45 | #include "JSIDBIndex.h" |
46 | #include "JSIDBKeyRange.h" |
47 | #include "JSIDBRequest.h" |
48 | #include "JSIDBTransaction.h" |
49 | #include "ScriptExecutionContext.h" |
50 | #include <JavaScriptCore/FunctionPrototype.h> |
51 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
52 | #include <JavaScriptCore/JSArray.h> |
53 | #include <JavaScriptCore/JSCInlines.h> |
54 | #include <wtf/GetPtr.h> |
55 | #include <wtf/PointerPreparations.h> |
56 | #include <wtf/URL.h> |
57 | #include <wtf/Variant.h> |
58 | |
59 | |
60 | namespace WebCore { |
61 | using namespace JSC; |
62 | |
63 | template<> IDBObjectStore::IndexParameters convertDictionary<IDBObjectStore::IndexParameters>(ExecState& state, JSValue value) |
64 | { |
65 | VM& vm = state.vm(); |
66 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
67 | bool isNullOrUndefined = value.isUndefinedOrNull(); |
68 | auto* object = isNullOrUndefined ? nullptr : value.getObject(); |
69 | if (UNLIKELY(!isNullOrUndefined && !object)) { |
70 | throwTypeError(&state, throwScope); |
71 | return { }; |
72 | } |
73 | IDBObjectStore::IndexParameters result; |
74 | JSValue multiEntryValue; |
75 | if (isNullOrUndefined) |
76 | multiEntryValue = jsUndefined(); |
77 | else { |
78 | multiEntryValue = object->get(&state, Identifier::fromString(&state, "multiEntry" )); |
79 | RETURN_IF_EXCEPTION(throwScope, { }); |
80 | } |
81 | if (!multiEntryValue.isUndefined()) { |
82 | result.multiEntry = convert<IDLBoolean>(state, multiEntryValue); |
83 | RETURN_IF_EXCEPTION(throwScope, { }); |
84 | } else |
85 | result.multiEntry = false; |
86 | JSValue uniqueValue; |
87 | if (isNullOrUndefined) |
88 | uniqueValue = jsUndefined(); |
89 | else { |
90 | uniqueValue = object->get(&state, Identifier::fromString(&state, "unique" )); |
91 | RETURN_IF_EXCEPTION(throwScope, { }); |
92 | } |
93 | if (!uniqueValue.isUndefined()) { |
94 | result.unique = convert<IDLBoolean>(state, uniqueValue); |
95 | RETURN_IF_EXCEPTION(throwScope, { }); |
96 | } else |
97 | result.unique = false; |
98 | return result; |
99 | } |
100 | |
101 | // Functions |
102 | |
103 | JSC::EncodedJSValue JSC_HOST_CALL jsIDBObjectStorePrototypeFunctionPut(JSC::ExecState*); |
104 | JSC::EncodedJSValue JSC_HOST_CALL jsIDBObjectStorePrototypeFunctionAdd(JSC::ExecState*); |
105 | JSC::EncodedJSValue JSC_HOST_CALL jsIDBObjectStorePrototypeFunctionDelete(JSC::ExecState*); |
106 | JSC::EncodedJSValue JSC_HOST_CALL jsIDBObjectStorePrototypeFunctionGet(JSC::ExecState*); |
107 | JSC::EncodedJSValue JSC_HOST_CALL jsIDBObjectStorePrototypeFunctionGetKey(JSC::ExecState*); |
108 | JSC::EncodedJSValue JSC_HOST_CALL jsIDBObjectStorePrototypeFunctionClear(JSC::ExecState*); |
109 | JSC::EncodedJSValue JSC_HOST_CALL jsIDBObjectStorePrototypeFunctionOpenCursor(JSC::ExecState*); |
110 | JSC::EncodedJSValue JSC_HOST_CALL jsIDBObjectStorePrototypeFunctionOpenKeyCursor(JSC::ExecState*); |
111 | JSC::EncodedJSValue JSC_HOST_CALL jsIDBObjectStorePrototypeFunctionGetAll(JSC::ExecState*); |
112 | JSC::EncodedJSValue JSC_HOST_CALL jsIDBObjectStorePrototypeFunctionGetAllKeys(JSC::ExecState*); |
113 | JSC::EncodedJSValue JSC_HOST_CALL jsIDBObjectStorePrototypeFunctionCreateIndex(JSC::ExecState*); |
114 | JSC::EncodedJSValue JSC_HOST_CALL jsIDBObjectStorePrototypeFunctionIndex(JSC::ExecState*); |
115 | JSC::EncodedJSValue JSC_HOST_CALL jsIDBObjectStorePrototypeFunctionDeleteIndex(JSC::ExecState*); |
116 | JSC::EncodedJSValue JSC_HOST_CALL jsIDBObjectStorePrototypeFunctionCount(JSC::ExecState*); |
117 | |
118 | // Attributes |
119 | |
120 | JSC::EncodedJSValue jsIDBObjectStoreConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
121 | bool setJSIDBObjectStoreConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
122 | JSC::EncodedJSValue jsIDBObjectStoreName(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
123 | bool setJSIDBObjectStoreName(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
124 | JSC::EncodedJSValue jsIDBObjectStoreKeyPath(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
125 | JSC::EncodedJSValue jsIDBObjectStoreIndexNames(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
126 | JSC::EncodedJSValue jsIDBObjectStoreTransaction(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
127 | JSC::EncodedJSValue jsIDBObjectStoreAutoIncrement(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
128 | |
129 | class JSIDBObjectStorePrototype : public JSC::JSNonFinalObject { |
130 | public: |
131 | using Base = JSC::JSNonFinalObject; |
132 | static JSIDBObjectStorePrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
133 | { |
134 | JSIDBObjectStorePrototype* ptr = new (NotNull, JSC::allocateCell<JSIDBObjectStorePrototype>(vm.heap)) JSIDBObjectStorePrototype(vm, globalObject, structure); |
135 | ptr->finishCreation(vm); |
136 | return ptr; |
137 | } |
138 | |
139 | DECLARE_INFO; |
140 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
141 | { |
142 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
143 | } |
144 | |
145 | private: |
146 | JSIDBObjectStorePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
147 | : JSC::JSNonFinalObject(vm, structure) |
148 | { |
149 | } |
150 | |
151 | void finishCreation(JSC::VM&); |
152 | }; |
153 | |
154 | using JSIDBObjectStoreConstructor = JSDOMConstructorNotConstructable<JSIDBObjectStore>; |
155 | |
156 | template<> JSValue JSIDBObjectStoreConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
157 | { |
158 | UNUSED_PARAM(vm); |
159 | return globalObject.functionPrototype(); |
160 | } |
161 | |
162 | template<> void JSIDBObjectStoreConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
163 | { |
164 | putDirect(vm, vm.propertyNames->prototype, JSIDBObjectStore::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
165 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("IDBObjectStore"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
166 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
167 | } |
168 | |
169 | template<> const ClassInfo JSIDBObjectStoreConstructor::s_info = { "IDBObjectStore" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSIDBObjectStoreConstructor) }; |
170 | |
171 | /* Hash table for prototype */ |
172 | |
173 | static const HashTableValue JSIDBObjectStorePrototypeTableValues[] = |
174 | { |
175 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBObjectStoreConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSIDBObjectStoreConstructor) } }, |
176 | { "name" , static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBObjectStoreName), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSIDBObjectStoreName) } }, |
177 | { "keyPath" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBObjectStoreKeyPath), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
178 | { "indexNames" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBObjectStoreIndexNames), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
179 | { "transaction" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBObjectStoreTransaction), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
180 | { "autoIncrement" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBObjectStoreAutoIncrement), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
181 | { "put" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsIDBObjectStorePrototypeFunctionPut), (intptr_t) (1) } }, |
182 | { "add" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsIDBObjectStorePrototypeFunctionAdd), (intptr_t) (1) } }, |
183 | { "delete" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsIDBObjectStorePrototypeFunctionDelete), (intptr_t) (1) } }, |
184 | { "get" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsIDBObjectStorePrototypeFunctionGet), (intptr_t) (1) } }, |
185 | { "getKey" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsIDBObjectStorePrototypeFunctionGetKey), (intptr_t) (1) } }, |
186 | { "clear" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsIDBObjectStorePrototypeFunctionClear), (intptr_t) (0) } }, |
187 | { "openCursor" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsIDBObjectStorePrototypeFunctionOpenCursor), (intptr_t) (0) } }, |
188 | { "openKeyCursor" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsIDBObjectStorePrototypeFunctionOpenKeyCursor), (intptr_t) (0) } }, |
189 | { "getAll" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsIDBObjectStorePrototypeFunctionGetAll), (intptr_t) (0) } }, |
190 | { "getAllKeys" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsIDBObjectStorePrototypeFunctionGetAllKeys), (intptr_t) (0) } }, |
191 | { "createIndex" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsIDBObjectStorePrototypeFunctionCreateIndex), (intptr_t) (2) } }, |
192 | { "index" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsIDBObjectStorePrototypeFunctionIndex), (intptr_t) (1) } }, |
193 | { "deleteIndex" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsIDBObjectStorePrototypeFunctionDeleteIndex), (intptr_t) (1) } }, |
194 | { "count" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsIDBObjectStorePrototypeFunctionCount), (intptr_t) (0) } }, |
195 | }; |
196 | |
197 | const ClassInfo JSIDBObjectStorePrototype::s_info = { "IDBObjectStorePrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSIDBObjectStorePrototype) }; |
198 | |
199 | void JSIDBObjectStorePrototype::finishCreation(VM& vm) |
200 | { |
201 | Base::finishCreation(vm); |
202 | reifyStaticProperties(vm, JSIDBObjectStore::info(), JSIDBObjectStorePrototypeTableValues, *this); |
203 | } |
204 | |
205 | const ClassInfo JSIDBObjectStore::s_info = { "IDBObjectStore" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSIDBObjectStore) }; |
206 | |
207 | JSIDBObjectStore::JSIDBObjectStore(Structure* structure, JSDOMGlobalObject& globalObject, Ref<IDBObjectStore>&& impl) |
208 | : JSDOMWrapper<IDBObjectStore>(structure, globalObject, WTFMove(impl)) |
209 | { |
210 | } |
211 | |
212 | void JSIDBObjectStore::finishCreation(VM& vm) |
213 | { |
214 | Base::finishCreation(vm); |
215 | ASSERT(inherits(vm, info())); |
216 | |
217 | } |
218 | |
219 | JSObject* JSIDBObjectStore::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
220 | { |
221 | return JSIDBObjectStorePrototype::create(vm, &globalObject, JSIDBObjectStorePrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); |
222 | } |
223 | |
224 | JSObject* JSIDBObjectStore::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
225 | { |
226 | return getDOMPrototype<JSIDBObjectStore>(vm, globalObject); |
227 | } |
228 | |
229 | JSValue JSIDBObjectStore::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
230 | { |
231 | return getDOMConstructor<JSIDBObjectStoreConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
232 | } |
233 | |
234 | void JSIDBObjectStore::destroy(JSC::JSCell* cell) |
235 | { |
236 | JSIDBObjectStore* thisObject = static_cast<JSIDBObjectStore*>(cell); |
237 | thisObject->JSIDBObjectStore::~JSIDBObjectStore(); |
238 | } |
239 | |
240 | template<> inline JSIDBObjectStore* IDLAttribute<JSIDBObjectStore>::cast(ExecState& state, EncodedJSValue thisValue) |
241 | { |
242 | return jsDynamicCast<JSIDBObjectStore*>(state.vm(), JSValue::decode(thisValue)); |
243 | } |
244 | |
245 | template<> inline JSIDBObjectStore* IDLOperation<JSIDBObjectStore>::cast(ExecState& state) |
246 | { |
247 | return jsDynamicCast<JSIDBObjectStore*>(state.vm(), state.thisValue()); |
248 | } |
249 | |
250 | EncodedJSValue jsIDBObjectStoreConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
251 | { |
252 | VM& vm = state->vm(); |
253 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
254 | auto* prototype = jsDynamicCast<JSIDBObjectStorePrototype*>(vm, JSValue::decode(thisValue)); |
255 | if (UNLIKELY(!prototype)) |
256 | return throwVMTypeError(state, throwScope); |
257 | return JSValue::encode(JSIDBObjectStore::getConstructor(state->vm(), prototype->globalObject())); |
258 | } |
259 | |
260 | bool setJSIDBObjectStoreConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
261 | { |
262 | VM& vm = state->vm(); |
263 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
264 | auto* prototype = jsDynamicCast<JSIDBObjectStorePrototype*>(vm, JSValue::decode(thisValue)); |
265 | if (UNLIKELY(!prototype)) { |
266 | throwVMTypeError(state, throwScope); |
267 | return false; |
268 | } |
269 | // Shadowing a built-in constructor |
270 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
271 | } |
272 | |
273 | static inline JSValue jsIDBObjectStoreNameGetter(ExecState& state, JSIDBObjectStore& thisObject, ThrowScope& throwScope) |
274 | { |
275 | UNUSED_PARAM(throwScope); |
276 | UNUSED_PARAM(state); |
277 | auto& impl = thisObject.wrapped(); |
278 | JSValue result = toJS<IDLDOMString>(state, throwScope, impl.name()); |
279 | return result; |
280 | } |
281 | |
282 | EncodedJSValue jsIDBObjectStoreName(ExecState* state, EncodedJSValue thisValue, PropertyName) |
283 | { |
284 | return IDLAttribute<JSIDBObjectStore>::get<jsIDBObjectStoreNameGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "name" ); |
285 | } |
286 | |
287 | static inline bool setJSIDBObjectStoreNameSetter(ExecState& state, JSIDBObjectStore& thisObject, JSValue value, ThrowScope& throwScope) |
288 | { |
289 | UNUSED_PARAM(throwScope); |
290 | auto& impl = thisObject.wrapped(); |
291 | auto nativeValue = convert<IDLDOMString>(state, value); |
292 | RETURN_IF_EXCEPTION(throwScope, false); |
293 | AttributeSetter::call(state, throwScope, [&] { |
294 | return impl.setName(WTFMove(nativeValue)); |
295 | }); |
296 | return true; |
297 | } |
298 | |
299 | bool setJSIDBObjectStoreName(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
300 | { |
301 | return IDLAttribute<JSIDBObjectStore>::set<setJSIDBObjectStoreNameSetter>(*state, thisValue, encodedValue, "name" ); |
302 | } |
303 | |
304 | static inline JSValue jsIDBObjectStoreKeyPathGetter(ExecState& state, JSIDBObjectStore& thisObject, ThrowScope& throwScope) |
305 | { |
306 | UNUSED_PARAM(throwScope); |
307 | UNUSED_PARAM(state); |
308 | auto& impl = thisObject.wrapped(); |
309 | JSValue result = toJS<IDLNullable<IDLUnion<IDLDOMString, IDLSequence<IDLDOMString>>>>(state, *thisObject.globalObject(), throwScope, impl.keyPath()); |
310 | return result; |
311 | } |
312 | |
313 | EncodedJSValue jsIDBObjectStoreKeyPath(ExecState* state, EncodedJSValue thisValue, PropertyName) |
314 | { |
315 | return IDLAttribute<JSIDBObjectStore>::get<jsIDBObjectStoreKeyPathGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "keyPath" ); |
316 | } |
317 | |
318 | static inline JSValue jsIDBObjectStoreIndexNamesGetter(ExecState& state, JSIDBObjectStore& thisObject, ThrowScope& throwScope) |
319 | { |
320 | UNUSED_PARAM(throwScope); |
321 | UNUSED_PARAM(state); |
322 | auto& impl = thisObject.wrapped(); |
323 | JSValue result = toJS<IDLInterface<DOMStringList>>(state, *thisObject.globalObject(), throwScope, impl.indexNames()); |
324 | return result; |
325 | } |
326 | |
327 | EncodedJSValue jsIDBObjectStoreIndexNames(ExecState* state, EncodedJSValue thisValue, PropertyName) |
328 | { |
329 | return IDLAttribute<JSIDBObjectStore>::get<jsIDBObjectStoreIndexNamesGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "indexNames" ); |
330 | } |
331 | |
332 | static inline JSValue jsIDBObjectStoreTransactionGetter(ExecState& state, JSIDBObjectStore& thisObject, ThrowScope& throwScope) |
333 | { |
334 | UNUSED_PARAM(throwScope); |
335 | UNUSED_PARAM(state); |
336 | auto& impl = thisObject.wrapped(); |
337 | JSValue result = toJS<IDLInterface<IDBTransaction>>(state, *thisObject.globalObject(), throwScope, impl.transaction()); |
338 | return result; |
339 | } |
340 | |
341 | EncodedJSValue jsIDBObjectStoreTransaction(ExecState* state, EncodedJSValue thisValue, PropertyName) |
342 | { |
343 | return IDLAttribute<JSIDBObjectStore>::get<jsIDBObjectStoreTransactionGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "transaction" ); |
344 | } |
345 | |
346 | static inline JSValue jsIDBObjectStoreAutoIncrementGetter(ExecState& state, JSIDBObjectStore& thisObject, ThrowScope& throwScope) |
347 | { |
348 | UNUSED_PARAM(throwScope); |
349 | UNUSED_PARAM(state); |
350 | auto& impl = thisObject.wrapped(); |
351 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.autoIncrement()); |
352 | return result; |
353 | } |
354 | |
355 | EncodedJSValue jsIDBObjectStoreAutoIncrement(ExecState* state, EncodedJSValue thisValue, PropertyName) |
356 | { |
357 | return IDLAttribute<JSIDBObjectStore>::get<jsIDBObjectStoreAutoIncrementGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "autoIncrement" ); |
358 | } |
359 | |
360 | static inline JSC::EncodedJSValue jsIDBObjectStorePrototypeFunctionPutBody(JSC::ExecState* state, typename IDLOperation<JSIDBObjectStore>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
361 | { |
362 | UNUSED_PARAM(state); |
363 | UNUSED_PARAM(throwScope); |
364 | auto& impl = castedThis->wrapped(); |
365 | if (UNLIKELY(state->argumentCount() < 1)) |
366 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
367 | auto value = convert<IDLAny>(*state, state->uncheckedArgument(0)); |
368 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
369 | auto key = convert<IDLAny>(*state, state->argument(1)); |
370 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
371 | return JSValue::encode(toJS<IDLInterface<IDBRequest>>(*state, *castedThis->globalObject(), throwScope, impl.put(*state, WTFMove(value), WTFMove(key)))); |
372 | } |
373 | |
374 | EncodedJSValue JSC_HOST_CALL jsIDBObjectStorePrototypeFunctionPut(ExecState* state) |
375 | { |
376 | return IDLOperation<JSIDBObjectStore>::call<jsIDBObjectStorePrototypeFunctionPutBody>(*state, "put" ); |
377 | } |
378 | |
379 | static inline JSC::EncodedJSValue jsIDBObjectStorePrototypeFunctionAddBody(JSC::ExecState* state, typename IDLOperation<JSIDBObjectStore>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
380 | { |
381 | UNUSED_PARAM(state); |
382 | UNUSED_PARAM(throwScope); |
383 | auto& impl = castedThis->wrapped(); |
384 | if (UNLIKELY(state->argumentCount() < 1)) |
385 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
386 | auto value = convert<IDLAny>(*state, state->uncheckedArgument(0)); |
387 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
388 | auto key = convert<IDLAny>(*state, state->argument(1)); |
389 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
390 | return JSValue::encode(toJS<IDLInterface<IDBRequest>>(*state, *castedThis->globalObject(), throwScope, impl.add(*state, WTFMove(value), WTFMove(key)))); |
391 | } |
392 | |
393 | EncodedJSValue JSC_HOST_CALL jsIDBObjectStorePrototypeFunctionAdd(ExecState* state) |
394 | { |
395 | return IDLOperation<JSIDBObjectStore>::call<jsIDBObjectStorePrototypeFunctionAddBody>(*state, "add" ); |
396 | } |
397 | |
398 | static inline JSC::EncodedJSValue jsIDBObjectStorePrototypeFunctionDelete1Body(JSC::ExecState* state, typename IDLOperation<JSIDBObjectStore>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
399 | { |
400 | UNUSED_PARAM(state); |
401 | UNUSED_PARAM(throwScope); |
402 | auto& impl = castedThis->wrapped(); |
403 | auto keyRange = convert<IDLNullable<IDLInterface<IDBKeyRange>>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "keyRange" , "IDBObjectStore" , "delete" , "IDBKeyRange" ); }); |
404 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
405 | return JSValue::encode(toJS<IDLInterface<IDBRequest>>(*state, *castedThis->globalObject(), throwScope, impl.deleteFunction(*state, WTFMove(keyRange)))); |
406 | } |
407 | |
408 | static inline JSC::EncodedJSValue jsIDBObjectStorePrototypeFunctionDelete2Body(JSC::ExecState* state, typename IDLOperation<JSIDBObjectStore>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
409 | { |
410 | UNUSED_PARAM(state); |
411 | UNUSED_PARAM(throwScope); |
412 | auto& impl = castedThis->wrapped(); |
413 | auto key = convert<IDLAny>(*state, state->uncheckedArgument(0)); |
414 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
415 | return JSValue::encode(toJS<IDLInterface<IDBRequest>>(*state, *castedThis->globalObject(), throwScope, impl.deleteFunction(*state, WTFMove(key)))); |
416 | } |
417 | |
418 | static inline JSC::EncodedJSValue jsIDBObjectStorePrototypeFunctionDeleteOverloadDispatcher(JSC::ExecState* state, typename IDLOperation<JSIDBObjectStore>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
419 | { |
420 | UNUSED_PARAM(state); |
421 | UNUSED_PARAM(throwScope); |
422 | VM& vm = state->vm(); |
423 | UNUSED_PARAM(vm); |
424 | size_t argsCount = std::min<size_t>(1, state->argumentCount()); |
425 | if (argsCount == 1) { |
426 | JSValue distinguishingArg = state->uncheckedArgument(0); |
427 | if (distinguishingArg.isUndefinedOrNull()) |
428 | return jsIDBObjectStorePrototypeFunctionDelete1Body(state, castedThis, throwScope); |
429 | if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits<JSIDBKeyRange>(vm)) |
430 | return jsIDBObjectStorePrototypeFunctionDelete1Body(state, castedThis, throwScope); |
431 | return jsIDBObjectStorePrototypeFunctionDelete2Body(state, castedThis, throwScope); |
432 | } |
433 | return argsCount < 1 ? throwVMError(state, throwScope, createNotEnoughArgumentsError(state)) : throwVMTypeError(state, throwScope); |
434 | } |
435 | |
436 | EncodedJSValue JSC_HOST_CALL jsIDBObjectStorePrototypeFunctionDelete(ExecState* state) |
437 | { |
438 | return IDLOperation<JSIDBObjectStore>::call<jsIDBObjectStorePrototypeFunctionDeleteOverloadDispatcher>(*state, "delete" ); |
439 | } |
440 | |
441 | static inline JSC::EncodedJSValue jsIDBObjectStorePrototypeFunctionGet1Body(JSC::ExecState* state, typename IDLOperation<JSIDBObjectStore>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
442 | { |
443 | UNUSED_PARAM(state); |
444 | UNUSED_PARAM(throwScope); |
445 | auto& impl = castedThis->wrapped(); |
446 | auto key = convert<IDLNullable<IDLInterface<IDBKeyRange>>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "key" , "IDBObjectStore" , "get" , "IDBKeyRange" ); }); |
447 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
448 | return JSValue::encode(toJS<IDLInterface<IDBRequest>>(*state, *castedThis->globalObject(), throwScope, impl.get(*state, WTFMove(key)))); |
449 | } |
450 | |
451 | static inline JSC::EncodedJSValue jsIDBObjectStorePrototypeFunctionGet2Body(JSC::ExecState* state, typename IDLOperation<JSIDBObjectStore>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
452 | { |
453 | UNUSED_PARAM(state); |
454 | UNUSED_PARAM(throwScope); |
455 | auto& impl = castedThis->wrapped(); |
456 | auto key = convert<IDLAny>(*state, state->uncheckedArgument(0)); |
457 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
458 | return JSValue::encode(toJS<IDLInterface<IDBRequest>>(*state, *castedThis->globalObject(), throwScope, impl.get(*state, WTFMove(key)))); |
459 | } |
460 | |
461 | static inline JSC::EncodedJSValue jsIDBObjectStorePrototypeFunctionGetOverloadDispatcher(JSC::ExecState* state, typename IDLOperation<JSIDBObjectStore>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
462 | { |
463 | UNUSED_PARAM(state); |
464 | UNUSED_PARAM(throwScope); |
465 | VM& vm = state->vm(); |
466 | UNUSED_PARAM(vm); |
467 | size_t argsCount = std::min<size_t>(1, state->argumentCount()); |
468 | if (argsCount == 1) { |
469 | JSValue distinguishingArg = state->uncheckedArgument(0); |
470 | if (distinguishingArg.isUndefinedOrNull()) |
471 | return jsIDBObjectStorePrototypeFunctionGet1Body(state, castedThis, throwScope); |
472 | if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits<JSIDBKeyRange>(vm)) |
473 | return jsIDBObjectStorePrototypeFunctionGet1Body(state, castedThis, throwScope); |
474 | return jsIDBObjectStorePrototypeFunctionGet2Body(state, castedThis, throwScope); |
475 | } |
476 | return argsCount < 1 ? throwVMError(state, throwScope, createNotEnoughArgumentsError(state)) : throwVMTypeError(state, throwScope); |
477 | } |
478 | |
479 | EncodedJSValue JSC_HOST_CALL jsIDBObjectStorePrototypeFunctionGet(ExecState* state) |
480 | { |
481 | return IDLOperation<JSIDBObjectStore>::call<jsIDBObjectStorePrototypeFunctionGetOverloadDispatcher>(*state, "get" ); |
482 | } |
483 | |
484 | static inline JSC::EncodedJSValue jsIDBObjectStorePrototypeFunctionGetKey1Body(JSC::ExecState* state, typename IDLOperation<JSIDBObjectStore>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
485 | { |
486 | UNUSED_PARAM(state); |
487 | UNUSED_PARAM(throwScope); |
488 | auto& impl = castedThis->wrapped(); |
489 | auto key = convert<IDLNullable<IDLInterface<IDBKeyRange>>>(*state, state->uncheckedArgument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "key" , "IDBObjectStore" , "getKey" , "IDBKeyRange" ); }); |
490 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
491 | return JSValue::encode(toJS<IDLInterface<IDBRequest>>(*state, *castedThis->globalObject(), throwScope, impl.getKey(*state, WTFMove(key)))); |
492 | } |
493 | |
494 | static inline JSC::EncodedJSValue jsIDBObjectStorePrototypeFunctionGetKey2Body(JSC::ExecState* state, typename IDLOperation<JSIDBObjectStore>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
495 | { |
496 | UNUSED_PARAM(state); |
497 | UNUSED_PARAM(throwScope); |
498 | auto& impl = castedThis->wrapped(); |
499 | auto key = convert<IDLAny>(*state, state->uncheckedArgument(0)); |
500 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
501 | return JSValue::encode(toJS<IDLInterface<IDBRequest>>(*state, *castedThis->globalObject(), throwScope, impl.getKey(*state, WTFMove(key)))); |
502 | } |
503 | |
504 | static inline JSC::EncodedJSValue jsIDBObjectStorePrototypeFunctionGetKeyOverloadDispatcher(JSC::ExecState* state, typename IDLOperation<JSIDBObjectStore>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
505 | { |
506 | UNUSED_PARAM(state); |
507 | UNUSED_PARAM(throwScope); |
508 | VM& vm = state->vm(); |
509 | UNUSED_PARAM(vm); |
510 | size_t argsCount = std::min<size_t>(1, state->argumentCount()); |
511 | if (argsCount == 1) { |
512 | JSValue distinguishingArg = state->uncheckedArgument(0); |
513 | if (distinguishingArg.isUndefinedOrNull()) |
514 | return jsIDBObjectStorePrototypeFunctionGetKey1Body(state, castedThis, throwScope); |
515 | if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits<JSIDBKeyRange>(vm)) |
516 | return jsIDBObjectStorePrototypeFunctionGetKey1Body(state, castedThis, throwScope); |
517 | return jsIDBObjectStorePrototypeFunctionGetKey2Body(state, castedThis, throwScope); |
518 | } |
519 | return argsCount < 1 ? throwVMError(state, throwScope, createNotEnoughArgumentsError(state)) : throwVMTypeError(state, throwScope); |
520 | } |
521 | |
522 | EncodedJSValue JSC_HOST_CALL jsIDBObjectStorePrototypeFunctionGetKey(ExecState* state) |
523 | { |
524 | return IDLOperation<JSIDBObjectStore>::call<jsIDBObjectStorePrototypeFunctionGetKeyOverloadDispatcher>(*state, "getKey" ); |
525 | } |
526 | |
527 | static inline JSC::EncodedJSValue jsIDBObjectStorePrototypeFunctionClearBody(JSC::ExecState* state, typename IDLOperation<JSIDBObjectStore>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
528 | { |
529 | UNUSED_PARAM(state); |
530 | UNUSED_PARAM(throwScope); |
531 | auto& impl = castedThis->wrapped(); |
532 | return JSValue::encode(toJS<IDLInterface<IDBRequest>>(*state, *castedThis->globalObject(), throwScope, impl.clear(*state))); |
533 | } |
534 | |
535 | EncodedJSValue JSC_HOST_CALL jsIDBObjectStorePrototypeFunctionClear(ExecState* state) |
536 | { |
537 | return IDLOperation<JSIDBObjectStore>::call<jsIDBObjectStorePrototypeFunctionClearBody>(*state, "clear" ); |
538 | } |
539 | |
540 | static inline JSC::EncodedJSValue jsIDBObjectStorePrototypeFunctionOpenCursor1Body(JSC::ExecState* state, typename IDLOperation<JSIDBObjectStore>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
541 | { |
542 | UNUSED_PARAM(state); |
543 | UNUSED_PARAM(throwScope); |
544 | auto& impl = castedThis->wrapped(); |
545 | auto range = convert<IDLNullable<IDLInterface<IDBKeyRange>>>(*state, state->argument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "range" , "IDBObjectStore" , "openCursor" , "IDBKeyRange" ); }); |
546 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
547 | auto direction = state->argument(1).isUndefined() ? IDBCursorDirection::Next : convert<IDLEnumeration<IDBCursorDirection>>(*state, state->uncheckedArgument(1), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentMustBeEnumError(state, scope, 1, "direction" , "IDBObjectStore" , "openCursor" , expectedEnumerationValues<IDBCursorDirection>()); }); |
548 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
549 | return JSValue::encode(toJS<IDLInterface<IDBRequest>>(*state, *castedThis->globalObject(), throwScope, impl.openCursor(*state, WTFMove(range), WTFMove(direction)))); |
550 | } |
551 | |
552 | static inline JSC::EncodedJSValue jsIDBObjectStorePrototypeFunctionOpenCursor2Body(JSC::ExecState* state, typename IDLOperation<JSIDBObjectStore>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
553 | { |
554 | UNUSED_PARAM(state); |
555 | UNUSED_PARAM(throwScope); |
556 | auto& impl = castedThis->wrapped(); |
557 | auto key = convert<IDLAny>(*state, state->uncheckedArgument(0)); |
558 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
559 | auto direction = state->argument(1).isUndefined() ? IDBCursorDirection::Next : convert<IDLEnumeration<IDBCursorDirection>>(*state, state->uncheckedArgument(1), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentMustBeEnumError(state, scope, 1, "direction" , "IDBObjectStore" , "openCursor" , expectedEnumerationValues<IDBCursorDirection>()); }); |
560 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
561 | return JSValue::encode(toJS<IDLInterface<IDBRequest>>(*state, *castedThis->globalObject(), throwScope, impl.openCursor(*state, WTFMove(key), WTFMove(direction)))); |
562 | } |
563 | |
564 | static inline JSC::EncodedJSValue jsIDBObjectStorePrototypeFunctionOpenCursorOverloadDispatcher(JSC::ExecState* state, typename IDLOperation<JSIDBObjectStore>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
565 | { |
566 | UNUSED_PARAM(state); |
567 | UNUSED_PARAM(throwScope); |
568 | VM& vm = state->vm(); |
569 | UNUSED_PARAM(vm); |
570 | size_t argsCount = std::min<size_t>(2, state->argumentCount()); |
571 | if (argsCount == 0) { |
572 | return jsIDBObjectStorePrototypeFunctionOpenCursor1Body(state, castedThis, throwScope); |
573 | } |
574 | if (argsCount == 1) { |
575 | JSValue distinguishingArg = state->uncheckedArgument(0); |
576 | if (distinguishingArg.isUndefined()) |
577 | return jsIDBObjectStorePrototypeFunctionOpenCursor1Body(state, castedThis, throwScope); |
578 | if (distinguishingArg.isUndefinedOrNull()) |
579 | return jsIDBObjectStorePrototypeFunctionOpenCursor1Body(state, castedThis, throwScope); |
580 | if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits<JSIDBKeyRange>(vm)) |
581 | return jsIDBObjectStorePrototypeFunctionOpenCursor1Body(state, castedThis, throwScope); |
582 | return jsIDBObjectStorePrototypeFunctionOpenCursor2Body(state, castedThis, throwScope); |
583 | } |
584 | if (argsCount == 2) { |
585 | JSValue distinguishingArg = state->uncheckedArgument(0); |
586 | if (distinguishingArg.isUndefined()) |
587 | return jsIDBObjectStorePrototypeFunctionOpenCursor1Body(state, castedThis, throwScope); |
588 | if (distinguishingArg.isUndefinedOrNull()) |
589 | return jsIDBObjectStorePrototypeFunctionOpenCursor1Body(state, castedThis, throwScope); |
590 | if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits<JSIDBKeyRange>(vm)) |
591 | return jsIDBObjectStorePrototypeFunctionOpenCursor1Body(state, castedThis, throwScope); |
592 | return jsIDBObjectStorePrototypeFunctionOpenCursor2Body(state, castedThis, throwScope); |
593 | } |
594 | return throwVMTypeError(state, throwScope); |
595 | } |
596 | |
597 | EncodedJSValue JSC_HOST_CALL jsIDBObjectStorePrototypeFunctionOpenCursor(ExecState* state) |
598 | { |
599 | return IDLOperation<JSIDBObjectStore>::call<jsIDBObjectStorePrototypeFunctionOpenCursorOverloadDispatcher>(*state, "openCursor" ); |
600 | } |
601 | |
602 | static inline JSC::EncodedJSValue jsIDBObjectStorePrototypeFunctionOpenKeyCursor1Body(JSC::ExecState* state, typename IDLOperation<JSIDBObjectStore>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
603 | { |
604 | UNUSED_PARAM(state); |
605 | UNUSED_PARAM(throwScope); |
606 | auto& impl = castedThis->wrapped(); |
607 | auto range = convert<IDLNullable<IDLInterface<IDBKeyRange>>>(*state, state->argument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "range" , "IDBObjectStore" , "openKeyCursor" , "IDBKeyRange" ); }); |
608 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
609 | auto direction = state->argument(1).isUndefined() ? IDBCursorDirection::Next : convert<IDLEnumeration<IDBCursorDirection>>(*state, state->uncheckedArgument(1), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentMustBeEnumError(state, scope, 1, "direction" , "IDBObjectStore" , "openKeyCursor" , expectedEnumerationValues<IDBCursorDirection>()); }); |
610 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
611 | return JSValue::encode(toJS<IDLInterface<IDBRequest>>(*state, *castedThis->globalObject(), throwScope, impl.openKeyCursor(*state, WTFMove(range), WTFMove(direction)))); |
612 | } |
613 | |
614 | static inline JSC::EncodedJSValue jsIDBObjectStorePrototypeFunctionOpenKeyCursor2Body(JSC::ExecState* state, typename IDLOperation<JSIDBObjectStore>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
615 | { |
616 | UNUSED_PARAM(state); |
617 | UNUSED_PARAM(throwScope); |
618 | auto& impl = castedThis->wrapped(); |
619 | auto key = convert<IDLAny>(*state, state->uncheckedArgument(0)); |
620 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
621 | auto direction = state->argument(1).isUndefined() ? IDBCursorDirection::Next : convert<IDLEnumeration<IDBCursorDirection>>(*state, state->uncheckedArgument(1), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentMustBeEnumError(state, scope, 1, "direction" , "IDBObjectStore" , "openKeyCursor" , expectedEnumerationValues<IDBCursorDirection>()); }); |
622 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
623 | return JSValue::encode(toJS<IDLInterface<IDBRequest>>(*state, *castedThis->globalObject(), throwScope, impl.openKeyCursor(*state, WTFMove(key), WTFMove(direction)))); |
624 | } |
625 | |
626 | static inline JSC::EncodedJSValue jsIDBObjectStorePrototypeFunctionOpenKeyCursorOverloadDispatcher(JSC::ExecState* state, typename IDLOperation<JSIDBObjectStore>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
627 | { |
628 | UNUSED_PARAM(state); |
629 | UNUSED_PARAM(throwScope); |
630 | VM& vm = state->vm(); |
631 | UNUSED_PARAM(vm); |
632 | size_t argsCount = std::min<size_t>(2, state->argumentCount()); |
633 | if (argsCount == 0) { |
634 | return jsIDBObjectStorePrototypeFunctionOpenKeyCursor1Body(state, castedThis, throwScope); |
635 | } |
636 | if (argsCount == 1) { |
637 | JSValue distinguishingArg = state->uncheckedArgument(0); |
638 | if (distinguishingArg.isUndefined()) |
639 | return jsIDBObjectStorePrototypeFunctionOpenKeyCursor1Body(state, castedThis, throwScope); |
640 | if (distinguishingArg.isUndefinedOrNull()) |
641 | return jsIDBObjectStorePrototypeFunctionOpenKeyCursor1Body(state, castedThis, throwScope); |
642 | if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits<JSIDBKeyRange>(vm)) |
643 | return jsIDBObjectStorePrototypeFunctionOpenKeyCursor1Body(state, castedThis, throwScope); |
644 | return jsIDBObjectStorePrototypeFunctionOpenKeyCursor2Body(state, castedThis, throwScope); |
645 | } |
646 | if (argsCount == 2) { |
647 | JSValue distinguishingArg = state->uncheckedArgument(0); |
648 | if (distinguishingArg.isUndefined()) |
649 | return jsIDBObjectStorePrototypeFunctionOpenKeyCursor1Body(state, castedThis, throwScope); |
650 | if (distinguishingArg.isUndefinedOrNull()) |
651 | return jsIDBObjectStorePrototypeFunctionOpenKeyCursor1Body(state, castedThis, throwScope); |
652 | if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits<JSIDBKeyRange>(vm)) |
653 | return jsIDBObjectStorePrototypeFunctionOpenKeyCursor1Body(state, castedThis, throwScope); |
654 | return jsIDBObjectStorePrototypeFunctionOpenKeyCursor2Body(state, castedThis, throwScope); |
655 | } |
656 | return throwVMTypeError(state, throwScope); |
657 | } |
658 | |
659 | EncodedJSValue JSC_HOST_CALL jsIDBObjectStorePrototypeFunctionOpenKeyCursor(ExecState* state) |
660 | { |
661 | return IDLOperation<JSIDBObjectStore>::call<jsIDBObjectStorePrototypeFunctionOpenKeyCursorOverloadDispatcher>(*state, "openKeyCursor" ); |
662 | } |
663 | |
664 | static inline JSC::EncodedJSValue jsIDBObjectStorePrototypeFunctionGetAll1Body(JSC::ExecState* state, typename IDLOperation<JSIDBObjectStore>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
665 | { |
666 | UNUSED_PARAM(state); |
667 | UNUSED_PARAM(throwScope); |
668 | auto& impl = castedThis->wrapped(); |
669 | auto range = convert<IDLNullable<IDLInterface<IDBKeyRange>>>(*state, state->argument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "range" , "IDBObjectStore" , "getAll" , "IDBKeyRange" ); }); |
670 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
671 | auto count = state->argument(1).isUndefined() ? Optional<Converter<IDLEnforceRangeAdaptor<IDLUnsignedLong>>::ReturnType>() : Optional<Converter<IDLEnforceRangeAdaptor<IDLUnsignedLong>>::ReturnType>(convert<IDLEnforceRangeAdaptor<IDLUnsignedLong>>(*state, state->uncheckedArgument(1))); |
672 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
673 | return JSValue::encode(toJS<IDLInterface<IDBRequest>>(*state, *castedThis->globalObject(), throwScope, impl.getAll(*state, WTFMove(range), WTFMove(count)))); |
674 | } |
675 | |
676 | static inline JSC::EncodedJSValue jsIDBObjectStorePrototypeFunctionGetAll2Body(JSC::ExecState* state, typename IDLOperation<JSIDBObjectStore>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
677 | { |
678 | UNUSED_PARAM(state); |
679 | UNUSED_PARAM(throwScope); |
680 | auto& impl = castedThis->wrapped(); |
681 | auto key = convert<IDLAny>(*state, state->uncheckedArgument(0)); |
682 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
683 | auto count = state->argument(1).isUndefined() ? Optional<Converter<IDLEnforceRangeAdaptor<IDLUnsignedLong>>::ReturnType>() : Optional<Converter<IDLEnforceRangeAdaptor<IDLUnsignedLong>>::ReturnType>(convert<IDLEnforceRangeAdaptor<IDLUnsignedLong>>(*state, state->uncheckedArgument(1))); |
684 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
685 | return JSValue::encode(toJS<IDLInterface<IDBRequest>>(*state, *castedThis->globalObject(), throwScope, impl.getAll(*state, WTFMove(key), WTFMove(count)))); |
686 | } |
687 | |
688 | static inline JSC::EncodedJSValue jsIDBObjectStorePrototypeFunctionGetAllOverloadDispatcher(JSC::ExecState* state, typename IDLOperation<JSIDBObjectStore>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
689 | { |
690 | UNUSED_PARAM(state); |
691 | UNUSED_PARAM(throwScope); |
692 | VM& vm = state->vm(); |
693 | UNUSED_PARAM(vm); |
694 | size_t argsCount = std::min<size_t>(2, state->argumentCount()); |
695 | if (argsCount == 0) { |
696 | return jsIDBObjectStorePrototypeFunctionGetAll1Body(state, castedThis, throwScope); |
697 | } |
698 | if (argsCount == 1) { |
699 | JSValue distinguishingArg = state->uncheckedArgument(0); |
700 | if (distinguishingArg.isUndefined()) |
701 | return jsIDBObjectStorePrototypeFunctionGetAll1Body(state, castedThis, throwScope); |
702 | if (distinguishingArg.isUndefinedOrNull()) |
703 | return jsIDBObjectStorePrototypeFunctionGetAll1Body(state, castedThis, throwScope); |
704 | if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits<JSIDBKeyRange>(vm)) |
705 | return jsIDBObjectStorePrototypeFunctionGetAll1Body(state, castedThis, throwScope); |
706 | return jsIDBObjectStorePrototypeFunctionGetAll2Body(state, castedThis, throwScope); |
707 | } |
708 | if (argsCount == 2) { |
709 | JSValue distinguishingArg = state->uncheckedArgument(0); |
710 | if (distinguishingArg.isUndefined()) |
711 | return jsIDBObjectStorePrototypeFunctionGetAll1Body(state, castedThis, throwScope); |
712 | if (distinguishingArg.isUndefinedOrNull()) |
713 | return jsIDBObjectStorePrototypeFunctionGetAll1Body(state, castedThis, throwScope); |
714 | if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits<JSIDBKeyRange>(vm)) |
715 | return jsIDBObjectStorePrototypeFunctionGetAll1Body(state, castedThis, throwScope); |
716 | return jsIDBObjectStorePrototypeFunctionGetAll2Body(state, castedThis, throwScope); |
717 | } |
718 | return throwVMTypeError(state, throwScope); |
719 | } |
720 | |
721 | EncodedJSValue JSC_HOST_CALL jsIDBObjectStorePrototypeFunctionGetAll(ExecState* state) |
722 | { |
723 | return IDLOperation<JSIDBObjectStore>::call<jsIDBObjectStorePrototypeFunctionGetAllOverloadDispatcher>(*state, "getAll" ); |
724 | } |
725 | |
726 | static inline JSC::EncodedJSValue jsIDBObjectStorePrototypeFunctionGetAllKeys1Body(JSC::ExecState* state, typename IDLOperation<JSIDBObjectStore>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
727 | { |
728 | UNUSED_PARAM(state); |
729 | UNUSED_PARAM(throwScope); |
730 | auto& impl = castedThis->wrapped(); |
731 | auto range = convert<IDLNullable<IDLInterface<IDBKeyRange>>>(*state, state->argument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "range" , "IDBObjectStore" , "getAllKeys" , "IDBKeyRange" ); }); |
732 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
733 | auto count = state->argument(1).isUndefined() ? Optional<Converter<IDLEnforceRangeAdaptor<IDLUnsignedLong>>::ReturnType>() : Optional<Converter<IDLEnforceRangeAdaptor<IDLUnsignedLong>>::ReturnType>(convert<IDLEnforceRangeAdaptor<IDLUnsignedLong>>(*state, state->uncheckedArgument(1))); |
734 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
735 | return JSValue::encode(toJS<IDLInterface<IDBRequest>>(*state, *castedThis->globalObject(), throwScope, impl.getAllKeys(*state, WTFMove(range), WTFMove(count)))); |
736 | } |
737 | |
738 | static inline JSC::EncodedJSValue jsIDBObjectStorePrototypeFunctionGetAllKeys2Body(JSC::ExecState* state, typename IDLOperation<JSIDBObjectStore>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
739 | { |
740 | UNUSED_PARAM(state); |
741 | UNUSED_PARAM(throwScope); |
742 | auto& impl = castedThis->wrapped(); |
743 | auto key = convert<IDLAny>(*state, state->uncheckedArgument(0)); |
744 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
745 | auto count = state->argument(1).isUndefined() ? Optional<Converter<IDLEnforceRangeAdaptor<IDLUnsignedLong>>::ReturnType>() : Optional<Converter<IDLEnforceRangeAdaptor<IDLUnsignedLong>>::ReturnType>(convert<IDLEnforceRangeAdaptor<IDLUnsignedLong>>(*state, state->uncheckedArgument(1))); |
746 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
747 | return JSValue::encode(toJS<IDLInterface<IDBRequest>>(*state, *castedThis->globalObject(), throwScope, impl.getAllKeys(*state, WTFMove(key), WTFMove(count)))); |
748 | } |
749 | |
750 | static inline JSC::EncodedJSValue jsIDBObjectStorePrototypeFunctionGetAllKeysOverloadDispatcher(JSC::ExecState* state, typename IDLOperation<JSIDBObjectStore>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
751 | { |
752 | UNUSED_PARAM(state); |
753 | UNUSED_PARAM(throwScope); |
754 | VM& vm = state->vm(); |
755 | UNUSED_PARAM(vm); |
756 | size_t argsCount = std::min<size_t>(2, state->argumentCount()); |
757 | if (argsCount == 0) { |
758 | return jsIDBObjectStorePrototypeFunctionGetAllKeys1Body(state, castedThis, throwScope); |
759 | } |
760 | if (argsCount == 1) { |
761 | JSValue distinguishingArg = state->uncheckedArgument(0); |
762 | if (distinguishingArg.isUndefined()) |
763 | return jsIDBObjectStorePrototypeFunctionGetAllKeys1Body(state, castedThis, throwScope); |
764 | if (distinguishingArg.isUndefinedOrNull()) |
765 | return jsIDBObjectStorePrototypeFunctionGetAllKeys1Body(state, castedThis, throwScope); |
766 | if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits<JSIDBKeyRange>(vm)) |
767 | return jsIDBObjectStorePrototypeFunctionGetAllKeys1Body(state, castedThis, throwScope); |
768 | return jsIDBObjectStorePrototypeFunctionGetAllKeys2Body(state, castedThis, throwScope); |
769 | } |
770 | if (argsCount == 2) { |
771 | JSValue distinguishingArg = state->uncheckedArgument(0); |
772 | if (distinguishingArg.isUndefined()) |
773 | return jsIDBObjectStorePrototypeFunctionGetAllKeys1Body(state, castedThis, throwScope); |
774 | if (distinguishingArg.isUndefinedOrNull()) |
775 | return jsIDBObjectStorePrototypeFunctionGetAllKeys1Body(state, castedThis, throwScope); |
776 | if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits<JSIDBKeyRange>(vm)) |
777 | return jsIDBObjectStorePrototypeFunctionGetAllKeys1Body(state, castedThis, throwScope); |
778 | return jsIDBObjectStorePrototypeFunctionGetAllKeys2Body(state, castedThis, throwScope); |
779 | } |
780 | return throwVMTypeError(state, throwScope); |
781 | } |
782 | |
783 | EncodedJSValue JSC_HOST_CALL jsIDBObjectStorePrototypeFunctionGetAllKeys(ExecState* state) |
784 | { |
785 | return IDLOperation<JSIDBObjectStore>::call<jsIDBObjectStorePrototypeFunctionGetAllKeysOverloadDispatcher>(*state, "getAllKeys" ); |
786 | } |
787 | |
788 | static inline JSC::EncodedJSValue jsIDBObjectStorePrototypeFunctionCreateIndexBody(JSC::ExecState* state, typename IDLOperation<JSIDBObjectStore>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
789 | { |
790 | UNUSED_PARAM(state); |
791 | UNUSED_PARAM(throwScope); |
792 | auto& impl = castedThis->wrapped(); |
793 | if (UNLIKELY(state->argumentCount() < 2)) |
794 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
795 | auto name = convert<IDLDOMString>(*state, state->uncheckedArgument(0)); |
796 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
797 | auto keyPath = convert<IDLUnion<IDLDOMString, IDLSequence<IDLDOMString>>>(*state, state->uncheckedArgument(1)); |
798 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
799 | auto options = convert<IDLDictionary<IDBObjectStore::IndexParameters>>(*state, state->argument(2)); |
800 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
801 | return JSValue::encode(toJS<IDLInterface<IDBIndex>>(*state, *castedThis->globalObject(), throwScope, impl.createIndex(*state, WTFMove(name), WTFMove(keyPath), WTFMove(options)))); |
802 | } |
803 | |
804 | EncodedJSValue JSC_HOST_CALL jsIDBObjectStorePrototypeFunctionCreateIndex(ExecState* state) |
805 | { |
806 | return IDLOperation<JSIDBObjectStore>::call<jsIDBObjectStorePrototypeFunctionCreateIndexBody>(*state, "createIndex" ); |
807 | } |
808 | |
809 | static inline JSC::EncodedJSValue jsIDBObjectStorePrototypeFunctionIndexBody(JSC::ExecState* state, typename IDLOperation<JSIDBObjectStore>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
810 | { |
811 | UNUSED_PARAM(state); |
812 | UNUSED_PARAM(throwScope); |
813 | auto& impl = castedThis->wrapped(); |
814 | if (UNLIKELY(state->argumentCount() < 1)) |
815 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
816 | auto name = convert<IDLDOMString>(*state, state->uncheckedArgument(0)); |
817 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
818 | return JSValue::encode(toJS<IDLInterface<IDBIndex>>(*state, *castedThis->globalObject(), throwScope, impl.index(WTFMove(name)))); |
819 | } |
820 | |
821 | EncodedJSValue JSC_HOST_CALL jsIDBObjectStorePrototypeFunctionIndex(ExecState* state) |
822 | { |
823 | return IDLOperation<JSIDBObjectStore>::call<jsIDBObjectStorePrototypeFunctionIndexBody>(*state, "index" ); |
824 | } |
825 | |
826 | static inline JSC::EncodedJSValue jsIDBObjectStorePrototypeFunctionDeleteIndexBody(JSC::ExecState* state, typename IDLOperation<JSIDBObjectStore>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
827 | { |
828 | UNUSED_PARAM(state); |
829 | UNUSED_PARAM(throwScope); |
830 | auto& impl = castedThis->wrapped(); |
831 | if (UNLIKELY(state->argumentCount() < 1)) |
832 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
833 | auto name = convert<IDLDOMString>(*state, state->uncheckedArgument(0)); |
834 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
835 | propagateException(*state, throwScope, impl.deleteIndex(WTFMove(name))); |
836 | return JSValue::encode(jsUndefined()); |
837 | } |
838 | |
839 | EncodedJSValue JSC_HOST_CALL jsIDBObjectStorePrototypeFunctionDeleteIndex(ExecState* state) |
840 | { |
841 | return IDLOperation<JSIDBObjectStore>::call<jsIDBObjectStorePrototypeFunctionDeleteIndexBody>(*state, "deleteIndex" ); |
842 | } |
843 | |
844 | static inline JSC::EncodedJSValue jsIDBObjectStorePrototypeFunctionCount1Body(JSC::ExecState* state, typename IDLOperation<JSIDBObjectStore>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
845 | { |
846 | UNUSED_PARAM(state); |
847 | UNUSED_PARAM(throwScope); |
848 | auto& impl = castedThis->wrapped(); |
849 | auto range = convert<IDLNullable<IDLInterface<IDBKeyRange>>>(*state, state->argument(0), [](JSC::ExecState& state, JSC::ThrowScope& scope) { throwArgumentTypeError(state, scope, 0, "range" , "IDBObjectStore" , "count" , "IDBKeyRange" ); }); |
850 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
851 | return JSValue::encode(toJS<IDLInterface<IDBRequest>>(*state, *castedThis->globalObject(), throwScope, impl.count(*state, WTFMove(range)))); |
852 | } |
853 | |
854 | static inline JSC::EncodedJSValue jsIDBObjectStorePrototypeFunctionCount2Body(JSC::ExecState* state, typename IDLOperation<JSIDBObjectStore>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
855 | { |
856 | UNUSED_PARAM(state); |
857 | UNUSED_PARAM(throwScope); |
858 | auto& impl = castedThis->wrapped(); |
859 | auto key = convert<IDLAny>(*state, state->uncheckedArgument(0)); |
860 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
861 | return JSValue::encode(toJS<IDLInterface<IDBRequest>>(*state, *castedThis->globalObject(), throwScope, impl.count(*state, WTFMove(key)))); |
862 | } |
863 | |
864 | static inline JSC::EncodedJSValue jsIDBObjectStorePrototypeFunctionCountOverloadDispatcher(JSC::ExecState* state, typename IDLOperation<JSIDBObjectStore>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
865 | { |
866 | UNUSED_PARAM(state); |
867 | UNUSED_PARAM(throwScope); |
868 | VM& vm = state->vm(); |
869 | UNUSED_PARAM(vm); |
870 | size_t argsCount = std::min<size_t>(1, state->argumentCount()); |
871 | if (argsCount == 0) { |
872 | return jsIDBObjectStorePrototypeFunctionCount1Body(state, castedThis, throwScope); |
873 | } |
874 | if (argsCount == 1) { |
875 | JSValue distinguishingArg = state->uncheckedArgument(0); |
876 | if (distinguishingArg.isUndefined()) |
877 | return jsIDBObjectStorePrototypeFunctionCount1Body(state, castedThis, throwScope); |
878 | if (distinguishingArg.isUndefinedOrNull()) |
879 | return jsIDBObjectStorePrototypeFunctionCount1Body(state, castedThis, throwScope); |
880 | if (distinguishingArg.isObject() && asObject(distinguishingArg)->inherits<JSIDBKeyRange>(vm)) |
881 | return jsIDBObjectStorePrototypeFunctionCount1Body(state, castedThis, throwScope); |
882 | return jsIDBObjectStorePrototypeFunctionCount2Body(state, castedThis, throwScope); |
883 | } |
884 | return throwVMTypeError(state, throwScope); |
885 | } |
886 | |
887 | EncodedJSValue JSC_HOST_CALL jsIDBObjectStorePrototypeFunctionCount(ExecState* state) |
888 | { |
889 | return IDLOperation<JSIDBObjectStore>::call<jsIDBObjectStorePrototypeFunctionCountOverloadDispatcher>(*state, "count" ); |
890 | } |
891 | |
892 | void JSIDBObjectStore::visitChildren(JSCell* cell, SlotVisitor& visitor) |
893 | { |
894 | auto* thisObject = jsCast<JSIDBObjectStore*>(cell); |
895 | ASSERT_GC_OBJECT_INHERITS(thisObject, info()); |
896 | Base::visitChildren(thisObject, visitor); |
897 | thisObject->visitAdditionalChildren(visitor); |
898 | } |
899 | |
900 | void JSIDBObjectStore::visitOutputConstraints(JSCell* cell, SlotVisitor& visitor) |
901 | { |
902 | auto* thisObject = jsCast<JSIDBObjectStore*>(cell); |
903 | ASSERT_GC_OBJECT_INHERITS(thisObject, info()); |
904 | Base::visitOutputConstraints(thisObject, visitor); |
905 | thisObject->visitAdditionalChildren(visitor); |
906 | } |
907 | |
908 | void JSIDBObjectStore::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
909 | { |
910 | auto* thisObject = jsCast<JSIDBObjectStore*>(cell); |
911 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
912 | if (thisObject->scriptExecutionContext()) |
913 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
914 | Base::heapSnapshot(cell, builder); |
915 | } |
916 | |
917 | bool JSIDBObjectStoreOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason) |
918 | { |
919 | auto* jsIDBObjectStore = jsCast<JSIDBObjectStore*>(handle.slot()->asCell()); |
920 | IDBObjectStore* root = &jsIDBObjectStore->wrapped(); |
921 | if (UNLIKELY(reason)) |
922 | *reason = "Reachable from IDBObjectStore" ; |
923 | return visitor.containsOpaqueRoot(root); |
924 | } |
925 | |
926 | void JSIDBObjectStoreOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
927 | { |
928 | auto* jsIDBObjectStore = static_cast<JSIDBObjectStore*>(handle.slot()->asCell()); |
929 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
930 | uncacheWrapper(world, &jsIDBObjectStore->wrapped(), jsIDBObjectStore); |
931 | } |
932 | |
933 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<IDBObjectStore>&& impl) |
934 | { |
935 | return createWrapper<IDBObjectStore>(globalObject, WTFMove(impl)); |
936 | } |
937 | |
938 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, IDBObjectStore& impl) |
939 | { |
940 | return wrap(state, globalObject, impl); |
941 | } |
942 | |
943 | IDBObjectStore* JSIDBObjectStore::toWrapped(JSC::VM& vm, JSC::JSValue value) |
944 | { |
945 | if (auto* wrapper = jsDynamicCast<JSIDBObjectStore*>(vm, value)) |
946 | return &wrapper->wrapped(); |
947 | return nullptr; |
948 | } |
949 | |
950 | } |
951 | |
952 | #endif // ENABLE(INDEXED_DATABASE) |
953 | |