diff options
-rw-r--r-- | src/core/content_browser_client_qt.cpp | 2 | ||||
-rw-r--r-- | src/core/user_script_controller_host.cpp | 5 | ||||
-rw-r--r-- | src/core/user_script_controller_host.h | 2 |
3 files changed, 6 insertions, 3 deletions
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index a6a133271..60ca493ca 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 2f4a55c27..227a639b1 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 293b5d2dd..49c96b333 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) |