summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-07-17 09:38:17 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-07-17 09:38:17 (GMT)
commit525251ecded0a57e6b456cc787094a5703d7ff13 (patch)
tree329e118e56656d4fa3bc8055dab6a8c20ef05333
parent6272ef01f0985fa22262733eddd37c3c39de0a1a (diff)
downloadQt-525251ecded0a57e6b456cc787094a5703d7ff13.zip
Qt-525251ecded0a57e6b456cc787094a5703d7ff13.tar.gz
Qt-525251ecded0a57e6b456cc787094a5703d7ff13.tar.bz2
set correct property flags in newFunction()
-rw-r--r--src/script/api/qscriptengine.cpp5
-rw-r--r--tests/auto/qscriptengine/tst_qscriptengine.cpp2
2 files changed, 3 insertions, 4 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index 5ffb04e..0a3fbf1 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -1415,9 +1415,10 @@ QScriptValue QScriptEngine::newFunction(QScriptEngine::FunctionSignature fun,
JSC::ExecState* exec = d->currentFrame;
JSC::JSValue function = new (exec)QScript::FunctionWrapper(this, length, JSC::Identifier(exec, ""), fun);
QScriptValue result = d->scriptValueFromJSCValue(function);
- result.setProperty(QLatin1String("prototype"), prototype);
+ result.setProperty(QLatin1String("prototype"), prototype, QScriptValue::Undeletable);
const_cast<QScriptValue&>(prototype)
- .setProperty(QLatin1String("constructor"), result, QScriptValue::SkipInEnumeration);
+ .setProperty(QLatin1String("constructor"), result,
+ QScriptValue::Undeletable | QScriptValue::SkipInEnumeration);
return result;
}
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp
index 54e6033..d477939 100644
--- a/tests/auto/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp
@@ -269,10 +269,8 @@ void tst_QScriptEngine::newFunction()
QCOMPARE(fun.prototype().strictlyEquals(eng.evaluate("Function.prototype")), true);
// public prototype should be the one we passed
QCOMPARE(fun.property("prototype").strictlyEquals(proto), true);
- QEXPECT_FAIL("", "Flags are wrong", Continue);
QCOMPARE(fun.propertyFlags("prototype"), QScriptValue::Undeletable);
QCOMPARE(proto.property("constructor").strictlyEquals(fun), true);
- QEXPECT_FAIL("", "Flags are wrong", Continue);
QCOMPARE(proto.propertyFlags("constructor"),
QScriptValue::Undeletable | QScriptValue::SkipInEnumeration);