diff options
-rw-r--r-- | src/script/api/qscriptengine.cpp | 5 | ||||
-rw-r--r-- | tests/auto/qscriptengine/tst_qscriptengine.cpp | 2 |
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); |