Commit f912277e authored by barraclough@apple.com's avatar barraclough@apple.com
Browse files

* bridge/qt/qt_runtime.cpp:

(JSC::Bindings::findMethodIndex):
(JSC::Bindings::QtRuntimeMetaMethod::call):
(JSC::Bindings::QtRuntimeConnectionMethod::call):

Reviewed by NOBODY (Qt build fix).



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@60764 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ca9cf18e
2010-06-06 Gavin Barraclough <barraclough@apple.com>
Reviewed by NOBODY (Qt build fix).
* bridge/qt/qt_runtime.cpp:
(JSC::Bindings::findMethodIndex):
(JSC::Bindings::QtRuntimeMetaMethod::call):
(JSC::Bindings::QtRuntimeConnectionMethod::call):
2010-06-06 Gavin Barraclough <barraclough@apple.com> 2010-06-06 Gavin Barraclough <barraclough@apple.com>
Reviewed by Sam Weinig. Reviewed by Sam Weinig.
......
...@@ -1280,7 +1280,7 @@ static int findMethodIndex(ExecState* exec, ...@@ -1280,7 +1280,7 @@ static int findMethodIndex(ExecState* exec,
QMetaMethod mtd = meta->method(conversionFailed.at(i)); QMetaMethod mtd = meta->method(conversionFailed.at(i));
message += QString::fromLatin1(" %0").arg(QString::fromLatin1(mtd.signature())); 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()) { } else if (!unresolved.isEmpty()) {
QtMethodMatchData argsInstance = unresolved.first(); QtMethodMatchData argsInstance = unresolved.first();
int unresolvedIndex = argsInstance.firstUnresolvedIndex(); int unresolvedIndex = argsInstance.firstUnresolvedIndex();
...@@ -1289,7 +1289,7 @@ static int findMethodIndex(ExecState* exec, ...@@ -1289,7 +1289,7 @@ static int findMethodIndex(ExecState* exec,
QString message = QString::fromLatin1("cannot call %0(): unknown type `%1'") QString message = QString::fromLatin1("cannot call %0(): unknown type `%1'")
.arg(QString::fromLatin1(signature)) .arg(QString::fromLatin1(signature))
.arg(QLatin1String(unresolvedType.name())); .arg(QLatin1String(unresolvedType.name()));
*pError = throwError(exec, TypeError, message.toLatin1().constData()); *pError = throwError(exec, createTypeError(exec, message.toLatin1().constData()));
} else { } else {
QString message = QString::fromLatin1("too few arguments in call to %0(); candidates are\n") QString message = QString::fromLatin1("too few arguments in call to %0(); candidates are\n")
.arg(QLatin1String(signature)); .arg(QLatin1String(signature));
...@@ -1299,7 +1299,7 @@ static int findMethodIndex(ExecState* exec, ...@@ -1299,7 +1299,7 @@ static int findMethodIndex(ExecState* exec,
QMetaMethod mtd = meta->method(tooFewArgs.at(i)); QMetaMethod mtd = meta->method(tooFewArgs.at(i));
message += QString::fromLatin1(" %0").arg(QString::fromLatin1(mtd.signature())); 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, ...@@ -1321,7 +1321,7 @@ static int findMethodIndex(ExecState* exec,
message += QString::fromLatin1(" %0").arg(QString::fromLatin1(mtd.signature())); 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 { } else {
chosenIndex = bestMatch.index; chosenIndex = bestMatch.index;
args = bestMatch.args; args = bestMatch.args;
...@@ -1406,7 +1406,7 @@ EncodedJSValue QtRuntimeMetaMethod::call(ExecState* exec) ...@@ -1406,7 +1406,7 @@ EncodedJSValue QtRuntimeMetaMethod::call(ExecState* exec)
if (errorObj) if (errorObj)
return JSValue::encode(errorObj); return JSValue::encode(errorObj);
} else { } else {
return JSValue::encode(throwError(exec, GeneralError, "cannot call function of deleted QObject")); return throwVMError(exec, createError(exec, "cannot call function of deleted QObject"));
} }
// void functions return undefined // void functions return undefined
...@@ -1539,9 +1539,9 @@ EncodedJSValue QtRuntimeConnectionMethod::call(ExecState* exec) ...@@ -1539,9 +1539,9 @@ EncodedJSValue QtRuntimeConnectionMethod::call(ExecState* exec)
CallData callData; CallData callData;
if (funcObject->getCallData(callData) == CallTypeNone) { if (funcObject->getCallData(callData) == CallTypeNone) {
if (d->m_isConnect) if (d->m_isConnect)
return JSValue::encode(throwError(exec, TypeError, "QtMetaMethod.connect: target is not a function")); return throwVMError(exec, createTypeError(exec, "QtMetaMethod.connect: target is not a function"));
else else
return JSValue::encode(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) { } else if (exec->argumentCount() >= 2) {
if (exec->argument(0).isObject()) { if (exec->argument(0).isObject()) {
...@@ -1567,22 +1567,22 @@ EncodedJSValue QtRuntimeConnectionMethod::call(ExecState* exec) ...@@ -1567,22 +1567,22 @@ EncodedJSValue QtRuntimeConnectionMethod::call(ExecState* exec)
funcObject = asFuncObj; funcObject = asFuncObj;
} else { } else {
if (d->m_isConnect) if (d->m_isConnect)
return JSValue::encode(throwError(exec, TypeError, "QtMetaMethod.connect: target is not a function")); return throwError(exec, createTypeError(exec, "QtMetaMethod.connect: target is not a function"));
else else
return JSValue::encode(throwError(exec, TypeError, "QtMetaMethod.disconnect: target is not a function")); return throwError(exec, createTypeError(exec, "QtMetaMethod.disconnect: target is not a function"));
} }
} }
} else { } else {
if (d->m_isConnect) if (d->m_isConnect)
return JSValue::encode(throwError(exec, TypeError, "QtMetaMethod.connect: thisObject is not an object")); return throwVMError(exec, createTypeError(exec, "QtMetaMethod.connect: thisObject is not an object"));
else else
return JSValue::encode(throwError(exec, TypeError, "QtMetaMethod.disconnect: thisObject is not an object")); return throwVMError(exec, createTypeError(exec, "QtMetaMethod.disconnect: thisObject is not an object"));
} }
} else { } else {
if (d->m_isConnect) if (d->m_isConnect)
return JSValue::encode(throwError(exec, GeneralError, "QtMetaMethod.connect: no arguments given")); return throwVMError(exec, createError(exec, "QtMetaMethod.connect: no arguments given"));
else else
return JSValue::encode(throwError(exec, GeneralError, "QtMetaMethod.disconnect: no arguments given")); return throwVMError(exec, createError(exec, "QtMetaMethod.disconnect: no arguments given"));
} }
if (d->m_isConnect) { if (d->m_isConnect) {
...@@ -1599,7 +1599,7 @@ EncodedJSValue QtRuntimeConnectionMethod::call(ExecState* exec) ...@@ -1599,7 +1599,7 @@ EncodedJSValue QtRuntimeConnectionMethod::call(ExecState* exec)
QString msg = QString(QLatin1String("QtMetaMethod.connect: failed to connect to %1::%2()")) QString msg = QString(QLatin1String("QtMetaMethod.connect: failed to connect to %1::%2()"))
.arg(QLatin1String(sender->metaObject()->className())) .arg(QLatin1String(sender->metaObject()->className()))
.arg(QLatin1String(d->m_signature)); .arg(QLatin1String(d->m_signature));
return JSValue::encode(throwError(exec, GeneralError, msg.toLatin1().constData())); return throwVMError(exec, createError(exec, msg.toLatin1().constData()));
} }
else { else {
// Store connection // Store connection
...@@ -1625,7 +1625,7 @@ EncodedJSValue QtRuntimeConnectionMethod::call(ExecState* exec) ...@@ -1625,7 +1625,7 @@ EncodedJSValue QtRuntimeConnectionMethod::call(ExecState* exec)
QString msg = QString(QLatin1String("QtMetaMethod.disconnect: failed to disconnect from %1::%2()")) QString msg = QString(QLatin1String("QtMetaMethod.disconnect: failed to disconnect from %1::%2()"))
.arg(QLatin1String(sender->metaObject()->className())) .arg(QLatin1String(sender->metaObject()->className()))
.arg(QLatin1String(d->m_signature)); .arg(QLatin1String(d->m_signature));
return JSValue::encode(throwError(exec, GeneralError, msg.toLatin1().constData())); return throwVMError(exec, createError(exec, msg.toLatin1().constData()));
} }
} }
} else { } else {
...@@ -1633,10 +1633,10 @@ EncodedJSValue QtRuntimeConnectionMethod::call(ExecState* exec) ...@@ -1633,10 +1633,10 @@ EncodedJSValue QtRuntimeConnectionMethod::call(ExecState* exec)
.arg(QLatin1String(d->m_isConnect ? "connect": "disconnect")) .arg(QLatin1String(d->m_isConnect ? "connect": "disconnect"))
.arg(QLatin1String(sender->metaObject()->className())) .arg(QLatin1String(sender->metaObject()->className()))
.arg(QLatin1String(d->m_signature)); .arg(QLatin1String(d->m_signature));
return JSValue::encode(throwError(exec, TypeError, msg.toLatin1().constData())); return throwVMError(exec, createTypeError(exec, msg.toLatin1().constData()));
} }
} else { } else {
return JSValue::encode(throwError(exec, GeneralError, "cannot call function of deleted QObject")); return throwVMError(exec, createError(exec, "cannot call function of deleted QObject"));
} }
return JSValue::encode(jsUndefined()); return JSValue::encode(jsUndefined());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment