Fix creation of new JS objects

A default constructed QJSValue is undefined, not an object.

BUG: 474256
FIXED-IN: 23.08.1
This commit is contained in:
Volker Krause 2023-09-08 15:25:06 +02:00 committed by Albert Astals Cid
parent c31696be6a
commit e41f682b3d
3 changed files with 3 additions and 3 deletions

View File

@ -106,7 +106,7 @@ QJSValue JSApp::plugIns() const
QJSValue plugins = qjsEngine(this)->newArray(s_num_fake_plugins);
for (int i = 0; i < s_num_fake_plugins; ++i) {
const FakePluginInfo &info = s_fake_plugins[i];
QJSValue plugin;
QJSValue plugin = qjsEngine(this)->newObject();
plugin.setProperty(QStringLiteral("certified"), info.certified);
plugin.setProperty(QStringLiteral("loaded"), info.loaded);
plugin.setProperty(QStringLiteral("name"), info.name);

View File

@ -113,7 +113,7 @@ int JSDocument::numFields() const
QJSValue JSDocument::info() const
{
QJSValue obj;
QJSValue obj = qjsEngine(this)->newObject();
QSet<DocumentInfo::Key> keys;
keys << DocumentInfo::Title << DocumentInfo::Author << DocumentInfo::Subject << DocumentInfo::Keywords << DocumentInfo::Creator << DocumentInfo::Producer;
const DocumentInfo docinfo = m_doc->m_parent->documentInfo(keys);

View File

@ -250,7 +250,7 @@ void JSField::setDisplay(int display)
// Instead of getting the Icon, we pick the field.
QJSValue JSField::buttonGetIcon([[maybe_unused]] int nFace) const
{
QJSValue fieldObject;
QJSValue fieldObject = qjsEngine(this)->newObject();
fieldObject.setProperty(OKULAR_NAME, m_field->fullyQualifiedName());
g_buttonCache->insert(m_field->fullyQualifiedName(), m_field);