summaryrefslogtreecommitdiffstats
path: root/WebCore/bridge/qt
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-06-15 19:36:43 +0100
committerBen Murdoch <benm@google.com>2010-06-16 14:52:28 +0100
commit545e470e52f0ac6a3a072bf559c796b42c6066b6 (patch)
treec0c14763654d84d37577dde512c3d3b4699a9e86 /WebCore/bridge/qt
parent719298a66237d38ea5c05f1547123ad8aacbc237 (diff)
downloadexternal_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.zip
external_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.tar.gz
external_webkit-545e470e52f0ac6a3a072bf559c796b42c6066b6.tar.bz2
Merge webkit.org at r61121: Initial merge by git.
Change-Id: Icd6db395c62285be384d137164d95d7466c98760
Diffstat (limited to 'WebCore/bridge/qt')
-rw-r--r--WebCore/bridge/qt/qt_instance.cpp4
-rw-r--r--WebCore/bridge/qt/qt_pixmapruntime.cpp11
-rw-r--r--WebCore/bridge/qt/qt_pixmapruntime.h3
-rw-r--r--WebCore/bridge/qt/qt_runtime.cpp52
-rw-r--r--WebCore/bridge/qt/qt_runtime.h4
5 files changed, 41 insertions, 33 deletions
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;