summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/core/renderer_host/user_resource_controller_host.cpp6
-rw-r--r--src/core/renderer_host/web_channel_ipc_transport_host.cpp14
-rw-r--r--src/core/renderer_host/web_channel_ipc_transport_host.h1
3 files changed, 12 insertions, 9 deletions
diff --git a/src/core/renderer_host/user_resource_controller_host.cpp b/src/core/renderer_host/user_resource_controller_host.cpp
index 95385ae2f..cf0cbd357 100644
--- a/src/core/renderer_host/user_resource_controller_host.cpp
+++ b/src/core/renderer_host/user_resource_controller_host.cpp
@@ -79,14 +79,10 @@ void UserResourceControllerHost::WebContentsObserverHelper::RenderViewCreated(co
}
void UserResourceControllerHost::WebContentsObserverHelper::RenderViewHostChanged(content::RenderViewHost *oldHost,
- content::RenderViewHost *newHost)
+ content::RenderViewHost */*newHost*/)
{
if (oldHost)
oldHost->Send(new RenderViewObserverHelper_ClearScripts(oldHost->GetRoutingID()));
-
- content::WebContents *contents = web_contents();
- Q_FOREACH (const UserScript &script, m_controllerHost->m_perContentsScripts.value(contents))
- newHost->Send(new RenderViewObserverHelper_AddScript(newHost->GetRoutingID(), script.data()));
}
void UserResourceControllerHost::WebContentsObserverHelper::WebContentsDestroyed()
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)
diff --git a/src/core/renderer_host/web_channel_ipc_transport_host.h b/src/core/renderer_host/web_channel_ipc_transport_host.h
index aa406471c..a1e697a91 100644
--- a/src/core/renderer_host/web_channel_ipc_transport_host.h
+++ b/src/core/renderer_host/web_channel_ipc_transport_host.h
@@ -60,6 +60,7 @@ public:
// WebContentsObserver
void RenderViewHostChanged(content::RenderViewHost* old_host, content::RenderViewHost* new_host) override;
+ void RenderViewCreated(content::RenderViewHost* render_view_host) override;
// QWebChannelAbstractTransport
void sendMessage(const QJsonObject &message) override;