diff options
-rw-r--r-- | src/qml/qml/qqmlimport.cpp | 16 | ||||
-rw-r--r-- | tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp | 8 |
2 files changed, 4 insertions, 20 deletions
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index ad7cda2145..85af8c5beb 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -1200,21 +1200,6 @@ bool QQmlImportsPrivate::importExtension(const QString &qmldirFilePath, int dynamicPluginsFound = 0; int staticPluginsFound = 0; - auto handleErrors = [&]() { - if (errors) { - // XXX TODO: should we leave the import plugin error alone? - // Here, we pop it off the top and coalesce it into this error's message. - // The reason is that the lower level may add url and line/column numbering information. - QQmlError error; - error.setDescription( - QQmlImportDatabase::tr( - "plugin cannot be loaded for module \"%1\": %2") - .arg(uri, errors->takeFirst().description())); - error.setUrl(QUrl::fromLocalFile(qmldirFilePath)); - errors->prepend(error); - } - }; - const auto qmldirPlugins = qmldir.plugins(); for (const QQmlDirParser::Plugin &plugin : qmldirPlugins) { const QString resolvedFilePath = database->resolvePlugin( @@ -1226,7 +1211,6 @@ bool QQmlImportsPrivate::importExtension(const QString &qmldirFilePath, ++dynamicPluginsFound; if (!database->importDynamicPlugin( resolvedFilePath, uri, typeNamespace, version, plugin.optional, errors)) { - handleErrors(); return false; } } diff --git a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp index 3590eeb768..b197bed54d 100644 --- a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp @@ -279,7 +279,7 @@ void tst_qqmlmoduleplugin::incorrectPluginCase() QString libname = "PluGin.dll"; #endif if (!caseSensitive) { - expectedError = QLatin1String("plugin cannot be loaded for module \"org.qtproject.WrongCase\": File name case mismatch for \"") + expectedError = QLatin1String("File name case mismatch for \"") + QDir(m_importsDirectory).filePath("org/qtproject/WrongCase/" + libname) + QLatin1Char('"'); } @@ -631,20 +631,20 @@ void tst_qqmlmoduleplugin::importStrictModule_data() << "import org.qtproject.NonstrictModule 1.0\n" "MyPluginType {}" << "Module 'org.qtproject.NonstrictModule' does not contain a module identifier directive - it cannot be protected from external registrations." - << ":1:1: plugin cannot be loaded for module \"org.qtproject.NonstrictModule\": Cannot install element 'MyPluginType' into protected module 'org.qtproject.StrictModule' version '1'"; + << ":1:1: Cannot install element 'MyPluginType' into protected module 'org.qtproject.StrictModule' version '1'"; QTest::newRow("non-strict preemption") << "import org.qtproject.PreemptiveModule 1.0\n" "import org.qtproject.PreemptedStrictModule 1.0\n" "MyPluginType {}" << "Module 'org.qtproject.PreemptiveModule' does not contain a module identifier directive - it cannot be protected from external registrations." - << ":2:1: plugin cannot be loaded for module \"org.qtproject.PreemptedStrictModule\": Namespace 'org.qtproject.PreemptedStrictModule' has already been used for type registration"; + << ":2:1: Namespace 'org.qtproject.PreemptedStrictModule' has already been used for type registration"; QTest::newRow("invalid namespace") << "import org.qtproject.InvalidNamespaceModule 1.0\n" "MyPluginType {}" << QString() - << ":1:1: plugin cannot be loaded for module \"org.qtproject.InvalidNamespaceModule\": Module namespace 'org.qtproject.AwesomeModule' does not match import URI 'org.qtproject.InvalidNamespaceModule'"; + << ":1:1: Module namespace 'org.qtproject.AwesomeModule' does not match import URI 'org.qtproject.InvalidNamespaceModule'"; QTest::newRow("module directive must be first") << "import org.qtproject.InvalidFirstCommandModule 1.0\n" |