From 1d92e9a243dfdd84483a978e50f1cee6d5f44159 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 22 Jul 2009 16:48:39 +0200 Subject: JSC: toString report correct error message --- src/3rdparty/webkit/JavaScriptCore/runtime/FunctionPrototype.cpp | 4 ++++ tests/auto/qscriptvalue/tst_qscriptvalue.cpp | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/FunctionPrototype.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/FunctionPrototype.cpp index 9ba2144..ff8e57b 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/FunctionPrototype.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/FunctionPrototype.cpp @@ -98,7 +98,11 @@ JSValue JSC_HOST_CALL functionProtoFuncToString(ExecState* exec, JSObject*, JSVa return jsString(exec, "function " + function->name(&exec->globalData()) + "() {\n [native code]\n}"); } +#ifdef QT_BUILD_SCRIPT_LIB //same error message as in the old engine, and in mozilla + return throwError(exec, TypeError, "Function.prototype.toString called on incompatible object"); +#else return throwError(exec, TypeError); +#endif } JSValue JSC_HOST_CALL functionProtoFuncApply(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp index 2ed6d6f..3c9108b 100644 --- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp +++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp @@ -406,7 +406,6 @@ void tst_QScriptValue::toString() "})()"); QVERIFY(!eng.hasUncaughtException()); QVERIFY(objectObject.isObject()); - QEXPECT_FAIL("", "Should return an error string", Continue); QCOMPARE(objectObject.toString(), QString::fromLatin1("TypeError: Function.prototype.toString called on incompatible object")); QVERIFY(eng.hasUncaughtException()); eng.clearExceptions(); -- cgit v0.12