blob: e6a01caaf2441a8657f389375c05ffd6fe102cfd [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"
#include "JSSQLError.h"
#include "JSDOMBinding.h"
#include "JSDOMConstructor.h"
#include "URL.h"
#include <runtime/FunctionPrototype.h>
#include <runtime/JSString.h>
#include <wtf/GetPtr.h>
using namespace JSC;
namespace WebCore {
// Attributes
JSC::EncodedJSValue jsSQLErrorCode(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsSQLErrorMessage(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsSQLErrorConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSSQLErrorConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
class JSSQLErrorPrototype : public JSC::JSNonFinalObject {
public:
typedef JSC::JSNonFinalObject Base;
static JSSQLErrorPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
{
JSSQLErrorPrototype* ptr = new (NotNull, JSC::allocateCell<JSSQLErrorPrototype>(vm.heap)) JSSQLErrorPrototype(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:
JSSQLErrorPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
: JSC::JSNonFinalObject(vm, structure)
{
}
void finishCreation(JSC::VM&);
};
typedef JSDOMConstructorNotConstructable<JSSQLError> JSSQLErrorConstructor;
/* Hash table for constructor */
static const HashTableValue JSSQLErrorConstructorTableValues[] =
{
{ "UNKNOWN_ERR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(0) } },
{ "DATABASE_ERR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(1) } },
{ "VERSION_ERR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(2) } },
{ "TOO_LARGE_ERR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(3) } },
{ "QUOTA_ERR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(4) } },
{ "SYNTAX_ERR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(5) } },
{ "CONSTRAINT_ERR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(6) } },
{ "TIMEOUT_ERR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(7) } },
};
static_assert(SQLError::UNKNOWN_ERR == 0, "UNKNOWN_ERR in SQLError does not match value from IDL");
static_assert(SQLError::DATABASE_ERR == 1, "DATABASE_ERR in SQLError does not match value from IDL");
static_assert(SQLError::VERSION_ERR == 2, "VERSION_ERR in SQLError does not match value from IDL");
static_assert(SQLError::TOO_LARGE_ERR == 3, "TOO_LARGE_ERR in SQLError does not match value from IDL");
static_assert(SQLError::QUOTA_ERR == 4, "QUOTA_ERR in SQLError does not match value from IDL");
static_assert(SQLError::SYNTAX_ERR == 5, "SYNTAX_ERR in SQLError does not match value from IDL");
static_assert(SQLError::CONSTRAINT_ERR == 6, "CONSTRAINT_ERR in SQLError does not match value from IDL");
static_assert(SQLError::TIMEOUT_ERR == 7, "TIMEOUT_ERR in SQLError does not match value from IDL");
template<> JSValue JSSQLErrorConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
{
UNUSED_PARAM(vm);
return globalObject.functionPrototype();
}
template<> void JSSQLErrorConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
{
putDirect(vm, vm.propertyNames->prototype, JSSQLError::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("SQLError"))), ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
reifyStaticProperties(vm, JSSQLErrorConstructorTableValues, *this);
}
template<> const ClassInfo JSSQLErrorConstructor::s_info = { "SQLError", &Base::s_info, 0, CREATE_METHOD_TABLE(JSSQLErrorConstructor) };
/* Hash table for prototype */
static const HashTableValue JSSQLErrorPrototypeTableValues[] =
{
{ "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLErrorConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSSQLErrorConstructor) } },
{ "code", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLErrorCode), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "message", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSQLErrorMessage), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "UNKNOWN_ERR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(0) } },
{ "DATABASE_ERR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(1) } },
{ "VERSION_ERR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(2) } },
{ "TOO_LARGE_ERR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(3) } },
{ "QUOTA_ERR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(4) } },
{ "SYNTAX_ERR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(5) } },
{ "CONSTRAINT_ERR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(6) } },
{ "TIMEOUT_ERR", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(7) } },
};
const ClassInfo JSSQLErrorPrototype::s_info = { "SQLErrorPrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSSQLErrorPrototype) };
void JSSQLErrorPrototype::finishCreation(VM& vm)
{
Base::finishCreation(vm);
reifyStaticProperties(vm, JSSQLErrorPrototypeTableValues, *this);
}
const ClassInfo JSSQLError::s_info = { "SQLError", &Base::s_info, 0, CREATE_METHOD_TABLE(JSSQLError) };
JSSQLError::JSSQLError(Structure* structure, JSDOMGlobalObject& globalObject, Ref<SQLError>&& impl)
: JSDOMWrapper<SQLError>(structure, globalObject, WTFMove(impl))
{
}
JSObject* JSSQLError::createPrototype(VM& vm, JSGlobalObject* globalObject)
{
return JSSQLErrorPrototype::create(vm, globalObject, JSSQLErrorPrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
}
JSObject* JSSQLError::prototype(VM& vm, JSGlobalObject* globalObject)
{
return getDOMPrototype<JSSQLError>(vm, globalObject);
}
void JSSQLError::destroy(JSC::JSCell* cell)
{
JSSQLError* thisObject = static_cast<JSSQLError*>(cell);
thisObject->JSSQLError::~JSSQLError();
}
EncodedJSValue jsSQLErrorCode(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<JSSQLError*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "SQLError", "code");
}
auto& impl = castedThis->wrapped();
JSValue result = jsNumber(impl.code());
return JSValue::encode(result);
}
EncodedJSValue jsSQLErrorMessage(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<JSSQLError*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "SQLError", "message");
}
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.message());
return JSValue::encode(result);
}
EncodedJSValue jsSQLErrorConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSSQLErrorPrototype* domObject = jsDynamicCast<JSSQLErrorPrototype*>(JSValue::decode(thisValue));
if (UNLIKELY(!domObject))
return throwVMTypeError(state, throwScope);
return JSValue::encode(JSSQLError::getConstructor(state->vm(), domObject->globalObject()));
}
bool setJSSQLErrorConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSValue value = JSValue::decode(encodedValue);
JSSQLErrorPrototype* domObject = jsDynamicCast<JSSQLErrorPrototype*>(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 JSSQLError::getConstructor(VM& vm, const JSGlobalObject* globalObject)
{
return getDOMConstructor<JSSQLErrorConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
}
bool JSSQLErrorOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
{
UNUSED_PARAM(handle);
UNUSED_PARAM(visitor);
return false;
}
void JSSQLErrorOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
{
auto* jsSQLError = jsCast<JSSQLError*>(handle.slot()->asCell());
auto& world = *static_cast<DOMWrapperWorld*>(context);
uncacheWrapper(world, &jsSQLError->wrapped(), jsSQLError);
}
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<SQLError>&& 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 SQLError.
static_assert(!__is_polymorphic(SQLError), "SQLError is polymorphic but the IDL claims it is not");
#endif
return createWrapper<SQLError>(globalObject, WTFMove(impl));
}
JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, SQLError& impl)
{
return wrap(state, globalObject, impl);
}
SQLError* JSSQLError::toWrapped(JSC::JSValue value)
{
if (auto* wrapper = jsDynamicCast<JSSQLError*>(value))
return &wrapper->wrapped();
return nullptr;
}
}