diff options
| author | Ulf Hermann <[email protected]> | 2025-10-10 12:57:29 +0200 |
|---|---|---|
| committer | Ulf Hermann <[email protected]> | 2025-10-13 12:29:01 +0200 |
| commit | 27dc9f3b8ad2ab019400d03ac9c0e5856445ff9d (patch) | |
| tree | 114534fce4711f33a10c7bbf26b02bd03cf8ca75 /tests/auto/qml/qqmlecmascript | |
| parent | 4ded294c8345971be81e5add4225495f82281f49 (diff) | |
QtQml: Fix instanceof for URL and URLSearchParams
The ctors and prototypes need to be linked together.
Task-number: QTBUG-138545
Change-Id: I5423dfb7d04c4d496d734ab5fc8252b6feb54a11
Reviewed-by: Fabian Kosmale <[email protected]>
Reviewed-by: Sami Shalayel <[email protected]>
Reviewed-by: Olivier De Cannière <[email protected]>
Diffstat (limited to 'tests/auto/qml/qqmlecmascript')
| -rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 058393f09f..0c9503a651 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -406,6 +406,7 @@ private slots: void colonAfterProtocol(); void urlSearchParamsConstruction(); void urlSearchParamsMethods(); + void urlInstanceof(); void variantConversionMethod(); void sequenceConversionMethod(); void proxyIteration(); @@ -10178,6 +10179,36 @@ void tst_qqmlecmascript::urlSearchParamsMethods() QVERIFY(EVALUATE_VALUE("this.usp.toString()", QV4::ScopedValue(scope, scope.engine->newString("a=10&c=foo")))); } +void tst_qqmlecmascript::urlInstanceof() +{ + QQmlEngine qmlengine; + + QObject *o = new QObject(&qmlengine); + + QV4::ExecutionEngine *engine = qmlengine.handle(); + QV4::Scope scope(engine); + + QV4::ScopedValue object(scope, QV4::QObjectWrapper::wrap(engine, o)); + + { + QV4::ScopedValue ret(scope, EVALUATE("this.url = new URL('http://localhost/a/b/c');")); + QV4::UrlObject *url = ret->as<QV4::UrlObject>(); + QVERIFY(url != nullptr); + + // protocol + QVERIFY(EVALUATE("this.url instanceof URL;")); + } + + { + QV4::ScopedValue ret(scope, EVALUATE("this.params = new URLSearchParams();")); + QV4::UrlSearchParamsObject *searchParams = ret->as<QV4::UrlSearchParamsObject>(); + QVERIFY(searchParams != nullptr); + + // protocol + QVERIFY(EVALUATE("this.params instanceof URLSearchParams;")); + } +} + void tst_qqmlecmascript::variantConversionMethod() { QQmlEngine qmlengine; |
