diff options
Diffstat (limited to 'tests/auto/qml')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 03fc8e5ad4..d7cb85a75d 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -392,7 +392,7 @@ private slots: void urlSearchParamsMethods(); void variantConversionMethod(); void sequenceConversionMethod(); - + void proxyHandlerTraps(); void gcCrashRegressionTest(); private: @@ -9512,6 +9512,35 @@ void tst_qqmlecmascript::sequenceConversionMethod() QCOMPARE(obj.funcCalled, QLatin1String("stringlist")); } +void tst_qqmlecmascript::proxyHandlerTraps() +{ + const QString expression = QStringLiteral(R"SNIPPET( + (function(){ + const target = { + prop: 47 + }; + const handler = { + getOwnPropertyDescriptor(target, prop) { + return { configurable: true, enumerable: true, value: 47 }; + } + }; + const proxy = new Proxy(target, handler); + + // QTBUG-88786 + if (!proxy.propertyIsEnumerable("prop")) + throw Error("FAIL: propertyisEnumerable"); + if (!proxy.hasOwnProperty("prop")) + throw Error("FAIL: hasOwnProperty"); + + return "SUCCESS"; + })() + )SNIPPET"); + + QJSEngine engine; + QJSValue value = engine.evaluate(expression); + QVERIFY(value.isString() && value.toString() == QStringLiteral("SUCCESS")); +} + QTEST_MAIN(tst_qqmlecmascript) #include "tst_qqmlecmascript.moc" |