summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/core_gyp_generator.pro1
-rw-r--r--src/core/web_engine_context.cpp2
-rw-r--r--src/webengine/plugin/plugin.cpp19
3 files changed, 18 insertions, 4 deletions
diff --git a/src/core/core_gyp_generator.pro b/src/core/core_gyp_generator.pro
index 2f58664f4..4ac4d0060 100644
--- a/src/core/core_gyp_generator.pro
+++ b/src/core/core_gyp_generator.pro
@@ -17,6 +17,7 @@ QT_PRIVATE += qml-private quick-private gui-private core-private
DEFINES += QT_NO_KEYWORDS \
Q_FORWARD_DECLARE_OBJC_CLASS=QT_FORWARD_DECLARE_CLASS \
QTWEBENGINEPROCESS_NAME=\\\"$$QTWEBENGINEPROCESS_NAME\\\" \
+ QTWEBENGINECORE_VERSION_STR=\\\"$$MODULE_VERSION\\\" \
BUILDING_CHROMIUM
# Keep Skia happy
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index feec45e90..8af675b81 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -130,7 +130,7 @@ WebEngineContext::WebEngineContext()
CommandLine* parsedCommandLine = CommandLine::ForCurrentProcess();
// Mention the Chromium version we're based on to get passed stupid UA-string-based feature detection (several WebRTC demos need this)
- parsedCommandLine->AppendSwitchASCII(switches::kUserAgent, webkit_glue::BuildUserAgentFromProduct("QtWebEngine/0.1 Chrome/" CHROMIUM_VERSION));
+ parsedCommandLine->AppendSwitchASCII(switches::kUserAgent, webkit_glue::BuildUserAgentFromProduct("QtWebEngine/" QTWEBENGINECORE_VERSION_STR " Chrome/" CHROMIUM_VERSION));
parsedCommandLine->AppendSwitchPath(switches::kBrowserSubprocessPath, WebEngineLibraryInfo::getPath(content::CHILD_PROCESS_EXE));
parsedCommandLine->AppendSwitch(switches::kNoSandbox);
parsedCommandLine->AppendSwitch(switches::kDisablePlugins);
diff --git a/src/webengine/plugin/plugin.cpp b/src/webengine/plugin/plugin.cpp
index 2408e5c8e..811f85dde 100644
--- a/src/webengine/plugin/plugin.cpp
+++ b/src/webengine/plugin/plugin.cpp
@@ -41,12 +41,17 @@
#include <QtQml/qqmlextensionplugin.h>
+#include "qtwebengineversion.h"
#include "qquickwebengineview_p.h"
#include "qquickwebengineloadrequest_p.h"
#include "qquickwebenginenewviewrequest_p.h"
QT_BEGIN_NAMESPACE
+class QQuickWebEngineVersionBumper : public QObject {
+ Q_OBJECT
+};
+
class QtWebEnginePlugin : public QQmlExtensionPlugin
{
Q_OBJECT
@@ -56,9 +61,17 @@ public:
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("QtWebEngine"));
- qmlRegisterType<QQuickWebEngineView>(uri, 1, 0, "WebEngineView");
- qmlRegisterUncreatableType<QQuickWebEngineLoadRequest>(uri, 1, 0, "WebEngineLoadRequest", QObject::tr("Cannot create separate instance of WebEngineLoadRequest"));
- qmlRegisterUncreatableType<QQuickWebEngineNewViewRequest>(uri, 1, 0, "WebEngineNewViewRequest", QObject::tr("Cannot create separate instance of WebEngineNewViewRequest"));
+ qmlRegisterType<QQuickWebEngineView>(uri, 0, 9, "WebEngineView");
+ qmlRegisterUncreatableType<QQuickWebEngineLoadRequest>(uri, 0, 9, "WebEngineLoadRequest", QObject::tr("Cannot create separate instance of WebEngineLoadRequest"));
+ qmlRegisterUncreatableType<QQuickWebEngineNewViewRequest>(uri, 0, 9, "WebEngineNewViewRequest", QObject::tr("Cannot create separate instance of WebEngineNewViewRequest"));
+
+ // The QML type loader relies on the minimum and maximum minor version of registered types
+ // to validate imports. We want to tie our import version to the module version, so register
+ // a dummy type in order to allow importing the latest version even if it didn't include
+ // an API update that would appear here in a registered type.
+ int major = QTWEBENGINE_VERSION >> 16;
+ int minor = QTWEBENGINE_VERSION >> 8;
+ qmlRegisterUncreatableType<QQuickWebEngineVersionBumper>(uri, major, minor, "WebEngineVersionBumper", QObject::tr("This is a dummy type and cannot be created."));
}
};