diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-09-07 18:31:09 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-09-12 09:42:09 +0000 |
commit | ab0603f2a2e59d8a671326f659d1c316c7383606 (patch) | |
tree | 88fad972653bf1e8911c73b55e85a75741ffb0b7 /src/core/renderer_host/web_channel_ipc_transport_host.cpp | |
parent | 73ae71cbd1937ef1e2a1ba888a4802792fe6d738 (diff) |
Recreate state in renderer objects after RenderViewCreated
This ensures the scripts and webchannel are added before
RunScriptsAtDocumentStart is called. It also means we shouldn't add
them later from the changed signal.
Task-number: QTBUG-62898
Change-Id: Ib4cd3a69134d0eafc7f2ac4b7927a1c79b63bfa6
Reviewed-by: Viktor Engelmann <viktor.engelmann@qt.io>
Diffstat (limited to 'src/core/renderer_host/web_channel_ipc_transport_host.cpp')
-rw-r--r-- | src/core/renderer_host/web_channel_ipc_transport_host.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/core/renderer_host/web_channel_ipc_transport_host.cpp b/src/core/renderer_host/web_channel_ipc_transport_host.cpp index aef16f0a0..a093632bc 100644 --- a/src/core/renderer_host/web_channel_ipc_transport_host.cpp +++ b/src/core/renderer_host/web_channel_ipc_transport_host.cpp @@ -40,6 +40,7 @@ #include "web_channel_ipc_transport_host.h" #include "base/strings/string16.h" +#include "content/public/browser/render_view_host.h" #include "common/qt_messages.h" #include "type_conversion.h" @@ -61,11 +62,16 @@ WebChannelIPCTransportHost::~WebChannelIPCTransportHost() { } -void WebChannelIPCTransportHost::RenderViewHostChanged(content::RenderViewHost *, content::RenderViewHost *) +void WebChannelIPCTransportHost::RenderViewHostChanged(content::RenderViewHost *oldHost, 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)); + if (oldHost) + oldHost->Send(new WebChannelIPCTransport_Uninstall(oldHost->GetRoutingID(), m_worldId)); +} + +void WebChannelIPCTransportHost::RenderViewCreated(content::RenderViewHost *view_host) +{ + // Make sure the new view knows a webchannel is installed and in which world. + view_host->Send(new WebChannelIPCTransport_Install(view_host->GetRoutingID(), m_worldId)); } void WebChannelIPCTransportHost::setWorldId(uint worldId) |