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 "JSIDBKeyRange.h" |
26 | |
27 | #include "JSDOMAttribute.h" |
28 | #include "JSDOMBinding.h" |
29 | #include "JSDOMConstructorNotConstructable.h" |
30 | #include "JSDOMConvertAny.h" |
31 | #include "JSDOMConvertBoolean.h" |
32 | #include "JSDOMConvertIndexedDB.h" |
33 | #include "JSDOMConvertInterface.h" |
34 | #include "JSDOMExceptionHandling.h" |
35 | #include "JSDOMGlobalObject.h" |
36 | #include "JSDOMOperation.h" |
37 | #include "JSDOMWrapperCache.h" |
38 | #include "JSIDBKeyRange.h" |
39 | #include "ScriptExecutionContext.h" |
40 | #include <JavaScriptCore/FunctionPrototype.h> |
41 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
42 | #include <JavaScriptCore/JSCInlines.h> |
43 | #include <wtf/GetPtr.h> |
44 | #include <wtf/PointerPreparations.h> |
45 | #include <wtf/URL.h> |
46 | |
47 | |
48 | namespace WebCore { |
49 | using namespace JSC; |
50 | |
51 | // Functions |
52 | |
53 | JSC::EncodedJSValue JSC_HOST_CALL jsIDBKeyRangeConstructorFunctionOnly(JSC::ExecState*); |
54 | JSC::EncodedJSValue JSC_HOST_CALL jsIDBKeyRangeConstructorFunctionLowerBound(JSC::ExecState*); |
55 | JSC::EncodedJSValue JSC_HOST_CALL jsIDBKeyRangeConstructorFunctionUpperBound(JSC::ExecState*); |
56 | JSC::EncodedJSValue JSC_HOST_CALL jsIDBKeyRangeConstructorFunctionBound(JSC::ExecState*); |
57 | JSC::EncodedJSValue JSC_HOST_CALL jsIDBKeyRangePrototypeFunctionIncludes(JSC::ExecState*); |
58 | |
59 | // Attributes |
60 | |
61 | JSC::EncodedJSValue jsIDBKeyRangeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
62 | bool setJSIDBKeyRangeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
63 | JSC::EncodedJSValue jsIDBKeyRangeLower(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
64 | JSC::EncodedJSValue jsIDBKeyRangeUpper(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
65 | JSC::EncodedJSValue jsIDBKeyRangeLowerOpen(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
66 | JSC::EncodedJSValue jsIDBKeyRangeUpperOpen(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
67 | |
68 | class JSIDBKeyRangePrototype : public JSC::JSNonFinalObject { |
69 | public: |
70 | using Base = JSC::JSNonFinalObject; |
71 | static JSIDBKeyRangePrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
72 | { |
73 | JSIDBKeyRangePrototype* ptr = new (NotNull, JSC::allocateCell<JSIDBKeyRangePrototype>(vm.heap)) JSIDBKeyRangePrototype(vm, globalObject, structure); |
74 | ptr->finishCreation(vm); |
75 | return ptr; |
76 | } |
77 | |
78 | DECLARE_INFO; |
79 | static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
80 | { |
81 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
82 | } |
83 | |
84 | private: |
85 | JSIDBKeyRangePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
86 | : JSC::JSNonFinalObject(vm, structure) |
87 | { |
88 | } |
89 | |
90 | void finishCreation(JSC::VM&); |
91 | }; |
92 | |
93 | using JSIDBKeyRangeConstructor = JSDOMConstructorNotConstructable<JSIDBKeyRange>; |
94 | |
95 | /* Hash table for constructor */ |
96 | |
97 | static const HashTableValue JSIDBKeyRangeConstructorTableValues[] = |
98 | { |
99 | { "only" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsIDBKeyRangeConstructorFunctionOnly), (intptr_t) (1) } }, |
100 | { "lowerBound" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsIDBKeyRangeConstructorFunctionLowerBound), (intptr_t) (1) } }, |
101 | { "upperBound" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsIDBKeyRangeConstructorFunctionUpperBound), (intptr_t) (1) } }, |
102 | { "bound" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsIDBKeyRangeConstructorFunctionBound), (intptr_t) (2) } }, |
103 | }; |
104 | |
105 | template<> JSValue JSIDBKeyRangeConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
106 | { |
107 | UNUSED_PARAM(vm); |
108 | return globalObject.functionPrototype(); |
109 | } |
110 | |
111 | template<> void JSIDBKeyRangeConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
112 | { |
113 | putDirect(vm, vm.propertyNames->prototype, JSIDBKeyRange::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
114 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("IDBKeyRange"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
115 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
116 | reifyStaticProperties(vm, JSIDBKeyRange::info(), JSIDBKeyRangeConstructorTableValues, *this); |
117 | } |
118 | |
119 | template<> const ClassInfo JSIDBKeyRangeConstructor::s_info = { "IDBKeyRange" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSIDBKeyRangeConstructor) }; |
120 | |
121 | /* Hash table for prototype */ |
122 | |
123 | static const HashTableValue JSIDBKeyRangePrototypeTableValues[] = |
124 | { |
125 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBKeyRangeConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSIDBKeyRangeConstructor) } }, |
126 | { "lower" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBKeyRangeLower), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
127 | { "upper" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBKeyRangeUpper), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
128 | { "lowerOpen" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBKeyRangeLowerOpen), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
129 | { "upperOpen" , static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBKeyRangeUpperOpen), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, |
130 | { "includes" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsIDBKeyRangePrototypeFunctionIncludes), (intptr_t) (1) } }, |
131 | }; |
132 | |
133 | const ClassInfo JSIDBKeyRangePrototype::s_info = { "IDBKeyRangePrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSIDBKeyRangePrototype) }; |
134 | |
135 | void JSIDBKeyRangePrototype::finishCreation(VM& vm) |
136 | { |
137 | Base::finishCreation(vm); |
138 | reifyStaticProperties(vm, JSIDBKeyRange::info(), JSIDBKeyRangePrototypeTableValues, *this); |
139 | } |
140 | |
141 | const ClassInfo JSIDBKeyRange::s_info = { "IDBKeyRange" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSIDBKeyRange) }; |
142 | |
143 | JSIDBKeyRange::JSIDBKeyRange(Structure* structure, JSDOMGlobalObject& globalObject, Ref<IDBKeyRange>&& impl) |
144 | : JSDOMWrapper<IDBKeyRange>(structure, globalObject, WTFMove(impl)) |
145 | { |
146 | } |
147 | |
148 | void JSIDBKeyRange::finishCreation(VM& vm) |
149 | { |
150 | Base::finishCreation(vm); |
151 | ASSERT(inherits(vm, info())); |
152 | |
153 | } |
154 | |
155 | JSObject* JSIDBKeyRange::createPrototype(VM& vm, JSDOMGlobalObject& globalObject) |
156 | { |
157 | return JSIDBKeyRangePrototype::create(vm, &globalObject, JSIDBKeyRangePrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); |
158 | } |
159 | |
160 | JSObject* JSIDBKeyRange::prototype(VM& vm, JSDOMGlobalObject& globalObject) |
161 | { |
162 | return getDOMPrototype<JSIDBKeyRange>(vm, globalObject); |
163 | } |
164 | |
165 | JSValue JSIDBKeyRange::getConstructor(VM& vm, const JSGlobalObject* globalObject) |
166 | { |
167 | return getDOMConstructor<JSIDBKeyRangeConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
168 | } |
169 | |
170 | void JSIDBKeyRange::destroy(JSC::JSCell* cell) |
171 | { |
172 | JSIDBKeyRange* thisObject = static_cast<JSIDBKeyRange*>(cell); |
173 | thisObject->JSIDBKeyRange::~JSIDBKeyRange(); |
174 | } |
175 | |
176 | template<> inline JSIDBKeyRange* IDLAttribute<JSIDBKeyRange>::cast(ExecState& state, EncodedJSValue thisValue) |
177 | { |
178 | return jsDynamicCast<JSIDBKeyRange*>(state.vm(), JSValue::decode(thisValue)); |
179 | } |
180 | |
181 | template<> inline JSIDBKeyRange* IDLOperation<JSIDBKeyRange>::cast(ExecState& state) |
182 | { |
183 | return jsDynamicCast<JSIDBKeyRange*>(state.vm(), state.thisValue()); |
184 | } |
185 | |
186 | EncodedJSValue jsIDBKeyRangeConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName) |
187 | { |
188 | VM& vm = state->vm(); |
189 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
190 | auto* prototype = jsDynamicCast<JSIDBKeyRangePrototype*>(vm, JSValue::decode(thisValue)); |
191 | if (UNLIKELY(!prototype)) |
192 | return throwVMTypeError(state, throwScope); |
193 | return JSValue::encode(JSIDBKeyRange::getConstructor(state->vm(), prototype->globalObject())); |
194 | } |
195 | |
196 | bool setJSIDBKeyRangeConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
197 | { |
198 | VM& vm = state->vm(); |
199 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
200 | auto* prototype = jsDynamicCast<JSIDBKeyRangePrototype*>(vm, JSValue::decode(thisValue)); |
201 | if (UNLIKELY(!prototype)) { |
202 | throwVMTypeError(state, throwScope); |
203 | return false; |
204 | } |
205 | // Shadowing a built-in constructor |
206 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
207 | } |
208 | |
209 | static inline JSValue jsIDBKeyRangeLowerGetter(ExecState& state, JSIDBKeyRange& thisObject, ThrowScope& throwScope) |
210 | { |
211 | UNUSED_PARAM(throwScope); |
212 | UNUSED_PARAM(state); |
213 | auto& impl = thisObject.wrapped(); |
214 | JSValue result = toJS<IDLIDBKey>(state, *thisObject.globalObject(), throwScope, impl.lower()); |
215 | return result; |
216 | } |
217 | |
218 | EncodedJSValue jsIDBKeyRangeLower(ExecState* state, EncodedJSValue thisValue, PropertyName) |
219 | { |
220 | return IDLAttribute<JSIDBKeyRange>::get<jsIDBKeyRangeLowerGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "lower" ); |
221 | } |
222 | |
223 | static inline JSValue jsIDBKeyRangeUpperGetter(ExecState& state, JSIDBKeyRange& thisObject, ThrowScope& throwScope) |
224 | { |
225 | UNUSED_PARAM(throwScope); |
226 | UNUSED_PARAM(state); |
227 | auto& impl = thisObject.wrapped(); |
228 | JSValue result = toJS<IDLIDBKey>(state, *thisObject.globalObject(), throwScope, impl.upper()); |
229 | return result; |
230 | } |
231 | |
232 | EncodedJSValue jsIDBKeyRangeUpper(ExecState* state, EncodedJSValue thisValue, PropertyName) |
233 | { |
234 | return IDLAttribute<JSIDBKeyRange>::get<jsIDBKeyRangeUpperGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "upper" ); |
235 | } |
236 | |
237 | static inline JSValue jsIDBKeyRangeLowerOpenGetter(ExecState& state, JSIDBKeyRange& thisObject, ThrowScope& throwScope) |
238 | { |
239 | UNUSED_PARAM(throwScope); |
240 | UNUSED_PARAM(state); |
241 | auto& impl = thisObject.wrapped(); |
242 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.lowerOpen()); |
243 | return result; |
244 | } |
245 | |
246 | EncodedJSValue jsIDBKeyRangeLowerOpen(ExecState* state, EncodedJSValue thisValue, PropertyName) |
247 | { |
248 | return IDLAttribute<JSIDBKeyRange>::get<jsIDBKeyRangeLowerOpenGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "lowerOpen" ); |
249 | } |
250 | |
251 | static inline JSValue jsIDBKeyRangeUpperOpenGetter(ExecState& state, JSIDBKeyRange& thisObject, ThrowScope& throwScope) |
252 | { |
253 | UNUSED_PARAM(throwScope); |
254 | UNUSED_PARAM(state); |
255 | auto& impl = thisObject.wrapped(); |
256 | JSValue result = toJS<IDLBoolean>(state, throwScope, impl.upperOpen()); |
257 | return result; |
258 | } |
259 | |
260 | EncodedJSValue jsIDBKeyRangeUpperOpen(ExecState* state, EncodedJSValue thisValue, PropertyName) |
261 | { |
262 | return IDLAttribute<JSIDBKeyRange>::get<jsIDBKeyRangeUpperOpenGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "upperOpen" ); |
263 | } |
264 | |
265 | static inline JSC::EncodedJSValue jsIDBKeyRangeConstructorFunctionOnlyBody(JSC::ExecState* state, JSC::ThrowScope& throwScope) |
266 | { |
267 | UNUSED_PARAM(state); |
268 | UNUSED_PARAM(throwScope); |
269 | if (UNLIKELY(state->argumentCount() < 1)) |
270 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
271 | auto value = convert<IDLAny>(*state, state->uncheckedArgument(0)); |
272 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
273 | return JSValue::encode(toJS<IDLInterface<IDBKeyRange>>(*state, *jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject()), throwScope, IDBKeyRange::only(*state, WTFMove(value)))); |
274 | } |
275 | |
276 | EncodedJSValue JSC_HOST_CALL jsIDBKeyRangeConstructorFunctionOnly(ExecState* state) |
277 | { |
278 | return IDLOperation<JSIDBKeyRange>::callStatic<jsIDBKeyRangeConstructorFunctionOnlyBody>(*state, "only" ); |
279 | } |
280 | |
281 | static inline JSC::EncodedJSValue jsIDBKeyRangeConstructorFunctionLowerBoundBody(JSC::ExecState* state, JSC::ThrowScope& throwScope) |
282 | { |
283 | UNUSED_PARAM(state); |
284 | UNUSED_PARAM(throwScope); |
285 | if (UNLIKELY(state->argumentCount() < 1)) |
286 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
287 | auto lower = convert<IDLAny>(*state, state->uncheckedArgument(0)); |
288 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
289 | auto open = convert<IDLBoolean>(*state, state->argument(1)); |
290 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
291 | return JSValue::encode(toJS<IDLInterface<IDBKeyRange>>(*state, *jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject()), throwScope, IDBKeyRange::lowerBound(*state, WTFMove(lower), WTFMove(open)))); |
292 | } |
293 | |
294 | EncodedJSValue JSC_HOST_CALL jsIDBKeyRangeConstructorFunctionLowerBound(ExecState* state) |
295 | { |
296 | return IDLOperation<JSIDBKeyRange>::callStatic<jsIDBKeyRangeConstructorFunctionLowerBoundBody>(*state, "lowerBound" ); |
297 | } |
298 | |
299 | static inline JSC::EncodedJSValue jsIDBKeyRangeConstructorFunctionUpperBoundBody(JSC::ExecState* state, JSC::ThrowScope& throwScope) |
300 | { |
301 | UNUSED_PARAM(state); |
302 | UNUSED_PARAM(throwScope); |
303 | if (UNLIKELY(state->argumentCount() < 1)) |
304 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
305 | auto upper = convert<IDLAny>(*state, state->uncheckedArgument(0)); |
306 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
307 | auto open = convert<IDLBoolean>(*state, state->argument(1)); |
308 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
309 | return JSValue::encode(toJS<IDLInterface<IDBKeyRange>>(*state, *jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject()), throwScope, IDBKeyRange::upperBound(*state, WTFMove(upper), WTFMove(open)))); |
310 | } |
311 | |
312 | EncodedJSValue JSC_HOST_CALL jsIDBKeyRangeConstructorFunctionUpperBound(ExecState* state) |
313 | { |
314 | return IDLOperation<JSIDBKeyRange>::callStatic<jsIDBKeyRangeConstructorFunctionUpperBoundBody>(*state, "upperBound" ); |
315 | } |
316 | |
317 | static inline JSC::EncodedJSValue jsIDBKeyRangeConstructorFunctionBoundBody(JSC::ExecState* state, JSC::ThrowScope& throwScope) |
318 | { |
319 | UNUSED_PARAM(state); |
320 | UNUSED_PARAM(throwScope); |
321 | if (UNLIKELY(state->argumentCount() < 2)) |
322 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
323 | auto lower = convert<IDLAny>(*state, state->uncheckedArgument(0)); |
324 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
325 | auto upper = convert<IDLAny>(*state, state->uncheckedArgument(1)); |
326 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
327 | auto lowerOpen = convert<IDLBoolean>(*state, state->argument(2)); |
328 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
329 | auto upperOpen = convert<IDLBoolean>(*state, state->argument(3)); |
330 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
331 | return JSValue::encode(toJS<IDLInterface<IDBKeyRange>>(*state, *jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject()), throwScope, IDBKeyRange::bound(*state, WTFMove(lower), WTFMove(upper), WTFMove(lowerOpen), WTFMove(upperOpen)))); |
332 | } |
333 | |
334 | EncodedJSValue JSC_HOST_CALL jsIDBKeyRangeConstructorFunctionBound(ExecState* state) |
335 | { |
336 | return IDLOperation<JSIDBKeyRange>::callStatic<jsIDBKeyRangeConstructorFunctionBoundBody>(*state, "bound" ); |
337 | } |
338 | |
339 | static inline JSC::EncodedJSValue jsIDBKeyRangePrototypeFunctionIncludesBody(JSC::ExecState* state, typename IDLOperation<JSIDBKeyRange>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
340 | { |
341 | UNUSED_PARAM(state); |
342 | UNUSED_PARAM(throwScope); |
343 | auto& impl = castedThis->wrapped(); |
344 | if (UNLIKELY(state->argumentCount() < 1)) |
345 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
346 | auto key = convert<IDLAny>(*state, state->uncheckedArgument(0)); |
347 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
348 | return JSValue::encode(toJS<IDLBoolean>(*state, throwScope, impl.includes(*state, WTFMove(key)))); |
349 | } |
350 | |
351 | EncodedJSValue JSC_HOST_CALL jsIDBKeyRangePrototypeFunctionIncludes(ExecState* state) |
352 | { |
353 | return IDLOperation<JSIDBKeyRange>::call<jsIDBKeyRangePrototypeFunctionIncludesBody>(*state, "includes" ); |
354 | } |
355 | |
356 | void JSIDBKeyRange::heapSnapshot(JSCell* cell, HeapSnapshotBuilder& builder) |
357 | { |
358 | auto* thisObject = jsCast<JSIDBKeyRange*>(cell); |
359 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
360 | if (thisObject->scriptExecutionContext()) |
361 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
362 | Base::heapSnapshot(cell, builder); |
363 | } |
364 | |
365 | bool JSIDBKeyRangeOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason) |
366 | { |
367 | UNUSED_PARAM(handle); |
368 | UNUSED_PARAM(visitor); |
369 | UNUSED_PARAM(reason); |
370 | return false; |
371 | } |
372 | |
373 | void JSIDBKeyRangeOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
374 | { |
375 | auto* jsIDBKeyRange = static_cast<JSIDBKeyRange*>(handle.slot()->asCell()); |
376 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
377 | uncacheWrapper(world, &jsIDBKeyRange->wrapped(), jsIDBKeyRange); |
378 | } |
379 | |
380 | JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<IDBKeyRange>&& impl) |
381 | { |
382 | // If you hit this failure the interface definition has the ImplementationLacksVTable |
383 | // attribute. You should remove that attribute. If the class has subclasses |
384 | // that may be passed through this toJS() function you should use the SkipVTableValidation |
385 | // attribute to IDBKeyRange. |
386 | static_assert(!std::is_polymorphic<IDBKeyRange>::value, "IDBKeyRange is polymorphic but the IDL claims it is not" ); |
387 | return createWrapper<IDBKeyRange>(globalObject, WTFMove(impl)); |
388 | } |
389 | |
390 | JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, IDBKeyRange& impl) |
391 | { |
392 | return wrap(state, globalObject, impl); |
393 | } |
394 | |
395 | IDBKeyRange* JSIDBKeyRange::toWrapped(JSC::VM& vm, JSC::JSValue value) |
396 | { |
397 | if (auto* wrapper = jsDynamicCast<JSIDBKeyRange*>(vm, value)) |
398 | return &wrapper->wrapped(); |
399 | return nullptr; |
400 | } |
401 | |
402 | } |
403 | |
404 | #endif // ENABLE(INDEXED_DATABASE) |
405 | |