From 47d6b5ce11d1014548ba69df5d7b698381a8343e Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Fri, 22 Jul 2016 12:45:22 +0200 Subject: Reinstall the webChannelTransport on render process switch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since we now have a state on the render process side in WebChannelIPCTransport to know if we should install the web channel transport or not, it's important to keep this state updated if a new render process is spawned for a WebContentsAdapter. Task-number: QTBUG-53411 Change-Id: Id0e9e537dcf09317ca3dafd4020a7ada8d16bb8b Reviewed-by: Michael BrĂ¼ning --- src/core/web_channel_ipc_transport_host.cpp | 7 +++++++ src/core/web_channel_ipc_transport_host.h | 3 +++ 2 files changed, 10 insertions(+) (limited to 'src/core') diff --git a/src/core/web_channel_ipc_transport_host.cpp b/src/core/web_channel_ipc_transport_host.cpp index ce5ea320b..aef16f0a0 100644 --- a/src/core/web_channel_ipc_transport_host.cpp +++ b/src/core/web_channel_ipc_transport_host.cpp @@ -61,6 +61,13 @@ WebChannelIPCTransportHost::~WebChannelIPCTransportHost() { } +void WebChannelIPCTransportHost::RenderViewHostChanged(content::RenderViewHost *, content::RenderViewHost *) +{ + // This means that we were moved into a different RenderView, possibly in a different + // render process and that we lost our WebChannelIPCTransport object and its state. + Send(new WebChannelIPCTransport_Install(routing_id(), m_worldId)); +} + void WebChannelIPCTransportHost::setWorldId(uint worldId) { if (worldId == m_worldId) diff --git a/src/core/web_channel_ipc_transport_host.h b/src/core/web_channel_ipc_transport_host.h index 9c499ad78..9cc1f3104 100644 --- a/src/core/web_channel_ipc_transport_host.h +++ b/src/core/web_channel_ipc_transport_host.h @@ -58,6 +58,9 @@ public: WebChannelIPCTransportHost(content::WebContents *, uint worldId = 0, QObject *parent = 0); virtual ~WebChannelIPCTransportHost(); + // WebContentsObserver + virtual void RenderViewHostChanged(content::RenderViewHost* old_host, content::RenderViewHost* new_host) Q_DECL_OVERRIDE; + // QWebChannelAbstractTransport virtual void sendMessage(const QJsonObject &message) Q_DECL_OVERRIDE; -- cgit v1.2.3