/* 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 "JSTestObj.h" #include "JSEventListener.h" #include "JSTestObj.h" #include "JSlog.h" #include "KURL.h" #include "ScriptCallStack.h" #include "SerializedScriptValue.h" #include "TestObj.h" #include #include #include #include using namespace JSC; namespace WebCore { ASSERT_CLASS_FITS_IN_CELL(JSTestObj); /* Hash table */ #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(jsTestObjReadOnlyIntAttr), (intptr_t)0 THUNK_GENERATOR(0) }, { "readOnlyStringAttr", DontDelete | ReadOnly, (intptr_t)static_cast(jsTestObjReadOnlyStringAttr), (intptr_t)0 THUNK_GENERATOR(0) }, { "readOnlyTestObjAttr", DontDelete | ReadOnly, (intptr_t)static_cast(jsTestObjReadOnlyTestObjAttr), (intptr_t)0 THUNK_GENERATOR(0) }, { "intAttr", DontDelete, (intptr_t)static_cast(jsTestObjIntAttr), (intptr_t)setJSTestObjIntAttr THUNK_GENERATOR(0) }, { "longLongAttr", DontDelete, (intptr_t)static_cast(jsTestObjLongLongAttr), (intptr_t)setJSTestObjLongLongAttr THUNK_GENERATOR(0) }, { "unsignedLongLongAttr", DontDelete, (intptr_t)static_cast(jsTestObjUnsignedLongLongAttr), (intptr_t)setJSTestObjUnsignedLongLongAttr THUNK_GENERATOR(0) }, { "stringAttr", DontDelete, (intptr_t)static_cast(jsTestObjStringAttr), (intptr_t)setJSTestObjStringAttr THUNK_GENERATOR(0) }, { "testObjAttr", DontDelete, (intptr_t)static_cast(jsTestObjTestObjAttr), (intptr_t)setJSTestObjTestObjAttr THUNK_GENERATOR(0) }, { "attrWithException", DontDelete, (intptr_t)static_cast(jsTestObjAttrWithException), (intptr_t)setJSTestObjAttrWithException THUNK_GENERATOR(0) }, { "attrWithSetterException", DontDelete, (intptr_t)static_cast(jsTestObjAttrWithSetterException), (intptr_t)setJSTestObjAttrWithSetterException THUNK_GENERATOR(0) }, { "attrWithGetterException", DontDelete, (intptr_t)static_cast(jsTestObjAttrWithGetterException), (intptr_t)setJSTestObjAttrWithGetterException THUNK_GENERATOR(0) }, { "customAttr", DontDelete, (intptr_t)static_cast(jsTestObjCustomAttr), (intptr_t)setJSTestObjCustomAttr THUNK_GENERATOR(0) }, { "scriptStringAttr", DontDelete | ReadOnly, (intptr_t)static_cast(jsTestObjScriptStringAttr), (intptr_t)0 THUNK_GENERATOR(0) }, { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast(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 /* Hash table for constructor */ #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 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(exec, &JSTestObjConstructorTable, this, propertyName, slot); } bool JSTestObjConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) { return getStaticValueDescriptor(exec, &JSTestObjConstructorTable, this, propertyName, descriptor); } /* Hash table for prototype */ #if ENABLE(JIT) #define THUNK_GENERATOR(generator) , generator #else #define THUNK_GENERATOR(generator) #endif static const HashTableValue JSTestObjPrototypeTableValues[29] = { { "voidMethod", DontDelete | Function, (intptr_t)static_cast(jsTestObjPrototypeFunctionVoidMethod), (intptr_t)0 THUNK_GENERATOR(0) }, { "voidMethodWithArgs", DontDelete | Function, (intptr_t)static_cast(jsTestObjPrototypeFunctionVoidMethodWithArgs), (intptr_t)3 THUNK_GENERATOR(0) }, { "intMethod", DontDelete | Function, (intptr_t)static_cast(jsTestObjPrototypeFunctionIntMethod), (intptr_t)0 THUNK_GENERATOR(0) }, { "intMethodWithArgs", DontDelete | Function, (intptr_t)static_cast(jsTestObjPrototypeFunctionIntMethodWithArgs), (intptr_t)3 THUNK_GENERATOR(0) }, { "objMethod", DontDelete | Function, (intptr_t)static_cast(jsTestObjPrototypeFunctionObjMethod), (intptr_t)0 THUNK_GENERATOR(0) }, { "objMethodWithArgs", DontDelete | Function, (intptr_t)static_cast(jsTestObjPrototypeFunctionObjMethodWithArgs), (intptr_t)3 THUNK_GENERATOR(0) }, { "methodThatRequiresAllArgs", DontDelete | Function, (intptr_t)static_cast(jsTestObjPrototypeFunctionMethodThatRequiresAllArgs), (intptr_t)2 THUNK_GENERATOR(0) }, { "methodThatRequiresAllArgsAndThrows", DontDelete | Function, (intptr_t)static_cast(jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows), (intptr_t)2 THUNK_GENERATOR(0) }, { "serializedValue", DontDelete | Function, (intptr_t)static_cast(jsTestObjPrototypeFunctionSerializedValue), (intptr_t)1 THUNK_GENERATOR(0) }, { "methodWithException", DontDelete | Function, (intptr_t)static_cast(jsTestObjPrototypeFunctionMethodWithException), (intptr_t)0 THUNK_GENERATOR(0) }, { "customMethod", DontDelete | Function, (intptr_t)static_cast(jsTestObjPrototypeFunctionCustomMethod), (intptr_t)0 THUNK_GENERATOR(0) }, { "customMethodWithArgs", DontDelete | Function, (intptr_t)static_cast(jsTestObjPrototypeFunctionCustomMethodWithArgs), (intptr_t)3 THUNK_GENERATOR(0) }, { "customArgsAndException", DontDelete | Function, (intptr_t)static_cast(jsTestObjPrototypeFunctionCustomArgsAndException), (intptr_t)1 THUNK_GENERATOR(0) }, { "addEventListener", DontDelete | Function, (intptr_t)static_cast(jsTestObjPrototypeFunctionAddEventListener), (intptr_t)3 THUNK_GENERATOR(0) }, { "removeEventListener", DontDelete | Function, (intptr_t)static_cast(jsTestObjPrototypeFunctionRemoveEventListener), (intptr_t)3 THUNK_GENERATOR(0) }, { "withDynamicFrame", DontDelete | Function, (intptr_t)static_cast(jsTestObjPrototypeFunctionWithDynamicFrame), (intptr_t)0 THUNK_GENERATOR(0) }, { "withDynamicFrameAndArg", DontDelete | Function, (intptr_t)static_cast(jsTestObjPrototypeFunctionWithDynamicFrameAndArg), (intptr_t)1 THUNK_GENERATOR(0) }, { "withDynamicFrameAndOptionalArg", DontDelete | Function, (intptr_t)static_cast(jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg), (intptr_t)2 THUNK_GENERATOR(0) }, { "withDynamicFrameAndUserGesture", DontDelete | Function, (intptr_t)static_cast(jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture), (intptr_t)1 THUNK_GENERATOR(0) }, { "withDynamicFrameAndUserGestureASAD", DontDelete | Function, (intptr_t)static_cast(jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD), (intptr_t)2 THUNK_GENERATOR(0) }, { "withScriptStateVoid", DontDelete | Function, (intptr_t)static_cast(jsTestObjPrototypeFunctionWithScriptStateVoid), (intptr_t)0 THUNK_GENERATOR(0) }, { "withScriptStateObj", DontDelete | Function, (intptr_t)static_cast(jsTestObjPrototypeFunctionWithScriptStateObj), (intptr_t)0 THUNK_GENERATOR(0) }, { "withScriptStateVoidException", DontDelete | Function, (intptr_t)static_cast(jsTestObjPrototypeFunctionWithScriptStateVoidException), (intptr_t)0 THUNK_GENERATOR(0) }, { "withScriptStateObjException", DontDelete | Function, (intptr_t)static_cast(jsTestObjPrototypeFunctionWithScriptStateObjException), (intptr_t)0 THUNK_GENERATOR(0) }, { "methodWithOptionalArg", DontDelete | Function, (intptr_t)static_cast(jsTestObjPrototypeFunctionMethodWithOptionalArg), (intptr_t)1 THUNK_GENERATOR(0) }, { "methodWithNonOptionalArgAndOptionalArg", DontDelete | Function, (intptr_t)static_cast(jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg), (intptr_t)2 THUNK_GENERATOR(0) }, { "methodWithNonOptionalArgAndTwoOptionalArgs", DontDelete | Function, (intptr_t)static_cast(jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs), (intptr_t)3 THUNK_GENERATOR(0) }, { "overloadedMethod", DontDelete | Function, (intptr_t)static_cast(jsTestObjPrototypeFunctionOverloadedMethod), (intptr_t)2 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 { 69, 63, JSTestObjPrototypeTableValues, 0 }; #endif const ClassInfo JSTestObjPrototype::s_info = { "TestObjPrototype", 0, &JSTestObjPrototypeTable, 0 }; JSObject* JSTestObjPrototype::self(ExecState* exec, JSGlobalObject* globalObject) { return getDOMPrototype(exec, globalObject); } bool JSTestObjPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) { return getStaticFunctionSlot(exec, &JSTestObjPrototypeTable, this, propertyName, slot); } bool JSTestObjPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) { return getStaticFunctionDescriptor(exec, &JSTestObjPrototypeTable, this, propertyName, descriptor); } const ClassInfo JSTestObj::s_info = { "TestObj", 0, &JSTestObjTable, 0 }; JSTestObj::JSTestObj(NonNullPassRefPtr structure, JSDOMGlobalObject* globalObject, PassRefPtr 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(exec, &JSTestObjTable, this, propertyName, slot); } bool JSTestObj::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) { return getStaticValueDescriptor(exec, &JSTestObjTable, this, propertyName, descriptor); } JSValue jsTestObjReadOnlyIntAttr(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* castedThis = static_cast(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* imp = static_cast(castedThis->impl()); JSValue result = jsNumber(exec, imp->readOnlyIntAttr()); return result; } JSValue jsTestObjReadOnlyStringAttr(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* castedThis = static_cast(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* imp = static_cast(castedThis->impl()); JSValue result = jsString(exec, imp->readOnlyStringAttr()); return result; } JSValue jsTestObjReadOnlyTestObjAttr(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* castedThis = static_cast(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* imp = static_cast(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(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* imp = static_cast(castedThis->impl()); JSValue result = jsNumber(exec, imp->intAttr()); return result; } JSValue jsTestObjLongLongAttr(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* castedThis = static_cast(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* imp = static_cast(castedThis->impl()); JSValue result = jsNumber(exec, imp->longLongAttr()); return result; } JSValue jsTestObjUnsignedLongLongAttr(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* castedThis = static_cast(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* imp = static_cast(castedThis->impl()); JSValue result = jsNumber(exec, imp->unsignedLongLongAttr()); return result; } JSValue jsTestObjStringAttr(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* castedThis = static_cast(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* imp = static_cast(castedThis->impl()); JSValue result = jsString(exec, imp->stringAttr()); return result; } JSValue jsTestObjTestObjAttr(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* castedThis = static_cast(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* imp = static_cast(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(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* imp = static_cast(castedThis->impl()); JSValue result = jsNumber(exec, imp->attrWithException()); return result; } JSValue jsTestObjAttrWithSetterException(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* castedThis = static_cast(asObject(slotBase)); ExceptionCode ec = 0; TestObj* imp = static_cast(castedThis->impl()); JSC::JSValue result = jsNumber(exec, imp->attrWithSetterException(ec)); setDOMException(exec, ec); return result; } JSValue jsTestObjAttrWithGetterException(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* castedThis = static_cast(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* imp = static_cast(castedThis->impl()); JSValue result = jsNumber(exec, imp->attrWithGetterException()); return result; } JSValue jsTestObjCustomAttr(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* castedThis = static_cast(asObject(slotBase)); return castedThis->customAttr(exec); } JSValue jsTestObjScriptStringAttr(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* castedThis = static_cast(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* imp = static_cast(castedThis->impl()); JSValue result = jsOwnedStringOrNull(exec, imp->scriptStringAttr()); return result; } JSValue jsTestObjConstructor(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* domObject = static_cast(asObject(slotBase)); return JSTestObj::getConstructor(exec, domObject->globalObject()); } void JSTestObj::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) { lookupPut(exec, propertyName, value, &JSTestObjTable, this, slot); } void setJSTestObjIntAttr(ExecState* exec, JSObject* thisObject, JSValue value) { JSTestObj* castedThis = static_cast(thisObject); TestObj* imp = static_cast(castedThis->impl()); imp->setIntAttr(value.toInt32(exec)); } void setJSTestObjLongLongAttr(ExecState* exec, JSObject* thisObject, JSValue value) { JSTestObj* castedThis = static_cast(thisObject); TestObj* imp = static_cast(castedThis->impl()); imp->setLongLongAttr(static_cast(value.toInteger(exec))); } void setJSTestObjUnsignedLongLongAttr(ExecState* exec, JSObject* thisObject, JSValue value) { JSTestObj* castedThis = static_cast(thisObject); TestObj* imp = static_cast(castedThis->impl()); imp->setUnsignedLongLongAttr(static_cast(value.toInteger(exec))); } void setJSTestObjStringAttr(ExecState* exec, JSObject* thisObject, JSValue value) { JSTestObj* castedThis = static_cast(thisObject); TestObj* imp = static_cast(castedThis->impl()); imp->setStringAttr(ustringToString(value.toString(exec))); } void setJSTestObjTestObjAttr(ExecState* exec, JSObject* thisObject, JSValue value) { JSTestObj* castedThis = static_cast(thisObject); TestObj* imp = static_cast(castedThis->impl()); imp->setTestObjAttr(toTestObj(value)); } void setJSTestObjAttrWithException(ExecState* exec, JSObject* thisObject, JSValue value) { JSTestObj* castedThis = static_cast(thisObject); TestObj* imp = static_cast(castedThis->impl()); imp->setAttrWithException(value.toInt32(exec)); } void setJSTestObjAttrWithSetterException(ExecState* exec, JSObject* thisObject, JSValue value) { JSTestObj* castedThis = static_cast(thisObject); TestObj* imp = static_cast(castedThis->impl()); ExceptionCode ec = 0; imp->setAttrWithSetterException(value.toInt32(exec), ec); setDOMException(exec, ec); } void setJSTestObjAttrWithGetterException(ExecState* exec, JSObject* thisObject, JSValue value) { JSTestObj* castedThis = static_cast(thisObject); TestObj* imp = static_cast(castedThis->impl()); ExceptionCode ec = 0; imp->setAttrWithGetterException(value.toInt32(exec), ec); setDOMException(exec, ec); } void setJSTestObjCustomAttr(ExecState* exec, JSObject* thisObject, JSValue value) { static_cast(thisObject)->setCustomAttr(exec, value); } JSValue JSTestObj::getConstructor(ExecState* exec, JSGlobalObject* globalObject) { return getDOMConstructor(exec, static_cast(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(asObject(thisValue)); TestObj* imp = static_cast(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(asObject(thisValue)); TestObj* imp = static_cast(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(asObject(thisValue)); TestObj* imp = static_cast(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(asObject(thisValue)); TestObj* imp = static_cast(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(asObject(thisValue)); TestObj* imp = static_cast(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(asObject(thisValue)); TestObj* imp = static_cast(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 jsTestObjPrototypeFunctionMethodThatRequiresAllArgs(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(asObject(thisValue)); TestObj* imp = static_cast(castedThis->impl()); if (args.size() < 2) return jsUndefined(); const String& strArg = ustringToString(args.at(0).toString(exec)); TestObj* objArg = toTestObj(args.at(1)); JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->methodThatRequiresAllArgs(strArg, objArg))); return result; } JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows(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(asObject(thisValue)); TestObj* imp = static_cast(castedThis->impl()); if (args.size() < 2) return throwError(exec, SyntaxError, "Not enough arguments"); ExceptionCode ec = 0; const String& strArg = ustringToString(args.at(0).toString(exec)); TestObj* objArg = toTestObj(args.at(1)); JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->methodThatRequiresAllArgsAndThrows(strArg, objArg, ec))); setDOMException(exec, ec); 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(asObject(thisValue)); TestObj* imp = static_cast(castedThis->impl()); RefPtr 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(asObject(thisValue)); TestObj* imp = static_cast(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(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(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(asObject(thisValue)); TestObj* imp = static_cast(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(asObject(thisValue)); TestObj* imp = static_cast(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(asObject(thisValue)); TestObj* imp = static_cast(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(asObject(thisValue)); TestObj* imp = static_cast(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(asObject(thisValue)); TestObj* imp = static_cast(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(asObject(thisValue)); TestObj* imp = static_cast(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(asObject(thisValue)); TestObj* imp = static_cast(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(asObject(thisValue)); TestObj* imp = static_cast(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(asObject(thisValue)); TestObj* imp = static_cast(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(asObject(thisValue)); TestObj* imp = static_cast(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(asObject(thisValue)); TestObj* imp = static_cast(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(asObject(thisValue)); TestObj* imp = static_cast(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(asObject(thisValue)); TestObj* imp = static_cast(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(asObject(thisValue)); TestObj* imp = static_cast(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(asObject(thisValue)); TestObj* imp = static_cast(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); int opt2 = args.at(2).toInt32(exec); imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2); return jsUndefined(); } JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod1(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(asObject(thisValue)); TestObj* imp = static_cast(castedThis->impl()); TestObj* objArg = toTestObj(args.at(0)); const String& strArg = ustringToString(args.at(1).toString(exec)); imp->overloadedMethod(objArg, strArg); return jsUndefined(); } JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod2(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(asObject(thisValue)); TestObj* imp = static_cast(castedThis->impl()); TestObj* objArg = toTestObj(args.at(0)); int argsCount = args.size(); if (argsCount < 2) { imp->overloadedMethod(objArg); return jsUndefined(); } int intArg = args.at(1).toInt32(exec); imp->overloadedMethod(objArg, intArg); return jsUndefined(); } JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod3(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(asObject(thisValue)); TestObj* imp = static_cast(castedThis->impl()); const String& strArg = ustringToString(args.at(0).toString(exec)); imp->overloadedMethod(strArg); return jsUndefined(); } JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod4(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(asObject(thisValue)); TestObj* imp = static_cast(castedThis->impl()); int intArg = args.at(0).toInt32(exec); imp->overloadedMethod(intArg); return jsUndefined(); } JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) { if ((args.size() == 2 && (args.at(0).isNull() || asObject(args.at(0))->inherits(JSTestObj::s_info) && (args.at(1).isNull() || args.at(1).isUndefined() || args.at(1).isString() || args.at(1).isObject()))) return jsTestObjPrototypeFunctionOverloadedMethod1(exec, thisValue, args); if ((args.size() == 1 && (args.at(0).isNull() || asObject(args.at(0))->inherits(JSTestObj::s_info)) || (args.size() == 2 && (args.at(0).isNull() || asObject(args.at(0))->inherits(JSTestObj::s_info))) return jsTestObjPrototypeFunctionOverloadedMethod2(exec, thisValue, args); if ((args.size() == 1 && (args.at(0).isNull() || args.at(0).isUndefined() || args.at(0).isString() || args.at(0).isObject()))) return jsTestObjPrototypeFunctionOverloadedMethod3(exec, thisValue, args); if (args.size() == 1) return jsTestObjPrototypeFunctionOverloadedMethod4(exec, thisValue, args); return throwError(exec, TypeError); } JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestObj* object) { return getDOMObjectWrapper(exec, globalObject, object); } TestObj* toTestObj(JSC::JSValue value) { return value.inherits(&JSTestObj::s_info) ? static_cast(asObject(value))->impl() : 0; } }