diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2009-09-15 13:06:20 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-09-22 08:55:48 (GMT) |
commit | 16c0c3d4312a55f9bdabd3faee854ebd965d37c7 (patch) | |
tree | d85c1627cb2c97952eba457f53df9808bbfd15e8 /src/script | |
parent | 36d83b1dbc4c8aa25745174bd2f1212af3e544f0 (diff) | |
download | Qt-16c0c3d4312a55f9bdabd3faee854ebd965d37c7.zip Qt-16c0c3d4312a55f9bdabd3faee854ebd965d37c7.tar.gz Qt-16c0c3d4312a55f9bdabd3faee854ebd965d37c7.tar.bz2 |
Fix QScriptValue::strictlyEquals
strictlyEquals has to continue to work if one of the values has an engine
and the other one doesn't. Use the other value's engine to construct a
JSValue if possible and use JSC::JSValue::strictEqual.
Reviewed-by: Kent Hansen
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/api/qscriptvalue.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index a1f5878..6a6381e 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -1197,8 +1197,15 @@ bool QScriptValue::strictlyEquals(const QScriptValue &other) const "a different engine"); return false; } - if (d->type != other.d_ptr->type) + + if (d->type != other.d_ptr->type) { + if (d->type == QScriptValuePrivate::JavaScriptCore) + return JSC::JSValue::strictEqual(d->jscValue, d->engine->scriptValueToJSCValue(other)); + else if (other.d_ptr->type == QScriptValuePrivate::JavaScriptCore) + return JSC::JSValue::strictEqual(other.d_ptr->engine->scriptValueToJSCValue(*this), other.d_ptr->jscValue); + return false; + } switch (d->type) { case QScriptValuePrivate::JavaScriptCore: return JSC::JSValue::strictEqual(d->jscValue, other.d_ptr->jscValue); |