diff options
Diffstat (limited to 'WebCore/bridge')
-rw-r--r-- | WebCore/bridge/NP_jsobject.cpp | 6 | ||||
-rw-r--r-- | WebCore/bridge/c/c_instance.cpp | 10 | ||||
-rw-r--r-- | WebCore/bridge/jni/jni_jsobject.mm | 2 | ||||
-rw-r--r-- | WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp | 4 | ||||
-rw-r--r-- | WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp | 4 | ||||
-rw-r--r-- | WebCore/bridge/objc/objc_instance.mm | 4 | ||||
-rw-r--r-- | WebCore/bridge/objc/objc_runtime.mm | 22 | ||||
-rw-r--r-- | WebCore/bridge/objc/objc_utility.h | 2 | ||||
-rw-r--r-- | WebCore/bridge/objc/objc_utility.mm | 4 | ||||
-rw-r--r-- | WebCore/bridge/qt/qt_instance.cpp | 4 | ||||
-rw-r--r-- | WebCore/bridge/qt/qt_pixmapruntime.cpp | 11 | ||||
-rw-r--r-- | WebCore/bridge/qt/qt_pixmapruntime.h | 3 | ||||
-rw-r--r-- | WebCore/bridge/qt/qt_runtime.cpp | 52 | ||||
-rw-r--r-- | WebCore/bridge/qt/qt_runtime.h | 4 | ||||
-rw-r--r-- | WebCore/bridge/runtime_array.cpp | 4 | ||||
-rw-r--r-- | WebCore/bridge/runtime_method.cpp | 10 | ||||
-rw-r--r-- | WebCore/bridge/runtime_object.cpp | 14 |
17 files changed, 85 insertions, 75 deletions
diff --git a/WebCore/bridge/NP_jsobject.cpp b/WebCore/bridge/NP_jsobject.cpp index d983f6a..d454c74 100644 --- a/WebCore/bridge/NP_jsobject.cpp +++ b/WebCore/bridge/NP_jsobject.cpp @@ -183,7 +183,7 @@ bool _NPN_InvokeDefault(NPP, NPObject* o, const NPVariant* args, uint32_t argCou // Call the function object. JSValue function = obj->imp; CallData callData; - CallType callType = function.getCallData(callData); + CallType callType = getCallData(function, callData); if (callType == CallTypeNone) return false; @@ -232,7 +232,7 @@ bool _NPN_Invoke(NPP npp, NPObject* o, NPIdentifier methodName, const NPVariant* JSLock lock(SilenceAssertionsOnly); JSValue function = obj->imp->get(exec, identifierFromNPIdentifier(exec, i->string())); CallData callData; - CallType callType = function.getCallData(callData); + CallType callType = getCallData(function, callData); if (callType == CallTypeNone) return false; @@ -507,7 +507,7 @@ bool _NPN_Construct(NPP, NPObject* o, const NPVariant* args, uint32_t argCount, // Call the constructor object. JSValue constructor = obj->imp; ConstructData constructData; - ConstructType constructType = constructor.getConstructData(constructData); + ConstructType constructType = getConstructData(constructor, constructData); if (constructType == ConstructTypeNone) return false; diff --git a/WebCore/bridge/c/c_instance.cpp b/WebCore/bridge/c/c_instance.cpp index cbcc7b8..2db009e 100644 --- a/WebCore/bridge/c/c_instance.cpp +++ b/WebCore/bridge/c/c_instance.cpp @@ -73,7 +73,7 @@ void CInstance::moveGlobalExceptionToExecState(ExecState* exec) { JSLock lock(SilenceAssertionsOnly); - throwError(exec, GeneralError, globalExceptionString()); + throwError(exec, createError(exec, globalExceptionString())); } globalExceptionString() = UString(); @@ -131,7 +131,7 @@ JSValue CInstance::getMethod(ExecState* exec, const Identifier& propertyName) JSValue CInstance::invokeMethod(ExecState* exec, RuntimeMethod* runtimeMethod) { if (!asObject(runtimeMethod)->inherits(&CRuntimeMethod::s_info)) - return throwError(exec, TypeError, "Attempt to invoke non-plug-in method on plug-in object."); + return throwError(exec, createTypeError(exec, "Attempt to invoke non-plug-in method on plug-in object.")); const MethodList& methodList = *runtimeMethod->methods(); @@ -165,7 +165,7 @@ JSValue CInstance::invokeMethod(ExecState* exec, RuntimeMethod* runtimeMethod) } if (!retval) - throwError(exec, GeneralError, "Error calling method on NPObject!"); + throwError(exec, createError(exec, "Error calling method on NPObject!")); for (i = 0; i < count; i++) _NPN_ReleaseVariantValue(&cArgs[i]); @@ -200,7 +200,7 @@ JSValue CInstance::invokeDefaultMethod(ExecState* exec) } if (!retval) - throwError(exec, GeneralError, "Error calling method on NPObject!"); + throwError(exec, createError(exec, "Error calling method on NPObject!")); for (i = 0; i < count; i++) _NPN_ReleaseVariantValue(&cArgs[i]); @@ -239,7 +239,7 @@ JSValue CInstance::invokeConstruct(ExecState* exec, const ArgList& args) } if (!retval) - throwError(exec, GeneralError, "Error calling method on NPObject!"); + throwError(exec, createError(exec, "Error calling method on NPObject!")); for (i = 0; i < count; i++) _NPN_ReleaseVariantValue(&cArgs[i]); diff --git a/WebCore/bridge/jni/jni_jsobject.mm b/WebCore/bridge/jni/jni_jsobject.mm index 3fb794b..7793070 100644 --- a/WebCore/bridge/jni/jni_jsobject.mm +++ b/WebCore/bridge/jni/jni_jsobject.mm @@ -289,7 +289,7 @@ jobject JavaJSObject::call(jstring methodName, jobjectArray args) const Identifier identifier(exec, JavaString(methodName)); JSValue function = _imp->get(exec, identifier); CallData callData; - CallType callType = function.getCallData(callData); + CallType callType = getCallData(function, callData); if (callType == CallTypeNone) return 0; diff --git a/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp b/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp index 24e2b91..d5dc1cb 100644 --- a/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp +++ b/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp @@ -88,7 +88,7 @@ jvalue JavaField::dispatchValueFromInstance(ExecState* exec, const JavaInstance* args[0].l = jinstance; dispatchJNICall(exec, rootObject->nativeHandle(), fieldJInstance, false, returnType, mid, args, result, 0, exceptionDescription); if (exceptionDescription) - throwError(exec, GeneralError, exceptionDescription.toString(exec)); + throwError(exec, createError(exec, exceptionDescription.toString(exec))); } } } @@ -175,7 +175,7 @@ void JavaField::dispatchSetValueToInstance(ExecState* exec, const JavaInstance* args[1] = javaValue; dispatchJNICall(exec, rootObject->nativeHandle(), fieldJInstance, false, void_type, mid, args, result, 0, exceptionDescription); if (exceptionDescription) - throwError(exec, GeneralError, exceptionDescription.toString(exec)); + throwError(exec, createError(exec, exceptionDescription.toString(exec))); } } } diff --git a/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp b/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp index a87f062..84b06de 100644 --- a/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp +++ b/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp @@ -139,7 +139,7 @@ JSValue JavaInstance::getMethod(ExecState* exec, const Identifier& propertyName) JSValue JavaInstance::invokeMethod(ExecState* exec, RuntimeMethod* runtimeMethod) { if (!asObject(runtimeMethod)->inherits(&JavaRuntimeMethod::s_info)) - return throwError(exec, TypeError, "Attempt to invoke non-Java method on Java object."); + return throwError(exec, createTypeError(exec, "Attempt to invoke non-Java method on Java object.")); const MethodList& methodList = *runtimeMethod->methods(); @@ -193,7 +193,7 @@ JSValue JavaInstance::invokeMethod(ExecState* exec, RuntimeMethod* runtimeMethod const char *callingURL = 0; // FIXME, need to propagate calling URL to Java handled = dispatchJNICall(exec, rootObject->nativeHandle(), obj, jMethod->isStatic(), jMethod->JNIReturnType(), jMethod->methodID(obj), jArgs.data(), result, callingURL, exceptionDescription); if (exceptionDescription) { - throwError(exec, GeneralError, exceptionDescription.toString(exec)); + throwError(exec, createError(exec, exceptionDescription.toString(exec))); return jsUndefined(); } } diff --git a/WebCore/bridge/objc/objc_instance.mm b/WebCore/bridge/objc/objc_instance.mm index 3f9876c..2b518b1 100644 --- a/WebCore/bridge/objc/objc_instance.mm +++ b/WebCore/bridge/objc/objc_instance.mm @@ -86,7 +86,7 @@ void ObjcInstance::moveGlobalExceptionToExecState(ExecState* exec) if (!s_exceptionEnvironment || s_exceptionEnvironment == exec->dynamicGlobalObject()) { JSLock lock(SilenceAssertionsOnly); - throwError(exec, GeneralError, s_exception); + throwError(exec, s_exception); } HardRelease(s_exception); @@ -197,7 +197,7 @@ JSValue ObjcInstance::getMethod(ExecState* exec, const Identifier& propertyName) JSValue ObjcInstance::invokeMethod(ExecState* exec, RuntimeMethod* runtimeMethod) { if (!asObject(runtimeMethod)->inherits(&ObjCRuntimeMethod::s_info)) - return throwError(exec, TypeError, "Attempt to invoke non-plug-in method on plug-in object."); + return throwError(exec, createTypeError(exec, "Attempt to invoke non-plug-in method on plug-in object.")); const MethodList& methodList = *runtimeMethod->methods(); diff --git a/WebCore/bridge/objc/objc_runtime.mm b/WebCore/bridge/objc/objc_runtime.mm index b03b04a..e86cb1e 100644 --- a/WebCore/bridge/objc/objc_runtime.mm +++ b/WebCore/bridge/objc/objc_runtime.mm @@ -104,7 +104,7 @@ JSValue ObjcField::valueFromInstance(ExecState* exec, const Instance* instance) result = convertObjcValueToValue(exec, &objcValue, ObjcObjectType, instance->rootObject()); } @catch(NSException* localException) { JSLock::lock(SilenceAssertionsOnly); - throwError(exec, GeneralError, [localException reason]); + throwError(exec, [localException reason]); JSLock::unlock(SilenceAssertionsOnly); } @@ -132,7 +132,7 @@ void ObjcField::setValueToInstance(ExecState* exec, const Instance* instance, JS [targetObject setValue:value forKey:(NSString *)_name.get()]; } @catch(NSException* localException) { JSLock::lock(SilenceAssertionsOnly); - throwError(exec, GeneralError, [localException reason]); + throwError(exec, [localException reason]); JSLock::unlock(SilenceAssertionsOnly); } } @@ -148,12 +148,12 @@ ObjcArray::ObjcArray(ObjectStructPtr a, PassRefPtr<RootObject> rootObject) void ObjcArray::setValueAt(ExecState* exec, unsigned int index, JSValue aValue) const { if (![_array.get() respondsToSelector:@selector(insertObject:atIndex:)]) { - throwError(exec, TypeError, "Array is not mutable."); + throwError(exec, createTypeError(exec, "Array is not mutable.")); return; } if (index > [_array.get() count]) { - throwError(exec, RangeError, "Index exceeds array size."); + throwError(exec, createRangeError(exec, "Index exceeds array size.")); return; } @@ -164,20 +164,20 @@ void ObjcArray::setValueAt(ExecState* exec, unsigned int index, JSValue aValue) @try { [_array.get() insertObject:oValue.objectValue atIndex:index]; } @catch(NSException* localException) { - throwError(exec, GeneralError, "Objective-C exception."); + throwError(exec, createError(exec, "Objective-C exception.")); } } JSValue ObjcArray::valueAt(ExecState* exec, unsigned int index) const { if (index > [_array.get() count]) - return throwError(exec, RangeError, "Index exceeds array size."); + return throwError(exec, createRangeError(exec, "Index exceeds array size.")); @try { id obj = [_array.get() objectAtIndex:index]; if (obj) return convertObjcValueToValue (exec, &obj, ObjcObjectType, m_rootObject.get()); } @catch(NSException* localException) { - return throwError(exec, GeneralError, "Objective-C exception."); + return throwError(exec, createError(exec, "Objective-C exception.")); } return jsUndefined(); } @@ -215,11 +215,11 @@ void ObjcFallbackObjectImp::put(ExecState*, const Identifier&, JSValue, PutPrope { } -static JSValue JSC_HOST_CALL callObjCFallbackObject(ExecState* exec) +static EncodedJSValue JSC_HOST_CALL callObjCFallbackObject(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&ObjCRuntimeObject::s_info)) - return throwError(exec, TypeError); + return throwVMTypeError(exec); JSValue result = jsUndefined(); @@ -227,7 +227,7 @@ static JSValue JSC_HOST_CALL callObjCFallbackObject(ExecState* exec) ObjcInstance* objcInstance = runtimeObject->getInternalObjCInstance(); if (!objcInstance) - return RuntimeObject::throwInvalidAccessError(exec); + return JSValue::encode(RuntimeObject::throwInvalidAccessError(exec)); objcInstance->begin(); @@ -244,7 +244,7 @@ static JSValue JSC_HOST_CALL callObjCFallbackObject(ExecState* exec) objcInstance->end(); - return result; + return JSValue::encode(result); } CallType ObjcFallbackObjectImp::getCallData(CallData& callData) diff --git a/WebCore/bridge/objc/objc_utility.h b/WebCore/bridge/objc/objc_utility.h index c34be2a..4810752 100644 --- a/WebCore/bridge/objc/objc_utility.h +++ b/WebCore/bridge/objc/objc_utility.h @@ -80,7 +80,7 @@ ObjcValueType objcValueTypeForType(const char *type); bool convertJSMethodNameToObjc(const char *JSName, char *buffer, size_t bufferSize); -JSObject *throwError(ExecState *, ErrorType, NSString *message); +JSObject *throwError(ExecState *, NSString *message); } // namespace Bindings } // namespace JSC diff --git a/WebCore/bridge/objc/objc_utility.mm b/WebCore/bridge/objc/objc_utility.mm index bf59627..8eb7ba5 100644 --- a/WebCore/bridge/objc/objc_utility.mm +++ b/WebCore/bridge/objc/objc_utility.mm @@ -358,13 +358,13 @@ ObjcValueType objcValueTypeForType(const char *type) return objcValueType; } -JSObject *throwError(ExecState *exec, ErrorType type, NSString *message) +JSObject *throwError(ExecState *exec, NSString *message) { ASSERT(message); size_t length = [message length]; unichar *buffer = new unichar[length]; [message getCharacters:buffer]; - JSObject *error = throwError(exec, type, UString(buffer, length)); + JSObject *error = JSC::throwError(exec, JSC::createError(exec, UString(buffer, length))); delete [] buffer; return error; } diff --git a/WebCore/bridge/qt/qt_instance.cpp b/WebCore/bridge/qt/qt_instance.cpp index 5ffb41f..1229919 100644 --- a/WebCore/bridge/qt/qt_instance.cpp +++ b/WebCore/bridge/qt/qt_instance.cpp @@ -360,7 +360,7 @@ JSValue QtField::valueFromInstance(ExecState* exec, const Instance* inst) const return convertQVariantToValue(exec, inst->rootObject(), val); } QString msg = QString(QLatin1String("cannot access member `%1' of deleted QObject")).arg(QLatin1String(name())); - return throwError(exec, GeneralError, msg.toLatin1().constData()); + return throwError(exec, createError(exec, msg.toLatin1().constData())); } void QtField::setValueToInstance(ExecState* exec, const Instance* inst, JSValue aValue) const @@ -387,7 +387,7 @@ void QtField::setValueToInstance(ExecState* exec, const Instance* inst, JSValue #endif } else { QString msg = QString(QLatin1String("cannot access member `%1' of deleted QObject")).arg(QLatin1String(name())); - throwError(exec, GeneralError, msg.toLatin1().constData()); + throwError(exec, createError(exec, msg.toLatin1().constData())); } } diff --git a/WebCore/bridge/qt/qt_pixmapruntime.cpp b/WebCore/bridge/qt/qt_pixmapruntime.cpp index 7b6debe..ad26019 100644 --- a/WebCore/bridge/qt/qt_pixmapruntime.cpp +++ b/WebCore/bridge/qt/qt_pixmapruntime.cpp @@ -346,10 +346,17 @@ returnEmptyVariant: return QVariant::fromValue<QImage>(QImage()); return QVariant(); } -JSObject* QtPixmapInstance::createRuntimeObject(ExecState* exec, PassRefPtr<RootObject> root, const QVariant& data) + +RuntimeObject* QtPixmapInstance::newRuntimeObject(ExecState* exec) +{ + return new(exec) QtPixmapRuntimeObject(exec, exec->lexicalGlobalObject(), this); +} + +JSObject* QtPixmapInstance::createPixmapRuntimeObject(ExecState* exec, PassRefPtr<RootObject> root, const QVariant& data) { JSLock lock(SilenceAssertionsOnly); - return new(exec) QtPixmapRuntimeObject(exec, exec->lexicalGlobalObject(), new QtPixmapInstance(root, data)); + QtPixmapInstance* instance = new QtPixmapInstance(root, data); + return instance->createRuntimeObject(exec); } bool QtPixmapInstance::canHandle(QMetaType::Type hint) diff --git a/WebCore/bridge/qt/qt_pixmapruntime.h b/WebCore/bridge/qt/qt_pixmapruntime.h index 06e74eb..e2ae5e9 100644 --- a/WebCore/bridge/qt/qt_pixmapruntime.h +++ b/WebCore/bridge/qt/qt_pixmapruntime.h @@ -42,7 +42,8 @@ public: int height() const; QPixmap toPixmap(); QImage toImage(); - static JSObject* createRuntimeObject(ExecState*, PassRefPtr<RootObject>, const QVariant&); + RuntimeObject* newRuntimeObject(ExecState* exec); + static JSObject* createPixmapRuntimeObject(ExecState*, PassRefPtr<RootObject>, const QVariant&); static QVariant variantFromObject(JSObject*, QMetaType::Type hint); static bool canHandle(QMetaType::Type hint); }; diff --git a/WebCore/bridge/qt/qt_runtime.cpp b/WebCore/bridge/qt/qt_runtime.cpp index 47f7d4a1..6cea96e 100644 --- a/WebCore/bridge/qt/qt_runtime.cpp +++ b/WebCore/bridge/qt/qt_runtime.cpp @@ -877,7 +877,7 @@ JSValue convertQVariantToValue(ExecState* exec, PassRefPtr<RootObject> root, con } if (QtPixmapInstance::canHandle(static_cast<QMetaType::Type>(variant.type()))) - return QtPixmapInstance::createRuntimeObject(exec, root, variant); + return QtPixmapInstance::createPixmapRuntimeObject(exec, root, variant); if (type == qMetaTypeId<QWebElement>()) { if (!root->globalObject()->inherits(&JSDOMWindow::s_info)) @@ -1280,7 +1280,7 @@ static int findMethodIndex(ExecState* exec, QMetaMethod mtd = meta->method(conversionFailed.at(i)); message += QString::fromLatin1(" %0").arg(QString::fromLatin1(mtd.signature())); } - *pError = throwError(exec, TypeError, message.toLatin1().constData()); + *pError = throwError(exec, createTypeError(exec, message.toLatin1().constData())); } else if (!unresolved.isEmpty()) { QtMethodMatchData argsInstance = unresolved.first(); int unresolvedIndex = argsInstance.firstUnresolvedIndex(); @@ -1289,7 +1289,7 @@ static int findMethodIndex(ExecState* exec, QString message = QString::fromLatin1("cannot call %0(): unknown type `%1'") .arg(QString::fromLatin1(signature)) .arg(QLatin1String(unresolvedType.name())); - *pError = throwError(exec, TypeError, message.toLatin1().constData()); + *pError = throwError(exec, createTypeError(exec, message.toLatin1().constData())); } else { QString message = QString::fromLatin1("too few arguments in call to %0(); candidates are\n") .arg(QLatin1String(signature)); @@ -1299,7 +1299,7 @@ static int findMethodIndex(ExecState* exec, QMetaMethod mtd = meta->method(tooFewArgs.at(i)); message += QString::fromLatin1(" %0").arg(QString::fromLatin1(mtd.signature())); } - *pError = throwError(exec, SyntaxError, message.toLatin1().constData()); + *pError = throwError(exec, createSyntaxError(exec, message.toLatin1().constData())); } } @@ -1321,7 +1321,7 @@ static int findMethodIndex(ExecState* exec, message += QString::fromLatin1(" %0").arg(QString::fromLatin1(mtd.signature())); } } - *pError = throwError(exec, TypeError, message.toLatin1().constData()); + *pError = throwError(exec, createTypeError(exec, message.toLatin1().constData())); } else { chosenIndex = bestMatch.index; args = bestMatch.args; @@ -1377,13 +1377,13 @@ void QtRuntimeMetaMethod::markChildren(MarkStack& markStack) markStack.append(d->m_disconnect); } -JSValue QtRuntimeMetaMethod::call(ExecState* exec) +EncodedJSValue QtRuntimeMetaMethod::call(ExecState* exec) { QtRuntimeMetaMethodData* d = static_cast<QtRuntimeMetaMethod *>(exec->callee())->d_func(); // We're limited to 10 args if (exec->argumentCount() > 10) - return jsUndefined(); + return JSValue::encode(jsUndefined()); // We have to pick a method that matches.. JSLock lock(SilenceAssertionsOnly); @@ -1397,20 +1397,20 @@ JSValue QtRuntimeMetaMethod::call(ExecState* exec) JSObject* errorObj = 0; if ((methodIndex = findMethodIndex(exec, obj->metaObject(), d->m_signature, d->m_allowPrivate, vargs, (void **)qargs, &errorObj)) != -1) { if (QMetaObject::metacall(obj, QMetaObject::InvokeMetaMethod, methodIndex, qargs) >= 0) - return jsUndefined(); + return JSValue::encode(jsUndefined()); if (vargs[0].isValid()) - return convertQVariantToValue(exec, d->m_instance->rootObject(), vargs[0]); + return JSValue::encode(convertQVariantToValue(exec, d->m_instance->rootObject(), vargs[0])); } if (errorObj) - return errorObj; + return JSValue::encode(errorObj); } else { - return throwError(exec, GeneralError, "cannot call function of deleted QObject"); + return throwVMError(exec, createError(exec, "cannot call function of deleted QObject")); } // void functions return undefined - return jsUndefined(); + return JSValue::encode(jsUndefined()); } CallType QtRuntimeMetaMethod::getCallData(CallData& callData) @@ -1512,7 +1512,7 @@ QtRuntimeConnectionMethod::QtRuntimeConnectionMethod(ExecState* exec, const Iden d->m_isConnect = isConnect; } -JSValue QtRuntimeConnectionMethod::call(ExecState* exec) +EncodedJSValue QtRuntimeConnectionMethod::call(ExecState* exec) { QtRuntimeConnectionMethodData* d = static_cast<QtRuntimeConnectionMethod *>(exec->callee())->d_func(); @@ -1539,9 +1539,9 @@ JSValue QtRuntimeConnectionMethod::call(ExecState* exec) CallData callData; if (funcObject->getCallData(callData) == CallTypeNone) { if (d->m_isConnect) - return throwError(exec, TypeError, "QtMetaMethod.connect: target is not a function"); + return throwVMError(exec, createTypeError(exec, "QtMetaMethod.connect: target is not a function")); else - return throwError(exec, TypeError, "QtMetaMethod.disconnect: target is not a function"); + return throwVMError(exec, createTypeError(exec, "QtMetaMethod.disconnect: target is not a function")); } } else if (exec->argumentCount() >= 2) { if (exec->argument(0).isObject()) { @@ -1567,22 +1567,22 @@ JSValue QtRuntimeConnectionMethod::call(ExecState* exec) funcObject = asFuncObj; } else { if (d->m_isConnect) - return throwError(exec, TypeError, "QtMetaMethod.connect: target is not a function"); + return throwVMError(exec, createTypeError(exec, "QtMetaMethod.connect: target is not a function")); else - return throwError(exec, TypeError, "QtMetaMethod.disconnect: target is not a function"); + return throwVMError(exec, createTypeError(exec, "QtMetaMethod.disconnect: target is not a function")); } } } else { if (d->m_isConnect) - return throwError(exec, TypeError, "QtMetaMethod.connect: thisObject is not an object"); + return throwVMError(exec, createTypeError(exec, "QtMetaMethod.connect: thisObject is not an object")); else - return throwError(exec, TypeError, "QtMetaMethod.disconnect: thisObject is not an object"); + return throwVMError(exec, createTypeError(exec, "QtMetaMethod.disconnect: thisObject is not an object")); } } else { if (d->m_isConnect) - return throwError(exec, GeneralError, "QtMetaMethod.connect: no arguments given"); + return throwVMError(exec, createError(exec, "QtMetaMethod.connect: no arguments given")); else - return throwError(exec, GeneralError, "QtMetaMethod.disconnect: no arguments given"); + return throwVMError(exec, createError(exec, "QtMetaMethod.disconnect: no arguments given")); } if (d->m_isConnect) { @@ -1599,7 +1599,7 @@ JSValue QtRuntimeConnectionMethod::call(ExecState* exec) QString msg = QString(QLatin1String("QtMetaMethod.connect: failed to connect to %1::%2()")) .arg(QLatin1String(sender->metaObject()->className())) .arg(QLatin1String(d->m_signature)); - return throwError(exec, GeneralError, msg.toLatin1().constData()); + return throwVMError(exec, createError(exec, msg.toLatin1().constData())); } else { // Store connection @@ -1625,7 +1625,7 @@ JSValue QtRuntimeConnectionMethod::call(ExecState* exec) QString msg = QString(QLatin1String("QtMetaMethod.disconnect: failed to disconnect from %1::%2()")) .arg(QLatin1String(sender->metaObject()->className())) .arg(QLatin1String(d->m_signature)); - return throwError(exec, GeneralError, msg.toLatin1().constData()); + return throwVMError(exec, createError(exec, msg.toLatin1().constData())); } } } else { @@ -1633,13 +1633,13 @@ JSValue QtRuntimeConnectionMethod::call(ExecState* exec) .arg(QLatin1String(d->m_isConnect ? "connect": "disconnect")) .arg(QLatin1String(sender->metaObject()->className())) .arg(QLatin1String(d->m_signature)); - return throwError(exec, TypeError, msg.toLatin1().constData()); + return throwVMError(exec, createTypeError(exec, msg.toLatin1().constData())); } } else { - return throwError(exec, GeneralError, "cannot call function of deleted QObject"); + return throwVMError(exec, createError(exec, "cannot call function of deleted QObject")); } - return jsUndefined(); + return JSValue::encode(jsUndefined()); } CallType QtRuntimeConnectionMethod::getCallData(CallData& callData) diff --git a/WebCore/bridge/qt/qt_runtime.h b/WebCore/bridge/qt/qt_runtime.h index cc13e59..68bf865 100644 --- a/WebCore/bridge/qt/qt_runtime.h +++ b/WebCore/bridge/qt/qt_runtime.h @@ -182,7 +182,7 @@ protected: private: virtual CallType getCallData(CallData&); - static JSValue JSC_HOST_CALL call(ExecState* exec); + static EncodedJSValue JSC_HOST_CALL call(ExecState* exec); static JSValue lengthGetter(ExecState*, JSValue, const Identifier&); static JSValue connectGetter(ExecState*, JSValue, const Identifier&); static JSValue disconnectGetter(ExecState*, JSValue, const Identifier&); @@ -203,7 +203,7 @@ protected: private: virtual CallType getCallData(CallData&); - static JSValue JSC_HOST_CALL call(ExecState* exec); + static EncodedJSValue JSC_HOST_CALL call(ExecState* exec); static JSValue lengthGetter(ExecState*, JSValue, const Identifier&); static QMultiMap<QObject *, QtConnectionObject *> connections; friend class QtConnectionObject; diff --git a/WebCore/bridge/runtime_array.cpp b/WebCore/bridge/runtime_array.cpp index 1f2bfe7..2cd7d66 100644 --- a/WebCore/bridge/runtime_array.cpp +++ b/WebCore/bridge/runtime_array.cpp @@ -129,7 +129,7 @@ bool RuntimeArray::getOwnPropertySlot(ExecState *exec, unsigned index, PropertyS void RuntimeArray::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) { if (propertyName == exec->propertyNames().length) { - throwError(exec, RangeError); + throwError(exec, createRangeError(exec, "Range error")); return; } @@ -146,7 +146,7 @@ void RuntimeArray::put(ExecState* exec, const Identifier& propertyName, JSValue void RuntimeArray::put(ExecState* exec, unsigned index, JSValue value) { if (index >= getLength()) { - throwError(exec, RangeError); + throwError(exec, createRangeError(exec, "Range error")); return; } diff --git a/WebCore/bridge/runtime_method.cpp b/WebCore/bridge/runtime_method.cpp index 391129e..15e029c 100644 --- a/WebCore/bridge/runtime_method.cpp +++ b/WebCore/bridge/runtime_method.cpp @@ -87,12 +87,12 @@ bool RuntimeMethod::getOwnPropertyDescriptor(ExecState* exec, const Identifier& return InternalFunction::getOwnPropertyDescriptor(exec, propertyName, descriptor); } -static JSValue JSC_HOST_CALL callRuntimeMethod(ExecState* exec) +static EncodedJSValue JSC_HOST_CALL callRuntimeMethod(ExecState* exec) { RuntimeMethod* method = static_cast<RuntimeMethod*>(exec->callee()); if (method->methods()->isEmpty()) - return jsUndefined(); + return JSValue::encode(jsUndefined()); RefPtr<Instance> instance; @@ -101,7 +101,7 @@ static JSValue JSC_HOST_CALL callRuntimeMethod(ExecState* exec) RuntimeObject* runtimeObject = static_cast<RuntimeObject*>(asObject(thisValue)); instance = runtimeObject->getInternalInstance(); if (!instance) - return RuntimeObject::throwInvalidAccessError(exec); + return JSValue::encode(RuntimeObject::throwInvalidAccessError(exec)); } else { // Calling a runtime object of a plugin element? if (thisValue.inherits(&JSHTMLElement::s_info)) { @@ -109,14 +109,14 @@ static JSValue JSC_HOST_CALL callRuntimeMethod(ExecState* exec) instance = pluginInstance(element); } if (!instance) - return throwError(exec, TypeError); + return throwVMTypeError(exec); } ASSERT(instance); instance->begin(); JSValue result = instance->invokeMethod(exec, method); instance->end(); - return result; + return JSValue::encode(result); } CallType RuntimeMethod::getCallData(CallData& callData) diff --git a/WebCore/bridge/runtime_object.cpp b/WebCore/bridge/runtime_object.cpp index 107b780..9c5d7b6 100644 --- a/WebCore/bridge/runtime_object.cpp +++ b/WebCore/bridge/runtime_object.cpp @@ -253,14 +253,14 @@ JSValue RuntimeObject::defaultValue(ExecState* exec, PreferredPrimitiveType hint return result; } -static JSValue JSC_HOST_CALL callRuntimeObject(ExecState* exec) +static EncodedJSValue JSC_HOST_CALL callRuntimeObject(ExecState* exec) { ASSERT(exec->callee()->inherits(&RuntimeObject::s_info)); RefPtr<Instance> instance(static_cast<RuntimeObject*>(exec->callee())->getInternalInstance()); instance->begin(); JSValue result = instance->invokeDefaultMethod(exec); instance->end(); - return result; + return JSValue::encode(result); } CallType RuntimeObject::getCallData(CallData& callData) @@ -276,16 +276,18 @@ CallType RuntimeObject::getCallData(CallData& callData) return CallTypeHost; } -static JSObject* callRuntimeConstructor(ExecState* exec, JSObject* constructor, const ArgList& args) +static EncodedJSValue JSC_HOST_CALL callRuntimeConstructor(ExecState* exec) { + JSObject* constructor = exec->callee(); ASSERT(constructor->inherits(&RuntimeObject::s_info)); - RefPtr<Instance> instance(static_cast<RuntimeObject*>(constructor)->getInternalInstance()); + RefPtr<Instance> instance(static_cast<RuntimeObject*>(exec->callee())->getInternalInstance()); instance->begin(); + ArgList args(exec); JSValue result = instance->invokeConstruct(exec, args); instance->end(); ASSERT(result); - return result.isObject() ? static_cast<JSObject*>(result.asCell()) : constructor; + return JSValue::encode(result.isObject() ? static_cast<JSObject*>(result.asCell()) : constructor); } ConstructType RuntimeObject::getConstructData(ConstructData& constructData) @@ -317,7 +319,7 @@ void RuntimeObject::getOwnPropertyNames(ExecState* exec, PropertyNameArray& prop JSObject* RuntimeObject::throwInvalidAccessError(ExecState* exec) { - return throwError(exec, ReferenceError, "Trying to access object from destroyed plug-in."); + return throwError(exec, createReferenceError(exec, "Trying to access object from destroyed plug-in.")); } } |