From 754edb8dadb9b3086f67eadabdde9659dfcb7caf Mon Sep 17 00:00:00 2001 From: Michael Bruning Date: Tue, 24 Nov 2015 17:09:50 +0100 Subject: Reassociate the web channel when setting a profile. The WebContentsAdapter gets recreated and the QmlWebChannel needs to be reassociated with the new adapter instance. Change-Id: I88494fd379c429f2ae98df95a22c04c334452088 Task-number: QTBUG-49521 Reviewed-by: Kai Koehne --- src/webengine/api/qquickwebengineview.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index c35b7aeb8..c323f486b 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -763,8 +763,12 @@ void QQuickWebEngineViewPrivate::setProfile(QQuickWebEngineProfile *profile) if (adapter && adapter->browserContext() != browserContextAdapter()->browserContext()) { // When the profile changes we need to create a new WebContentAdapter and reload the active URL. QUrl activeUrl = adapter->activeUrl(); + QQmlWebChannel *qmlWebChannel = qobject_cast(adapter->webChannel()); adapter = 0; ensureContentsAdapter(); + if (qmlWebChannel) + adapter->setWebChannel(qmlWebChannel); + if (!explicitUrl.isValid() && activeUrl.isValid()) adapter->load(activeUrl); } -- cgit v1.2.3