diff options
-rw-r--r-- | src/qml/jsruntime/qv4jsonobject.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp index 0c5436a0d6..936c032fad 100644 --- a/src/qml/jsruntime/qv4jsonobject.cpp +++ b/src/qml/jsruntime/qv4jsonobject.cpp @@ -739,7 +739,7 @@ QString Stringify::Str(const QString &key, const Value &v) } if (const QV4::VariantObject *v = value->as<QV4::VariantObject>()) { - return v->d()->data().toString(); + return quote(v->d()->data().toString()); } o = value->asReturnedValue(); diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 254a6bc878..085cd5ffd0 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -8464,7 +8464,8 @@ void tst_qqmlecmascript::stringify_qtbug_50592() QScopedPointer<QObject> obj(component.create()); QVERIFY(obj != nullptr); - QCOMPARE(obj->property("source").toString(), QString::fromLatin1("http://example.org/some_nonexistant_image.png")); + QCOMPARE(obj->property("source").toString(), + QString::fromLatin1("\"http://example.org/some_nonexistant_image.png\"")); } // Tests for the JS-only instanceof. Tests for the QML extensions for |