summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/script/bridge/qscriptclassobject.cpp5
-rw-r--r--tests/auto/qscriptclass/tst_qscriptclass.cpp4
2 files changed, 7 insertions, 2 deletions
diff --git a/src/script/bridge/qscriptclassobject.cpp b/src/script/bridge/qscriptclassobject.cpp
index 9285883..2085756 100644
--- a/src/script/bridge/qscriptclassobject.cpp
+++ b/src/script/bridge/qscriptclassobject.cpp
@@ -183,6 +183,10 @@ void ClassObjectDelegate::getOwnPropertyNames(QScriptObject* object, JSC::ExecSt
JSC::PropertyNameArray &propertyNames,
JSC::EnumerationMode mode)
{
+ // For compatibility with the old back-end, normal JS properties
+ // are added first.
+ QScriptObjectDelegate::getOwnPropertyNames(object, exec, propertyNames, mode);
+
QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
QScript::SaveFrameHelper saveFrame(engine, exec);
QScriptValue scriptObject = engine->scriptValueFromJSCValue(object);
@@ -195,7 +199,6 @@ void ClassObjectDelegate::getOwnPropertyNames(QScriptObject* object, JSC::ExecSt
}
delete it;
}
- QScriptObjectDelegate::getOwnPropertyNames(object, exec, propertyNames, mode);
}
JSC::CallType ClassObjectDelegate::getCallData(QScriptObject*, JSC::CallData &callData)
diff --git a/tests/auto/qscriptclass/tst_qscriptclass.cpp b/tests/auto/qscriptclass/tst_qscriptclass.cpp
index 2d6daec..00fdd35 100644
--- a/tests/auto/qscriptclass/tst_qscriptclass.cpp
+++ b/tests/auto/qscriptclass/tst_qscriptclass.cpp
@@ -823,10 +823,12 @@ void tst_QScriptClass::enumerate()
cls.setIterationEnabled(true);
QScriptValueIterator it(obj);
+ // This test relies on the order in which properties are enumerated,
+ // which we don't guarantee. However, for compatibility's sake we prefer
+ // that normal JS properties come before QScriptClass properties.
for (int x = 0; x < 2; ++x) {
QVERIFY(it.hasNext());
it.next();
- QEXPECT_FAIL("", "", Abort);
QVERIFY(it.scriptName() == foo);
QVERIFY(it.hasNext());
it.next();