blob: 668f5f0eb7adf02006cc28ccab7c08e3c7dd616a [file] [log] [blame]
/*
This file is part of the WebKit open source project.
This file has been generated by generate-bindings.pl. DO NOT MODIFY!
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "config.h"
#if ENABLE(INDEXED_DATABASE)
#include "JSIDBKeyRange.h"
#include "ExceptionCode.h"
#include "IDBBindingUtilities.h"
#include "IDBKeyRange.h"
#include "JSDOMBinding.h"
#include "JSDOMConstructor.h"
#include "JSIDBKeyRange.h"
#include <runtime/Error.h>
#include <runtime/FunctionPrototype.h>
#include <wtf/GetPtr.h>
using namespace JSC;
namespace WebCore {
// Functions
JSC::EncodedJSValue JSC_HOST_CALL jsIDBKeyRangeConstructorFunctionOnly(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsIDBKeyRangeConstructorFunctionLowerBound(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsIDBKeyRangeConstructorFunctionUpperBound(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsIDBKeyRangeConstructorFunctionBound(JSC::ExecState*);
// Attributes
JSC::EncodedJSValue jsIDBKeyRangeLower(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsIDBKeyRangeUpper(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsIDBKeyRangeLowerOpen(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsIDBKeyRangeUpperOpen(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsIDBKeyRangeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSIDBKeyRangeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
class JSIDBKeyRangePrototype : public JSC::JSNonFinalObject {
public:
typedef JSC::JSNonFinalObject Base;
static JSIDBKeyRangePrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
{
JSIDBKeyRangePrototype* ptr = new (NotNull, JSC::allocateCell<JSIDBKeyRangePrototype>(vm.heap)) JSIDBKeyRangePrototype(vm, globalObject, structure);
ptr->finishCreation(vm);
return ptr;
}
DECLARE_INFO;
static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
{
return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
}
private:
JSIDBKeyRangePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
: JSC::JSNonFinalObject(vm, structure)
{
}
void finishCreation(JSC::VM&);
};
typedef JSDOMConstructorNotConstructable<JSIDBKeyRange> JSIDBKeyRangeConstructor;
/* Hash table for constructor */
static const HashTableValue JSIDBKeyRangeConstructorTableValues[] =
{
{ "only", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsIDBKeyRangeConstructorFunctionOnly), (intptr_t) (1) } },
{ "lowerBound", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsIDBKeyRangeConstructorFunctionLowerBound), (intptr_t) (1) } },
{ "upperBound", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsIDBKeyRangeConstructorFunctionUpperBound), (intptr_t) (1) } },
{ "bound", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsIDBKeyRangeConstructorFunctionBound), (intptr_t) (2) } },
};
template<> JSValue JSIDBKeyRangeConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
{
UNUSED_PARAM(vm);
return globalObject.functionPrototype();
}
template<> void JSIDBKeyRangeConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
{
putDirect(vm, vm.propertyNames->prototype, JSIDBKeyRange::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("IDBKeyRange"))), ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
reifyStaticProperties(vm, JSIDBKeyRangeConstructorTableValues, *this);
}
template<> const ClassInfo JSIDBKeyRangeConstructor::s_info = { "IDBKeyRange", &Base::s_info, 0, CREATE_METHOD_TABLE(JSIDBKeyRangeConstructor) };
/* Hash table for prototype */
static const HashTableValue JSIDBKeyRangePrototypeTableValues[] =
{
{ "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBKeyRangeConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSIDBKeyRangeConstructor) } },
{ "lower", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBKeyRangeLower), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "upper", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBKeyRangeUpper), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "lowerOpen", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBKeyRangeLowerOpen), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "upperOpen", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsIDBKeyRangeUpperOpen), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
};
const ClassInfo JSIDBKeyRangePrototype::s_info = { "IDBKeyRangePrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSIDBKeyRangePrototype) };
void JSIDBKeyRangePrototype::finishCreation(VM& vm)
{
Base::finishCreation(vm);
reifyStaticProperties(vm, JSIDBKeyRangePrototypeTableValues, *this);
}
const ClassInfo JSIDBKeyRange::s_info = { "IDBKeyRange", &Base::s_info, 0, CREATE_METHOD_TABLE(JSIDBKeyRange) };
JSIDBKeyRange::JSIDBKeyRange(Structure* structure, JSDOMGlobalObject& globalObject, Ref<IDBKeyRange>&& impl)
: JSDOMWrapper<IDBKeyRange>(structure, globalObject, WTFMove(impl))
{
}
JSObject* JSIDBKeyRange::createPrototype(VM& vm, JSGlobalObject* globalObject)
{
return JSIDBKeyRangePrototype::create(vm, globalObject, JSIDBKeyRangePrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
}
JSObject* JSIDBKeyRange::prototype(VM& vm, JSGlobalObject* globalObject)
{
return getDOMPrototype<JSIDBKeyRange>(vm, globalObject);
}
void JSIDBKeyRange::destroy(JSC::JSCell* cell)
{
JSIDBKeyRange* thisObject = static_cast<JSIDBKeyRange*>(cell);
thisObject->JSIDBKeyRange::~JSIDBKeyRange();
}
EncodedJSValue jsIDBKeyRangeLower(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSIDBKeyRange*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "IDBKeyRange", "lower");
}
auto& impl = castedThis->wrapped();
JSValue result = toJS(*state, *castedThis->globalObject(), impl.lower());
return JSValue::encode(result);
}
EncodedJSValue jsIDBKeyRangeUpper(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSIDBKeyRange*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "IDBKeyRange", "upper");
}
auto& impl = castedThis->wrapped();
JSValue result = toJS(*state, *castedThis->globalObject(), impl.upper());
return JSValue::encode(result);
}
EncodedJSValue jsIDBKeyRangeLowerOpen(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSIDBKeyRange*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "IDBKeyRange", "lowerOpen");
}
auto& impl = castedThis->wrapped();
JSValue result = jsBoolean(impl.lowerOpen());
return JSValue::encode(result);
}
EncodedJSValue jsIDBKeyRangeUpperOpen(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSIDBKeyRange*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "IDBKeyRange", "upperOpen");
}
auto& impl = castedThis->wrapped();
JSValue result = jsBoolean(impl.upperOpen());
return JSValue::encode(result);
}
EncodedJSValue jsIDBKeyRangeConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSIDBKeyRangePrototype* domObject = jsDynamicCast<JSIDBKeyRangePrototype*>(JSValue::decode(thisValue));
if (UNLIKELY(!domObject))
return throwVMTypeError(state, throwScope);
return JSValue::encode(JSIDBKeyRange::getConstructor(state->vm(), domObject->globalObject()));
}
bool setJSIDBKeyRangeConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSValue value = JSValue::decode(encodedValue);
JSIDBKeyRangePrototype* domObject = jsDynamicCast<JSIDBKeyRangePrototype*>(JSValue::decode(thisValue));
if (UNLIKELY(!domObject)) {
throwVMTypeError(state, throwScope);
return false;
}
// Shadowing a built-in constructor
return domObject->putDirect(state->vm(), state->propertyNames().constructor, value);
}
JSValue JSIDBKeyRange::getConstructor(VM& vm, const JSGlobalObject* globalObject)
{
return getDOMConstructor<JSIDBKeyRangeConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
}
EncodedJSValue JSC_HOST_CALL jsIDBKeyRangeConstructorFunctionOnly(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
ExceptionCode ec = 0;
auto value = state->uncheckedArgument(0);
JSValue result = toJS(state, jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject()), IDBKeyRange::only(*state, WTFMove(value), ec));
setDOMException(state, throwScope, ec);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
return JSValue::encode(result);
}
EncodedJSValue JSC_HOST_CALL jsIDBKeyRangeConstructorFunctionLowerBound(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
ExceptionCode ec = 0;
auto lower = state->uncheckedArgument(0);
auto open = state->argument(1).toBoolean(state);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
JSValue result = toJS(state, jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject()), IDBKeyRange::lowerBound(*state, WTFMove(lower), WTFMove(open), ec));
setDOMException(state, throwScope, ec);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
return JSValue::encode(result);
}
EncodedJSValue JSC_HOST_CALL jsIDBKeyRangeConstructorFunctionUpperBound(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
if (UNLIKELY(state->argumentCount() < 1))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
ExceptionCode ec = 0;
auto upper = state->uncheckedArgument(0);
auto open = state->argument(1).toBoolean(state);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
JSValue result = toJS(state, jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject()), IDBKeyRange::upperBound(*state, WTFMove(upper), WTFMove(open), ec));
setDOMException(state, throwScope, ec);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
return JSValue::encode(result);
}
EncodedJSValue JSC_HOST_CALL jsIDBKeyRangeConstructorFunctionBound(ExecState* state)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
if (UNLIKELY(state->argumentCount() < 2))
return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
ExceptionCode ec = 0;
auto lower = state->uncheckedArgument(0);
auto upper = state->uncheckedArgument(1);
auto lowerOpen = state->argument(2).toBoolean(state);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
auto upperOpen = state->argument(3).toBoolean(state);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
JSValue result = toJS(state, jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject()), IDBKeyRange::bound(*state, WTFMove(lower), WTFMove(upper), WTFMove(lowerOpen), WTFMove(upperOpen), ec));
setDOMException(state, throwScope, ec);
RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
return JSValue::encode(result);
}
bool JSIDBKeyRangeOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
{
UNUSED_PARAM(handle);
UNUSED_PARAM(visitor);
return false;
}
void JSIDBKeyRangeOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
{
auto* jsIDBKeyRange = jsCast<JSIDBKeyRange*>(handle.slot()->asCell());
auto& world = *static_cast<DOMWrapperWorld*>(context);
uncacheWrapper(world, &jsIDBKeyRange->wrapped(), jsIDBKeyRange);
}
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<IDBKeyRange>&& impl)
{
#if COMPILER(CLANG)
// If you hit this failure the interface definition has the ImplementationLacksVTable
// attribute. You should remove that attribute. If the class has subclasses
// that may be passed through this toJS() function you should use the SkipVTableValidation
// attribute to IDBKeyRange.
static_assert(!__is_polymorphic(IDBKeyRange), "IDBKeyRange is polymorphic but the IDL claims it is not");
#endif
return createWrapper<IDBKeyRange>(globalObject, WTFMove(impl));
}
JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, IDBKeyRange& impl)
{
return wrap(state, globalObject, impl);
}
IDBKeyRange* JSIDBKeyRange::toWrapped(JSC::JSValue value)
{
if (auto* wrapper = jsDynamicCast<JSIDBKeyRange*>(value))
return &wrapper->wrapped();
return nullptr;
}
}
#endif // ENABLE(INDEXED_DATABASE)