#include "config.h"
#include "JSTestObj.h"
#include "JSEventListener.h"
#include "JSTestObj.h"
#include "JSlog.h"
#include "KURL.h"
#include "ScriptCallStack.h"
#include "SerializedScriptValue.h"
#include "TestObj.h"
#include <runtime/Error.h>
#include <runtime/JSNumberCell.h>
#include <runtime/JSString.h>
#include <wtf/GetPtr.h>
using namespace JSC;
namespace WebCore {
ASSERT_CLASS_FITS_IN_CELL(JSTestObj);
#if ENABLE(JIT)
#define THUNK_GENERATOR(generator) , generator
#else
#define THUNK_GENERATOR(generator)
#endif
static const HashTableValue JSTestObjTableValues[15] =
{
{ "readOnlyIntAttr", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlyIntAttr), (intptr_t)0 THUNK_GENERATOR(0) },
{ "readOnlyStringAttr", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlyStringAttr), (intptr_t)0 THUNK_GENERATOR(0) },
{ "readOnlyTestObjAttr", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlyTestObjAttr), (intptr_t)0 THUNK_GENERATOR(0) },
{ "intAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjIntAttr), (intptr_t)setJSTestObjIntAttr THUNK_GENERATOR(0) },
{ "longLongAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjLongLongAttr), (intptr_t)setJSTestObjLongLongAttr THUNK_GENERATOR(0) },
{ "unsignedLongLongAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjUnsignedLongLongAttr), (intptr_t)setJSTestObjUnsignedLongLongAttr THUNK_GENERATOR(0) },
{ "stringAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjStringAttr), (intptr_t)setJSTestObjStringAttr THUNK_GENERATOR(0) },
{ "testObjAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjTestObjAttr), (intptr_t)setJSTestObjTestObjAttr THUNK_GENERATOR(0) },
{ "attrWithException", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAttrWithException), (intptr_t)setJSTestObjAttrWithException THUNK_GENERATOR(0) },
{ "attrWithSetterException", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAttrWithSetterException), (intptr_t)setJSTestObjAttrWithSetterException THUNK_GENERATOR(0) },
{ "attrWithGetterException", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAttrWithGetterException), (intptr_t)setJSTestObjAttrWithGetterException THUNK_GENERATOR(0) },
{ "customAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCustomAttr), (intptr_t)setJSTestObjCustomAttr THUNK_GENERATOR(0) },
{ "scriptStringAttr", DontDelete|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjScriptStringAttr), (intptr_t)0 THUNK_GENERATOR(0) },
{ "constructor", DontEnum|ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjConstructor), (intptr_t)0 THUNK_GENERATOR(0) },
{ 0, 0, 0, 0 THUNK_GENERATOR(0) }
};
#undef THUNK_GENERATOR
static JSC_CONST_HASHTABLE HashTable JSTestObjTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 127, JSTestObjTableValues, 0 };
#else
{ 34, 31, JSTestObjTableValues, 0 };
#endif
#if ENABLE(JIT)
#define THUNK_GENERATOR(generator) , generator
#else
#define THUNK_GENERATOR(generator)
#endif
static const HashTableValue JSTestObjConstructorTableValues[1] =
{
{ 0, 0, 0, 0 THUNK_GENERATOR(0) }
};
#undef THUNK_GENERATOR
static JSC_CONST_HASHTABLE HashTable JSTestObjConstructorTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 0, JSTestObjConstructorTableValues, 0 };
#else
{ 1, 0, JSTestObjConstructorTableValues, 0 };
#endif
class JSTestObjConstructor : public DOMConstructorObject {
public:
JSTestObjConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
: DOMConstructorObject(JSTestObjConstructor::createStructure(globalObject->objectPrototype()), globalObject)
{
putDirect(exec->propertyNames().prototype, JSTestObjPrototype::self(exec, globalObject), None);
}
virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
virtual const ClassInfo* classInfo() const { return &s_info; }
static const ClassInfo s_info;
static PassRefPtr<Structure> createStructure(JSValue proto)
{
return Structure::create(proto, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
}
protected:
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | ImplementsHasInstance | DOMConstructorObject::StructureFlags;
};
const ClassInfo JSTestObjConstructor::s_info = { "TestObjConstructor", 0, &JSTestObjConstructorTable, 0 };
bool JSTestObjConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
return getStaticValueSlot<JSTestObjConstructor, DOMObject>(exec, &JSTestObjConstructorTable, this, propertyName, slot);
}
bool JSTestObjConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
{
return getStaticValueDescriptor<JSTestObjConstructor, DOMObject>(exec, &JSTestObjConstructorTable, this, propertyName, descriptor);
}
#if ENABLE(JIT)
#define THUNK_GENERATOR(generator) , generator
#else
#define THUNK_GENERATOR(generator)
#endif
static const HashTableValue JSTestObjPrototypeTableValues[26] =
{
{ "voidMethod", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionVoidMethod), (intptr_t)0 THUNK_GENERATOR(0) },
{ "voidMethodWithArgs", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionVoidMethodWithArgs), (intptr_t)3 THUNK_GENERATOR(0) },
{ "intMethod", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionIntMethod), (intptr_t)0 THUNK_GENERATOR(0) },
{ "intMethodWithArgs", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionIntMethodWithArgs), (intptr_t)3 THUNK_GENERATOR(0) },
{ "objMethod", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionObjMethod), (intptr_t)0 THUNK_GENERATOR(0) },
{ "objMethodWithArgs", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionObjMethodWithArgs), (intptr_t)3 THUNK_GENERATOR(0) },
{ "serializedValue", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionSerializedValue), (intptr_t)1 THUNK_GENERATOR(0) },
{ "methodWithException", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithException), (intptr_t)0 THUNK_GENERATOR(0) },
{ "customMethod", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionCustomMethod), (intptr_t)0 THUNK_GENERATOR(0) },
{ "customMethodWithArgs", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionCustomMethodWithArgs), (intptr_t)3 THUNK_GENERATOR(0) },
{ "customArgsAndException", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionCustomArgsAndException), (intptr_t)1 THUNK_GENERATOR(0) },
{ "addEventListener", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionAddEventListener), (intptr_t)3 THUNK_GENERATOR(0) },
{ "removeEventListener", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionRemoveEventListener), (intptr_t)3 THUNK_GENERATOR(0) },
{ "withDynamicFrame", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithDynamicFrame), (intptr_t)0 THUNK_GENERATOR(0) },
{ "withDynamicFrameAndArg", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithDynamicFrameAndArg), (intptr_t)1 THUNK_GENERATOR(0) },
{ "withDynamicFrameAndOptionalArg", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg), (intptr_t)2 THUNK_GENERATOR(0) },
{ "withDynamicFrameAndUserGesture", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture), (intptr_t)1 THUNK_GENERATOR(0) },
{ "withDynamicFrameAndUserGestureASAD", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD), (intptr_t)2 THUNK_GENERATOR(0) },
{ "withScriptStateVoid", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptStateVoid), (intptr_t)0 THUNK_GENERATOR(0) },
{ "withScriptStateObj", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptStateObj), (intptr_t)0 THUNK_GENERATOR(0) },
{ "withScriptStateVoidException", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptStateVoidException), (intptr_t)0 THUNK_GENERATOR(0) },
{ "withScriptStateObjException", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptStateObjException), (intptr_t)0 THUNK_GENERATOR(0) },
{ "methodWithOptionalArg", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalArg), (intptr_t)1 THUNK_GENERATOR(0) },
{ "methodWithNonOptionalArgAndOptionalArg", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg), (intptr_t)2 THUNK_GENERATOR(0) },
{ "methodWithNonOptionalArgAndTwoOptionalArgs", DontDelete|Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs), (intptr_t)3 THUNK_GENERATOR(0) },
{ 0, 0, 0, 0 THUNK_GENERATOR(0) }
};
#undef THUNK_GENERATOR
static JSC_CONST_HASHTABLE HashTable JSTestObjPrototypeTable =
#if ENABLE(PERFECT_HASH_SIZE)
{ 8191, JSTestObjPrototypeTableValues, 0 };
#else
{ 67, 63, JSTestObjPrototypeTableValues, 0 };
#endif
const ClassInfo JSTestObjPrototype::s_info = { "TestObjPrototype", 0, &JSTestObjPrototypeTable, 0 };
JSObject* JSTestObjPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
{
return getDOMPrototype<JSTestObj>(exec, globalObject);
}
bool JSTestObjPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
return getStaticFunctionSlot<JSObject>(exec, &JSTestObjPrototypeTable, this, propertyName, slot);
}
bool JSTestObjPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
{
return getStaticFunctionDescriptor<JSObject>(exec, &JSTestObjPrototypeTable, this, propertyName, descriptor);
}
const ClassInfo JSTestObj::s_info = { "TestObj", 0, &JSTestObjTable, 0 };
JSTestObj::JSTestObj(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestObj> impl)
: DOMObjectWithGlobalPointer(structure, globalObject)
, m_impl(impl)
{
}
JSTestObj::~JSTestObj()
{
forgetDOMObject(this, impl());
}
JSObject* JSTestObj::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
{
return new (exec) JSTestObjPrototype(JSTestObjPrototype::createStructure(globalObject->objectPrototype()));
}
bool JSTestObj::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
return getStaticValueSlot<JSTestObj, Base>(exec, &JSTestObjTable, this, propertyName, slot);
}
bool JSTestObj::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
{
return getStaticValueDescriptor<JSTestObj, Base>(exec, &JSTestObjTable, this, propertyName, descriptor);
}
JSValue jsTestObjReadOnlyIntAttr(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
UNUSED_PARAM(exec);
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
JSValue result = jsNumber(exec, imp->readOnlyIntAttr());
return result;
}
JSValue jsTestObjReadOnlyStringAttr(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
UNUSED_PARAM(exec);
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
JSValue result = jsString(exec, imp->readOnlyStringAttr());
return result;
}
JSValue jsTestObjReadOnlyTestObjAttr(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
UNUSED_PARAM(exec);
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->readOnlyTestObjAttr()));
return result;
}
JSValue jsTestObjIntAttr(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
UNUSED_PARAM(exec);
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
JSValue result = jsNumber(exec, imp->intAttr());
return result;
}
JSValue jsTestObjLongLongAttr(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
UNUSED_PARAM(exec);
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
JSValue result = jsNumber(exec, imp->longLongAttr());
return result;
}
JSValue jsTestObjUnsignedLongLongAttr(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
UNUSED_PARAM(exec);
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
JSValue result = jsNumber(exec, imp->unsignedLongLongAttr());
return result;
}
JSValue jsTestObjStringAttr(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
UNUSED_PARAM(exec);
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
JSValue result = jsString(exec, imp->stringAttr());
return result;
}
JSValue jsTestObjTestObjAttr(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
UNUSED_PARAM(exec);
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->testObjAttr()));
return result;
}
JSValue jsTestObjAttrWithException(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
UNUSED_PARAM(exec);
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
JSValue result = jsNumber(exec, imp->attrWithException());
return result;
}
JSValue jsTestObjAttrWithSetterException(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
UNUSED_PARAM(exec);
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
JSValue result = jsNumber(exec, imp->attrWithSetterException());
return result;
}
JSValue jsTestObjAttrWithGetterException(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
UNUSED_PARAM(exec);
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
JSValue result = jsNumber(exec, imp->attrWithGetterException());
return result;
}
JSValue jsTestObjCustomAttr(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
return castedThis->customAttr(exec);
}
JSValue jsTestObjScriptStringAttr(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase));
UNUSED_PARAM(exec);
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
JSValue result = jsOwnedStringOrNull(exec, imp->scriptStringAttr());
return result;
}
JSValue jsTestObjConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSTestObj* domObject = static_cast<JSTestObj*>(asObject(slotBase));
return JSTestObj::getConstructor(exec, domObject->globalObject());
}
void JSTestObj::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
{
lookupPut<JSTestObj, Base>(exec, propertyName, value, &JSTestObjTable, this, slot);
}
void setJSTestObjIntAttr(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject);
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
imp->setIntAttr(value.toInt32(exec));
}
void setJSTestObjLongLongAttr(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject);
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
imp->setLongLongAttr(static_cast<long long>(value.toInteger(exec)));
}
void setJSTestObjUnsignedLongLongAttr(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject);
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
imp->setUnsignedLongLongAttr(static_cast<unsigned long long>(value.toInteger(exec)));
}
void setJSTestObjStringAttr(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject);
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
imp->setStringAttr(ustringToString(value.toString(exec)));
}
void setJSTestObjTestObjAttr(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject);
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
imp->setTestObjAttr(toTestObj(value));
}
void setJSTestObjAttrWithException(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject);
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
imp->setAttrWithException(value.toInt32(exec));
}
void setJSTestObjAttrWithSetterException(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject);
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
imp->setAttrWithSetterException(value.toInt32(exec));
}
void setJSTestObjAttrWithGetterException(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject);
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
imp->setAttrWithGetterException(value.toInt32(exec));
}
void setJSTestObjCustomAttr(ExecState* exec, JSObject* thisObject, JSValue value)
{
static_cast<JSTestObj*>(thisObject)->setCustomAttr(exec, value);
}
JSValue JSTestObj::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
{
return getDOMConstructor<JSTestObjConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
}
JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethod(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.inherits(&JSTestObj::s_info))
return throwError(exec, TypeError);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
imp->voidMethod();
return jsUndefined();
}
JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.inherits(&JSTestObj::s_info))
return throwError(exec, TypeError);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
int intArg = args.at(0).toInt32(exec);
const String& strArg = ustringToString(args.at(1).toString(exec));
TestObj* objArg = toTestObj(args.at(2));
imp->voidMethodWithArgs(intArg, strArg, objArg);
return jsUndefined();
}
JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethod(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.inherits(&JSTestObj::s_info))
return throwError(exec, TypeError);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
JSC::JSValue result = jsNumber(exec, imp->intMethod());
return result;
}
JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.inherits(&JSTestObj::s_info))
return throwError(exec, TypeError);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
int intArg = args.at(0).toInt32(exec);
const String& strArg = ustringToString(args.at(1).toString(exec));
TestObj* objArg = toTestObj(args.at(2));
JSC::JSValue result = jsNumber(exec, imp->intMethodWithArgs(intArg, strArg, objArg));
return result;
}
JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethod(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.inherits(&JSTestObj::s_info))
return throwError(exec, TypeError);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->objMethod()));
return result;
}
JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.inherits(&JSTestObj::s_info))
return throwError(exec, TypeError);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
int intArg = args.at(0).toInt32(exec);
const String& strArg = ustringToString(args.at(1).toString(exec));
TestObj* objArg = toTestObj(args.at(2));
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->objMethodWithArgs(intArg, strArg, objArg)));
return result;
}
JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSerializedValue(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.inherits(&JSTestObj::s_info))
return throwError(exec, TypeError);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
RefPtr<SerializedScriptValue> serializedArg = SerializedScriptValue::create(exec, args.at(0));
imp->serializedValue(serializedArg);
return jsUndefined();
}
JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithException(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.inherits(&JSTestObj::s_info))
return throwError(exec, TypeError);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
ExceptionCode ec = 0;
imp->methodWithException(ec);
setDOMException(exec, ec);
return jsUndefined();
}
JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethod(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.inherits(&JSTestObj::s_info))
return throwError(exec, TypeError);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
return castedThis->customMethod(exec, args);
}
JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethodWithArgs(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.inherits(&JSTestObj::s_info))
return throwError(exec, TypeError);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
return castedThis->customMethodWithArgs(exec, args);
}
JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.inherits(&JSTestObj::s_info))
return throwError(exec, TypeError);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
ExceptionCode ec = 0;
ScriptCallStack callStack(exec, args, 1);
log* intArg = tolog(args.at(0));
imp->customArgsAndException(intArg, &callStack, ec);
setDOMException(exec, ec);
return jsUndefined();
}
JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAddEventListener(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.inherits(&JSTestObj::s_info))
return throwError(exec, TypeError);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
JSValue listener = args.at(1);
if (!listener.isObject())
return jsUndefined();
imp->addEventListener(ustringToAtomicString(args.at(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)), args.at(2).toBoolean(exec));
return jsUndefined();
}
JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionRemoveEventListener(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.inherits(&JSTestObj::s_info))
return throwError(exec, TypeError);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
JSValue listener = args.at(1);
if (!listener.isObject())
return jsUndefined();
imp->removeEventListener(ustringToAtomicString(args.at(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), args.at(2).toBoolean(exec));
return jsUndefined();
}
JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrame(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.inherits(&JSTestObj::s_info))
return throwError(exec, TypeError);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
Frame* dynamicFrame = toDynamicFrame(exec);
if (!dynamicFrame)
return jsUndefined();
imp->withDynamicFrame(dynamicFrame);
return jsUndefined();
}
JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndArg(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.inherits(&JSTestObj::s_info))
return throwError(exec, TypeError);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
Frame* dynamicFrame = toDynamicFrame(exec);
if (!dynamicFrame)
return jsUndefined();
int intArg = args.at(1).toInt32(exec);
imp->withDynamicFrameAndArg(dynamicFrame, intArg);
return jsUndefined();
}
JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.inherits(&JSTestObj::s_info))
return throwError(exec, TypeError);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
Frame* dynamicFrame = toDynamicFrame(exec);
if (!dynamicFrame)
return jsUndefined();
int intArg = args.at(1).toInt32(exec);
int argsCount = args.size();
if (argsCount < 3) {
imp->withDynamicFrameAndOptionalArg(dynamicFrame, intArg);
return jsUndefined();
}
int optionalArg = args.at(2).toInt32(exec);
imp->withDynamicFrameAndOptionalArg(dynamicFrame, intArg, optionalArg);
return jsUndefined();
}
JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.inherits(&JSTestObj::s_info))
return throwError(exec, TypeError);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
Frame* dynamicFrame = toDynamicFrame(exec);
if (!dynamicFrame)
return jsUndefined();
int intArg = args.at(1).toInt32(exec);
imp->withDynamicFrameAndUserGesture(dynamicFrame, intArg, processingUserGesture(exec));
return jsUndefined();
}
JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.inherits(&JSTestObj::s_info))
return throwError(exec, TypeError);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
Frame* dynamicFrame = toDynamicFrame(exec);
if (!dynamicFrame)
return jsUndefined();
int intArg = args.at(1).toInt32(exec);
int argsCount = args.size();
if (argsCount < 3) {
imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg);
return jsUndefined();
}
int optionalArg = args.at(2).toInt32(exec);
imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg, optionalArg, processingUserGesture(exec));
return jsUndefined();
}
JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoid(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.inherits(&JSTestObj::s_info))
return throwError(exec, TypeError);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
imp->withScriptStateVoid(exec);
return jsUndefined();
}
JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObj(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.inherits(&JSTestObj::s_info))
return throwError(exec, TypeError);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->withScriptStateObj(exec)));
if (exec->hadException())
return jsUndefined();
return result;
}
JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoidException(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.inherits(&JSTestObj::s_info))
return throwError(exec, TypeError);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
ExceptionCode ec = 0;
imp->withScriptStateVoidException(exec, ec);
setDOMException(exec, ec);
return jsUndefined();
}
JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObjException(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.inherits(&JSTestObj::s_info))
return throwError(exec, TypeError);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
ExceptionCode ec = 0;
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->withScriptStateObjException(exec, ec)));
setDOMException(exec, ec);
if (exec->hadException())
return jsUndefined();
return result;
}
JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.inherits(&JSTestObj::s_info))
return throwError(exec, TypeError);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
int argsCount = args.size();
if (argsCount < 1) {
imp->methodWithOptionalArg();
return jsUndefined();
}
int opt = args.at(0).toInt32(exec);
imp->methodWithOptionalArg(opt);
return jsUndefined();
}
JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.inherits(&JSTestObj::s_info))
return throwError(exec, TypeError);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
int nonOpt = args.at(0).toInt32(exec);
int argsCount = args.size();
if (argsCount < 2) {
imp->methodWithNonOptionalArgAndOptionalArg(nonOpt);
return jsUndefined();
}
int opt = args.at(1).toInt32(exec);
imp->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt);
return jsUndefined();
}
JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.inherits(&JSTestObj::s_info))
return throwError(exec, TypeError);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
int nonOpt = args.at(0).toInt32(exec);
int argsCount = args.size();
if (argsCount < 2) {
imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt);
return jsUndefined();
}
int opt1 = args.at(1).toInt32(exec);
if (argsCount < 3) {
imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1);
return jsUndefined();
}
int opt2 = args.at(2).toInt32(exec);
imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2);
return jsUndefined();
}
JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestObj* object)
{
return getDOMObjectWrapper<JSTestObj>(exec, globalObject, object);
}
TestObj* toTestObj(JSC::JSValue value)
{
return value.inherits(&JSTestObj::s_info) ? static_cast<JSTestObj*>(asObject(value))->impl() : 0;
}
}