Quote stringified generic variants on JSON.stringify
A string representation of those is unlikely to be actual JSON, and even if it is, we don't want to use it as such. Fixes: QTBUG-72674 Change-Id: I6815366a0176d9725ff4840d3fc545792ce00535 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
This commit is contained in:
parent
bffc040f80
commit
75ebbd0b35
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue