diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-07-16 09:46:36 (GMT) |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-07-16 09:46:36 (GMT) |
commit | 1d56e14605d74aefb955bdd81ee4083131252c9e (patch) | |
tree | 56b4f308f98cfb90aead974a92d5be423e0ab360 /src/script/api | |
parent | f76a2fa667e19f2a42b2b22ea893a9d29dd74028 (diff) | |
download | Qt-1d56e14605d74aefb955bdd81ee4083131252c9e.zip Qt-1d56e14605d74aefb955bdd81ee4083131252c9e.tar.gz Qt-1d56e14605d74aefb955bdd81ee4083131252c9e.tar.bz2 |
only set default prototype if resulting object has built-in Object prototype as its prototype
port of commit 4182e9c4b2cbfcd0604c57da210e97d68cbbbb52 in qt/master.
Diffstat (limited to 'src/script/api')
-rw-r--r-- | src/script/api/qscriptengine.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index e020c93..702851a 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -2210,6 +2210,7 @@ QScriptValue QScriptEngine::create(int type, const void *ptr) QScriptValue QScriptEnginePrivate::create(int type, const void *ptr) { + Q_Q(QScriptEngine); Q_ASSERT(ptr != 0); QScriptValue result; QScriptTypeInfo *info = m_typeInfos.value(type); @@ -2323,8 +2324,10 @@ QScriptValue QScriptEnginePrivate::create(int type, const void *ptr) } } } - if (result.isObject() && info && info->prototype) + if (result.isObject() && info && info->prototype + && result.prototype().strictlyEquals(q->globalObject().property(QLatin1String("prototype")))) { result.setPrototype(scriptValueFromJSCValue(info->prototype)); + } return result; } |