From 5d2ad577a42c8cbdd095ef336dd4275638901d59 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 22 Jul 2009 12:50:43 +0200 Subject: fix QScriptValue::isError Reviewed-by: Kent Hansen --- .../webkit/JavaScriptCore/runtime/NativeErrorPrototype.cpp | 4 ++++ .../webkit/JavaScriptCore/runtime/NativeErrorPrototype.h | 11 ++++++++++- tests/auto/qscriptvalue/tst_qscriptvalue.cpp | 1 - 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/NativeErrorPrototype.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/NativeErrorPrototype.cpp index 84190a0..650a0fd 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/NativeErrorPrototype.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/NativeErrorPrototype.cpp @@ -30,7 +30,11 @@ namespace JSC { ASSERT_CLASS_FITS_IN_CELL(NativeErrorPrototype); NativeErrorPrototype::NativeErrorPrototype(ExecState* exec, PassRefPtr structure, const UString& name, const UString& message) +#ifdef QT_BUILD_SCRIPT_LIB + : ErrorInstance(structure) +#else : JSObject(structure) +#endif { putDirect(exec->propertyNames().name, jsString(exec, name), 0); putDirect(exec->propertyNames().message, jsString(exec, message), 0); diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/NativeErrorPrototype.h b/src/3rdparty/webkit/JavaScriptCore/runtime/NativeErrorPrototype.h index 77bfe8a..48a9d7e 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/NativeErrorPrototype.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/NativeErrorPrototype.h @@ -22,10 +22,19 @@ #define NativeErrorPrototype_h #include "JSObject.h" +#ifdef QT_BUILD_SCRIPT_LIB +#include "ErrorInstance.h" +#endif namespace JSC { - class NativeErrorPrototype : public JSObject { + class NativeErrorPrototype : +#ifdef QT_BUILD_SCRIPT_LIB //According to ECMAScript Specification 15.11.7, errors must have the "Error" class + public ErrorInstance +#else + public JSObject +#endif + { public: NativeErrorPrototype(ExecState*, PassRefPtr, const UString& name, const UString& message); }; diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp index b0df6fd..ddd846a 100644 --- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp +++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp @@ -1653,7 +1653,6 @@ void tst_QScriptValue::isError() for (int i = 0; i < errors.size(); ++i) { QScriptValue ctor = eng.globalObject().property(errors.at(i)); QVERIFY(ctor.isFunction()); - QEXPECT_FAIL("", "Error.prototype should itself be an Error object", Continue); QVERIFY(ctor.property("prototype").isError()); } QVERIFY(!eng.globalObject().isError()); -- cgit v0.12