diff options
Diffstat (limited to 'WebCore/bindings/scripts/test/JS/JSTestObj.cpp')
-rw-r--r-- | WebCore/bindings/scripts/test/JS/JSTestObj.cpp | 303 |
1 files changed, 178 insertions, 125 deletions
diff --git a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp index 1e563c6..09b69cd 100644 --- a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp +++ b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp @@ -46,7 +46,7 @@ ASSERT_CLASS_FITS_IN_CELL(JSTestObj); #define THUNK_GENERATOR(generator) #endif -static const HashTableValue JSTestObjTableValues[15] = +static const HashTableValue JSTestObjTableValues[18] = { { "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) }, @@ -61,12 +61,15 @@ static const HashTableValue JSTestObjTableValues[15] = { "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) }, + { "description", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjDescription), (intptr_t)0 THUNK_GENERATOR(0) }, + { "id", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjId), (intptr_t)setJSTestObjId THUNK_GENERATOR(0) }, + { "hash", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjHash), (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 = { 34, 31, JSTestObjTableValues, 0 }; +static JSC_CONST_HASHTABLE HashTable JSTestObjTable = { 65, 63, JSTestObjTableValues, 0 }; /* Hash table for constructor */ #if ENABLE(JIT) #define THUNK_GENERATOR(generator) , generator @@ -121,7 +124,7 @@ bool JSTestObjConstructor::getOwnPropertyDescriptor(ExecState* exec, const Ident #define THUNK_GENERATOR(generator) #endif -static const HashTableValue JSTestObjPrototypeTableValues[29] = +static const HashTableValue JSTestObjPrototypeTableValues[30] = { { "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) }, @@ -147,6 +150,7 @@ static const HashTableValue JSTestObjPrototypeTableValues[29] = { "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) }, + { "withScriptExecutionContext", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionWithScriptExecutionContext), (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) }, @@ -316,6 +320,33 @@ JSValue jsTestObjScriptStringAttr(ExecState* exec, JSValue slotBase, const Ident return result; } +JSValue jsTestObjDescription(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->description()); + return result; +} + +JSValue jsTestObjId(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->id()); + return result; +} + +JSValue jsTestObjHash(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->hash()); + return result; +} + JSValue jsTestObjConstructor(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* domObject = static_cast<JSTestObj*>(asObject(slotBase)); @@ -391,28 +422,35 @@ void setJSTestObjCustomAttr(ExecState* exec, JSObject* thisObject, JSValue value static_cast<JSTestObj*>(thisObject)->setCustomAttr(exec, value); } +void setJSTestObjId(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + imp->setId(value.toInt32(exec)); +} + JSValue JSTestObj::getConstructor(ExecState* exec, JSGlobalObject* globalObject) { return getDOMConstructor<JSTestObjConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethod(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethod(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); imp->voidMethod(); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); int intArg = exec->argument(0).toInt32(exec); @@ -420,27 +458,27 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(ExecState* ex TestObj* objArg = toTestObj(exec->argument(2)); imp->voidMethodWithArgs(intArg, strArg, objArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethod(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethod(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); JSC::JSValue result = jsNumber(exec, imp->intMethod()); - return result; + return JSValue::encode(result); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); int intArg = exec->argument(0).toInt32(exec); @@ -449,27 +487,27 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(ExecState* exe JSC::JSValue result = jsNumber(exec, imp->intMethodWithArgs(intArg, strArg, objArg)); - return result; + return JSValue::encode(result); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethod(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethod(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); 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; + return JSValue::encode(result); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); int intArg = exec->argument(0).toInt32(exec); @@ -478,35 +516,35 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(ExecState* exe JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->objMethodWithArgs(intArg, strArg, objArg))); - return result; + return JSValue::encode(result); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgs(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgs(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); if (exec->argumentCount() < 2) - return jsUndefined(); + return JSValue::encode(jsUndefined()); const String& strArg = ustringToString(exec->argument(0).toString(exec)); TestObj* objArg = toTestObj(exec->argument(1)); JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->methodThatRequiresAllArgs(strArg, objArg))); - return result; + return JSValue::encode(result); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); if (exec->argumentCount() < 2) - return throwError(exec, SyntaxError, "Not enough arguments"); + return throwVMError(exec, createSyntaxError(exec, "Not enough arguments")); ExceptionCode ec = 0; const String& strArg = ustringToString(exec->argument(0).toString(exec)); TestObj* objArg = toTestObj(exec->argument(1)); @@ -514,59 +552,59 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThro JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->methodThatRequiresAllArgsAndThrows(strArg, objArg, ec))); setDOMException(exec, ec); - return result; + return JSValue::encode(result); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSerializedValue(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSerializedValue(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); RefPtr<SerializedScriptValue> serializedArg = SerializedScriptValue::create(exec, exec->argument(0)); imp->serializedValue(serializedArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithException(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithException(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); 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(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethod(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethod(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); - return castedThis->customMethod(exec); + return JSValue::encode(castedThis->customMethod(exec)); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethodWithArgs(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomMethodWithArgs(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); - return castedThis->customMethodWithArgs(exec); + return JSValue::encode(castedThis->customMethodWithArgs(exec)); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); ExceptionCode ec = 0; @@ -575,178 +613,178 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(ExecState imp->customArgsAndException(intArg, &callStack, ec); setDOMException(exec, ec); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAddEventListener(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAddEventListener(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); JSValue listener = exec->argument(1); if (!listener.isObject()) - return jsUndefined(); + return JSValue::encode(jsUndefined()); imp->addEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)), exec->argument(2).toBoolean(exec)); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionRemoveEventListener(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionRemoveEventListener(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); JSValue listener = exec->argument(1); if (!listener.isObject()) - return jsUndefined(); + return JSValue::encode(jsUndefined()); imp->removeEventListener(ustringToAtomicString(exec->argument(0).toString(exec)), JSEventListener::create(asObject(listener), castedThis, false, currentWorld(exec)).get(), exec->argument(2).toBoolean(exec)); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrame(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrame(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); Frame* dynamicFrame = toDynamicFrame(exec); if (!dynamicFrame) - return jsUndefined(); + return JSValue::encode(jsUndefined()); imp->withDynamicFrame(dynamicFrame); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndArg(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndArg(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); Frame* dynamicFrame = toDynamicFrame(exec); if (!dynamicFrame) - return jsUndefined(); - int intArg = exec->argument(1).toInt32(exec); + return JSValue::encode(jsUndefined()); + int intArg = exec->argument(0).toInt32(exec); imp->withDynamicFrameAndArg(dynamicFrame, intArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); Frame* dynamicFrame = toDynamicFrame(exec); if (!dynamicFrame) - return jsUndefined(); - int intArg = exec->argument(1).toInt32(exec); + return JSValue::encode(jsUndefined()); + int intArg = exec->argument(0).toInt32(exec); int argsCount = exec->argumentCount(); - if (argsCount < 3) { + if (argsCount < 2) { imp->withDynamicFrameAndOptionalArg(dynamicFrame, intArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } - int optionalArg = exec->argument(2).toInt32(exec); + int optionalArg = exec->argument(1).toInt32(exec); imp->withDynamicFrameAndOptionalArg(dynamicFrame, intArg, optionalArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); Frame* dynamicFrame = toDynamicFrame(exec); if (!dynamicFrame) - return jsUndefined(); - int intArg = exec->argument(1).toInt32(exec); + return JSValue::encode(jsUndefined()); + int intArg = exec->argument(0).toInt32(exec); imp->withDynamicFrameAndUserGesture(dynamicFrame, intArg, processingUserGesture(exec)); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); Frame* dynamicFrame = toDynamicFrame(exec); if (!dynamicFrame) - return jsUndefined(); - int intArg = exec->argument(1).toInt32(exec); + return JSValue::encode(jsUndefined()); + int intArg = exec->argument(0).toInt32(exec); int argsCount = exec->argumentCount(); - if (argsCount < 3) { + if (argsCount < 2) { imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } - int optionalArg = exec->argument(2).toInt32(exec); + int optionalArg = exec->argument(1).toInt32(exec); imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg, optionalArg, processingUserGesture(exec)); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoid(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoid(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); imp->withScriptStateVoid(exec); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObj(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObj(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); 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; + return JSValue::encode(jsUndefined()); + return JSValue::encode(result); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoidException(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateVoidException(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); 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(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObjException(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObjException(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); ExceptionCode ec = 0; @@ -755,35 +793,50 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptStateObjException(Exec JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->withScriptStateObjException(exec, ec))); setDOMException(exec, ec); if (exec->hadException()) - return jsUndefined(); - return result; + return JSValue::encode(jsUndefined()); + return JSValue::encode(result); +} + +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptExecutionContext(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwVMTypeError(exec); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + ScriptExecutionContext* scriptContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext(); + if (!scriptContext) + return JSValue::encode(jsUndefined()); + + imp->withScriptExecutionContext(scriptContext); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); int argsCount = exec->argumentCount(); if (argsCount < 1) { imp->methodWithOptionalArg(); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } int opt = exec->argument(0).toInt32(exec); imp->methodWithOptionalArg(opt); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); int nonOpt = exec->argument(0).toInt32(exec); @@ -791,20 +844,20 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptio int argsCount = exec->argumentCount(); if (argsCount < 2) { imp->methodWithNonOptionalArgAndOptionalArg(nonOpt); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } int opt = exec->argument(1).toInt32(exec); imp->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); int nonOpt = exec->argument(0).toInt32(exec); @@ -812,35 +865,35 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOp int argsCount = exec->argumentCount(); if (argsCount < 2) { imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } int opt1 = exec->argument(1).toInt32(exec); int opt2 = exec->argument(2).toInt32(exec); imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod1(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod1(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); TestObj* objArg = toTestObj(exec->argument(0)); const String& strArg = ustringToString(exec->argument(1).toString(exec)); imp->overloadedMethod(objArg, strArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod2(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod2(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); TestObj* objArg = toTestObj(exec->argument(0)); @@ -848,52 +901,52 @@ JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod2(ExecState* exe int argsCount = exec->argumentCount(); if (argsCount < 2) { imp->overloadedMethod(objArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } int intArg = exec->argument(1).toInt32(exec); imp->overloadedMethod(objArg, intArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod3(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod3(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); const String& strArg = ustringToString(exec->argument(0).toString(exec)); imp->overloadedMethod(strArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod4(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod4(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); TestObj* imp = static_cast<TestObj*>(castedThis->impl()); int intArg = exec->argument(0).toInt32(exec); imp->overloadedMethod(intArg); - return jsUndefined(); + return JSValue::encode(jsUndefined()); } -JSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(ExecState* exec) +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(ExecState* exec) { - if ((exec->argumentCount() == 2 && (exec->argument(0).isNull() || asObject(exec->argument(0))->inherits(JSTestObj::s_info) && (exec->argument(1).isNull() || exec->argument(1).isUndefined() || exec->argument(1).isString() || exec->argument(1).isObject()))) + if ((exec->argumentCount() == 2 && (exec->argument(0).isNull() || asObject(exec->argument(0))->inherits(&JSTestObj::s_info)) && (exec->argument(1).isNull() || exec->argument(1).isUndefined() || exec->argument(1).isString() || exec->argument(1).isObject()))) return jsTestObjPrototypeFunctionOverloadedMethod1(exec); - if ((exec->argumentCount() == 1 && (exec->argument(0).isNull() || asObject(exec->argument(0))->inherits(JSTestObj::s_info)) || (exec->argumentCount() == 2 && (exec->argument(0).isNull() || asObject(exec->argument(0))->inherits(JSTestObj::s_info))) + if ((exec->argumentCount() == 1 && (exec->argument(0).isNull() || asObject(exec->argument(0))->inherits(&JSTestObj::s_info))) || (exec->argumentCount() == 2 && (exec->argument(0).isNull() || asObject(exec->argument(0))->inherits(&JSTestObj::s_info)))) return jsTestObjPrototypeFunctionOverloadedMethod2(exec); if ((exec->argumentCount() == 1 && (exec->argument(0).isNull() || exec->argument(0).isUndefined() || exec->argument(0).isString() || exec->argument(0).isObject()))) return jsTestObjPrototypeFunctionOverloadedMethod3(exec); if (exec->argumentCount() == 1) return jsTestObjPrototypeFunctionOverloadedMethod4(exec); - return throwError(exec, TypeError); + return throwTypeError(exec); } JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestObj* object) |