summaryrefslogtreecommitdiffstats
path: root/src/script/api
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-07-16 09:46:36 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-07-16 09:46:36 (GMT)
commit1d56e14605d74aefb955bdd81ee4083131252c9e (patch)
tree56b4f308f98cfb90aead974a92d5be423e0ab360 /src/script/api
parentf76a2fa667e19f2a42b2b22ea893a9d29dd74028 (diff)
downloadQt-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.cpp5
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;
}