diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index a6a13327131b13f61039c0a939df8c29ff09adbb..60ca493ca7c7f47ce9d7c09ce6eb9e9b8fa5c572 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -332,7 +332,7 @@ void ContentBrowserClientQt::RenderProcessWillLaunch(content::RenderProcessHost* { // FIXME: Add a settings variable to enable/disable the file scheme. content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme(host->GetID(), url::kFileScheme); - static_cast<BrowserContextQt*>(host->GetBrowserContext())->m_adapter->userScriptController()->renderProcessHostCreated(host); + static_cast<BrowserContextQt*>(host->GetBrowserContext())->m_adapter->userScriptController()->renderProcessStartedWithHost(host); } void ContentBrowserClientQt::ResourceDispatcherHostCreated() diff --git a/src/core/user_script_controller_host.cpp b/src/core/user_script_controller_host.cpp index 2f4a55c27d4a264e1dcf3897f4ac65bae93e4986..227a639b13a5e8b6ad74739b8a626a2657078ed9 100644 --- a/src/core/user_script_controller_host.cpp +++ b/src/core/user_script_controller_host.cpp @@ -186,8 +186,11 @@ void UserScriptControllerHost::reserve(WebContentsAdapter *adapter, int count) m_perContentsScripts[adapter->webContents()].reserve(count); } -void UserScriptControllerHost::renderProcessHostCreated(content::RenderProcessHost *renderer) +void UserScriptControllerHost::renderProcessStartedWithHost(content::RenderProcessHost *renderer) { + if (m_observedProcesses.contains(renderer)) + return; + if (m_renderProcessObserver.isNull()) m_renderProcessObserver.reset(new RenderProcessObserverHelper(this)); renderer->AddObserver(m_renderProcessObserver.data()); diff --git a/src/core/user_script_controller_host.h b/src/core/user_script_controller_host.h index 293b5d2dd730564a79e25d0a9fbe9828f0ebba2d..49c96b33333759cbfbdadbb7ac261cc84bc547eb 100644 --- a/src/core/user_script_controller_host.h +++ b/src/core/user_script_controller_host.h @@ -66,7 +66,7 @@ public: void reserve(WebContentsAdapter *adapter, int count); const QSet<UserScript> registeredScripts(WebContentsAdapter *adapter) const; - void renderProcessHostCreated(content::RenderProcessHost *renderer); + void renderProcessStartedWithHost(content::RenderProcessHost *renderer); private: Q_DISABLE_COPY(UserScriptControllerHost)