diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-07-06 14:57:06 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-07-06 14:57:06 (GMT) |
commit | 292f72349a9ff74320f29b12f725bad6c8c283c4 (patch) | |
tree | 4511cf525ccc0385cf430a42729e35a1adfdd09f /src/script | |
parent | 9769235a26c3bacc597b994fa249516721833389 (diff) | |
download | Qt-292f72349a9ff74320f29b12f725bad6c8c283c4.zip Qt-292f72349a9ff74320f29b12f725bad6c8c283c4.tar.gz Qt-292f72349a9ff74320f29b12f725bad6c8c283c4.tar.bz2 |
fix QScriptValue::construct() when argument is not array-like
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/api/qscriptvalue.cpp | 6 | ||||
-rw-r--r-- | src/script/api/qscriptvalue.h | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index bb8b2b7..cd29810 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -2045,8 +2045,7 @@ QScriptValue QScriptValue::construct(const QScriptValue &arguments) JSC::MarkedArgumentBuffer applyArgs; if (!array.isUndefinedOrNull()) { if (!array.isObject()) { - Q_ASSERT_X(false, Q_FUNC_INFO, "implement me"); -// return JSC::throwError(exec, JSC::TypeError); + return eng_p->scriptValueFromJSCValue(JSC::throwError(exec, JSC::TypeError, "Arguments must be an array")); } if (JSC::asObject(array)->classInfo() == &JSC::Arguments::info) JSC::asArguments(array)->fillArgList(exec, applyArgs); @@ -2057,8 +2056,7 @@ QScriptValue QScriptValue::construct(const QScriptValue &arguments) for (unsigned i = 0; i < length; ++i) applyArgs.append(JSC::asArray(array)->get(exec, i)); } else { - Q_ASSERT_X(false, Q_FUNC_INFO, "implement me"); -// return JSC::throwError(exec, JSC::TypeError); + return eng_p->scriptValueFromJSCValue(JSC::throwError(exec, JSC::TypeError, "Arguments must be an array")); } } diff --git a/src/script/api/qscriptvalue.h b/src/script/api/qscriptvalue.h index 34b4ec3..15a11e3 100644 --- a/src/script/api/qscriptvalue.h +++ b/src/script/api/qscriptvalue.h @@ -215,6 +215,12 @@ public: qint64 objectId() const; private: + // force compile error, prevent QScriptValue(bool) to be called + inline QScriptValue(void *) { Q_ASSERT(false); } + // force compile error, prevent QScriptValue(QScriptEngine*, bool) to be called + inline QScriptValue(QScriptEngine *, void *) { Q_ASSERT(false); } + +private: QScriptValuePrivate *d_ptr; Q_DECLARE_PRIVATE(QScriptValue) |