diff options
6 files changed, 1 insertions, 86 deletions
diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp index 40864de366..b324386bf5 100644 --- a/src/qml/qml/qqmlmetatype.cpp +++ b/src/qml/qml/qqmlmetatype.cpp @@ -1579,15 +1579,7 @@ bool checkRegistration(QQmlType::RegistrationType typeType, QQmlMetaTypeData *da if (uri && !typeName.isEmpty()) { QString nameSpace = QString::fromUtf8(uri); - if (!data->typeRegistrationNamespace.isEmpty()) { - // We can only install types into the registered namespace - if (nameSpace != data->typeRegistrationNamespace) { - QString failure(QCoreApplication::translate("qmlRegisterType", - "Cannot install %1 '%2' into unregistered namespace '%3'")); - data->typeRegistrationFailures.append(failure.arg(registrationTypeString(typeType)).arg(typeName).arg(nameSpace)); - return false; - } - } else if (data->typeRegistrationNamespace != nameSpace) { + if (data->typeRegistrationNamespace.isEmpty() && !nameSpace.isEmpty()) { // Is the target namespace protected against further registrations? if (data->protectedNamespaces.contains(nameSpace)) { QString failure(QCoreApplication::translate("qmlRegisterType", diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/invalidStrictModule.pro b/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/invalidStrictModule.pro deleted file mode 100644 index 150f2f08d3..0000000000 --- a/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/invalidStrictModule.pro +++ /dev/null @@ -1,12 +0,0 @@ -TEMPLATE = lib -CONFIG += plugin -SOURCES = plugin.cpp -QT = core qml -DESTDIR = ../imports/org/qtproject/InvalidStrictModule - -QT += core-private gui-private qml-private - -IMPORT_FILES = \ - qmldir - -include (../../../shared/imports.pri) diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/plugin.cpp deleted file mode 100644 index fe01507412..0000000000 --- a/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/plugin.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include <QStringList> -#include <QtQml/qqmlextensionplugin.h> -#include <QtQml/qqml.h> -#include <QDebug> - -class MyPluginType : public QObject -{ - Q_OBJECT -public: - MyPluginType(QObject *parent=0) : QObject(parent) {} -}; - - -class MyPlugin : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) - -public: - MyPlugin() {} - - void registerTypes(const char *uri) - { - Q_ASSERT(QLatin1String(uri) == "org.qtproject.InvalidStrictModule"); - qmlRegisterType<MyPluginType>("org.qtproject.SomeOtherModule", 1, 0, "MyPluginType"); - } -}; - -#include "plugin.moc" diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/qmldir b/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/qmldir deleted file mode 100644 index 20716dc9f9..0000000000 --- a/tests/auto/qml/qqmlmoduleplugin/invalidStrictModule/qmldir +++ /dev/null @@ -1,2 +0,0 @@ -module org.qtproject.InvalidStrictModule -plugin invalidStrictModule diff --git a/tests/auto/qml/qqmlmoduleplugin/qqmlmoduleplugin.pro b/tests/auto/qml/qqmlmoduleplugin/qqmlmoduleplugin.pro index 0f548aa6f8..ae13a041cc 100644 --- a/tests/auto/qml/qqmlmoduleplugin/qqmlmoduleplugin.pro +++ b/tests/auto/qml/qqmlmoduleplugin/qqmlmoduleplugin.pro @@ -11,7 +11,6 @@ SUBDIRS =\ nestedPlugin\ strictModule\ strictModule.2\ - invalidStrictModule\ nonstrictModule\ preemptiveModule\ preemptedStrictModule\ diff --git a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp index 8600e1e8ab..edfbf57e76 100644 --- a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp @@ -506,12 +506,6 @@ void tst_qqmlmoduleplugin::importStrictModule_data() << QString() << QString(); - QTest::newRow("wrong target") - << "import org.qtproject.InvalidStrictModule 1.0\n" - "MyPluginType {}" - << QString() - << ":1:1: plugin cannot be loaded for module \"org.qtproject.InvalidStrictModule\": Cannot install element 'MyPluginType' into unregistered namespace 'org.qtproject.SomeOtherModule'"; - QTest::newRow("non-strict clash") << "import org.qtproject.NonstrictModule 1.0\n" "MyPluginType {}" |