summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-02-09 23:24:39 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-02-09 23:24:39 (GMT)
commit65b1a5c2cb6c3ebb4ca95119eab9b2ec392333e8 (patch)
tree125a0967c6bc2a1845e4b3bb2c0dc99098e8a5d4
parenta1fcebed2b17b688c656f6a7326f7cc5516f4327 (diff)
parente8abc416f07f74dd12e75b61be0aeac297b7a1f8 (diff)
downloadQt-65b1a5c2cb6c3ebb4ca95119eab9b2ec392333e8.zip
Qt-65b1a5c2cb6c3ebb4ca95119eab9b2ec392333e8.tar.gz
Qt-65b1a5c2cb6c3ebb4ca95119eab9b2ec392333e8.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-air-staging into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/qt-air-staging: QScriptEngine: fix property flags for native functions
-rw-r--r--src/script/api/qscriptengine.cpp18
-rw-r--r--tests/auto/qscriptengine/tst_qscriptengine.cpp13
2 files changed, 15 insertions, 16 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index e3291e0..76d9ab2 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -2087,10 +2087,10 @@ QScriptValue QScriptEngine::newFunction(QScriptEngine::FunctionSignature fun,
JSC::ExecState* exec = d->currentFrame;
JSC::JSValue function = new (exec)QScript::FunctionWrapper(exec, length, JSC::Identifier(exec, ""), fun);
QScriptValue result = d->scriptValueFromJSCValue(function);
- result.setProperty(QLatin1String("prototype"), prototype, QScriptValue::Undeletable);
+ result.setProperty(QLatin1String("prototype"), prototype,
+ QScriptValue::Undeletable | QScriptValue::SkipInEnumeration);
const_cast<QScriptValue&>(prototype)
- .setProperty(QLatin1String("constructor"), result,
- QScriptValue::Undeletable | QScriptValue::SkipInEnumeration);
+ .setProperty(QLatin1String("constructor"), result, QScriptValue::SkipInEnumeration);
return result;
}
@@ -2356,9 +2356,9 @@ QScriptValue QScriptEngine::newFunction(QScriptEngine::FunctionSignature fun, in
JSC::JSValue function = new (exec)QScript::FunctionWrapper(exec, length, JSC::Identifier(exec, ""), fun);
QScriptValue result = d->scriptValueFromJSCValue(function);
QScriptValue proto = newObject();
- result.setProperty(QLatin1String("prototype"), proto, QScriptValue::Undeletable);
- proto.setProperty(QLatin1String("constructor"), result,
- QScriptValue::Undeletable | QScriptValue::SkipInEnumeration);
+ result.setProperty(QLatin1String("prototype"), proto,
+ QScriptValue::Undeletable | QScriptValue::SkipInEnumeration);
+ proto.setProperty(QLatin1String("constructor"), result, QScriptValue::SkipInEnumeration);
return result;
}
@@ -2374,9 +2374,9 @@ QScriptValue QScriptEngine::newFunction(QScriptEngine::FunctionWithArgSignature
JSC::JSValue function = new (exec)QScript::FunctionWithArgWrapper(exec, /*length=*/0, JSC::Identifier(exec, ""), fun, arg);
QScriptValue result = d->scriptValueFromJSCValue(function);
QScriptValue proto = newObject();
- result.setProperty(QLatin1String("prototype"), proto, QScriptValue::Undeletable);
- proto.setProperty(QLatin1String("constructor"), result,
- QScriptValue::Undeletable | QScriptValue::SkipInEnumeration);
+ result.setProperty(QLatin1String("prototype"), proto,
+ QScriptValue::Undeletable | QScriptValue::SkipInEnumeration);
+ proto.setProperty(QLatin1String("constructor"), result, QScriptValue::SkipInEnumeration);
return result;
}
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp
index 2f7e0b5..b609d8c 100644
--- a/tests/auto/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp
@@ -344,8 +344,8 @@ void tst_QScriptEngine::newFunction()
QScriptValue prot = fun.property("prototype", QScriptValue::ResolveLocal);
QVERIFY(prot.isObject());
QVERIFY(prot.property("constructor").strictlyEquals(fun));
- QCOMPARE(fun.propertyFlags("prototype"), QScriptValue::Undeletable);
- QCOMPARE(prot.propertyFlags("constructor"), QScriptValue::Undeletable | QScriptValue::SkipInEnumeration);
+ QCOMPARE(fun.propertyFlags("prototype"), QScriptValue::Undeletable | QScriptValue::SkipInEnumeration);
+ QCOMPARE(prot.propertyFlags("constructor"), QScriptValue::SkipInEnumeration);
}
// prototype should be Function.prototype
QCOMPARE(fun.prototype().isValid(), true);
@@ -369,8 +369,8 @@ void tst_QScriptEngine::newFunctionWithArg()
QScriptValue prot = fun.property("prototype", QScriptValue::ResolveLocal);
QVERIFY(prot.isObject());
QVERIFY(prot.property("constructor").strictlyEquals(fun));
- QCOMPARE(fun.propertyFlags("prototype"), QScriptValue::Undeletable);
- QCOMPARE(prot.propertyFlags("constructor"), QScriptValue::Undeletable | QScriptValue::SkipInEnumeration);
+ QCOMPARE(fun.propertyFlags("prototype"), QScriptValue::Undeletable | QScriptValue::SkipInEnumeration);
+ QCOMPARE(prot.propertyFlags("constructor"), QScriptValue::SkipInEnumeration);
}
// prototype should be Function.prototype
QCOMPARE(fun.prototype().isValid(), true);
@@ -397,10 +397,9 @@ void tst_QScriptEngine::newFunctionWithProto()
QCOMPARE(fun.prototype().strictlyEquals(eng.evaluate("Function.prototype")), true);
// public prototype should be the one we passed
QCOMPARE(fun.property("prototype").strictlyEquals(proto), true);
- QCOMPARE(fun.propertyFlags("prototype"), QScriptValue::Undeletable);
+ QCOMPARE(fun.propertyFlags("prototype"), QScriptValue::Undeletable | QScriptValue::SkipInEnumeration);
QCOMPARE(proto.property("constructor").strictlyEquals(fun), true);
- QCOMPARE(proto.propertyFlags("constructor"),
- QScriptValue::Undeletable | QScriptValue::SkipInEnumeration);
+ QCOMPARE(proto.propertyFlags("constructor"), QScriptValue::SkipInEnumeration);
QCOMPARE(fun.call().isNull(), true);
QCOMPARE(fun.construct().isObject(), true);