summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Bruning <michael.bruning@theqtcompany.com>2015-11-24 17:09:50 +0100
committerJoerg Bornemann <joerg.bornemann@theqtcompany.com>2015-11-25 20:13:59 +0000
commit754edb8dadb9b3086f67eadabdde9659dfcb7caf (patch)
tree78de1ae8dbb56ee259feb91bb67ef07d0d7170ba /src
parentc1ae43bbf402ffd4c39218471508ed8477e66254 (diff)
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 <kai.koehne@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/webengine/api/qquickwebengineview.cpp4
1 files changed, 4 insertions, 0 deletions
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<QQmlWebChannel *>(adapter->webChannel());
adapter = 0;
ensureContentsAdapter();
+ if (qmlWebChannel)
+ adapter->setWebChannel(qmlWebChannel);
+
if (!explicitUrl.isValid() && activeUrl.isValid())
adapter->load(activeUrl);
}