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