From 24610724db7918150d07ee7037019ecabe65d160 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 16 Mar 2018 13:46:47 +0100 Subject: Fix HTTP authentication MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Render Frame ID is no longer reliable, so use web-contents getter to get web-contents. Task-number: QTBUG-66845 Change-Id: Ic42a3fcaea381118bfd498b7c4f7d7e30b0f5f51 Reviewed-by: Michael BrĂ¼ning --- .../resource_dispatcher_host_delegate_qt.cpp | 18 ++++++++++-------- .../resource_dispatcher_host_delegate_qt.h | 5 +---- 2 files changed, 11 insertions(+), 12 deletions(-) (limited to 'src/core') diff --git a/src/core/renderer_host/resource_dispatcher_host_delegate_qt.cpp b/src/core/renderer_host/resource_dispatcher_host_delegate_qt.cpp index 53d3e88ba..421b3167b 100644 --- a/src/core/renderer_host/resource_dispatcher_host_delegate_qt.cpp +++ b/src/core/renderer_host/resource_dispatcher_host_delegate_qt.cpp @@ -61,11 +61,14 @@ ResourceDispatcherHostLoginDelegateQt::ResourceDispatcherHostLoginDelegateQt(net , m_request(request) { Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); - content::ResourceRequestInfo::GetRenderFrameForRequest(request, &m_renderProcessId, &m_renderFrameId); + const content::ResourceRequestInfo *requestInfo = content::ResourceRequestInfo::ForRequest(request); + Q_ASSERT(requestInfo); content::BrowserThread::PostTask( - content::BrowserThread::UI, FROM_HERE, - base::Bind(&ResourceDispatcherHostLoginDelegateQt::triggerDialog, this)); + content::BrowserThread::UI, FROM_HERE, + base::Bind(&ResourceDispatcherHostLoginDelegateQt::triggerDialog, + this, + requestInfo->GetWebContentsGetterForRequest())); } ResourceDispatcherHostLoginDelegateQt::~ResourceDispatcherHostLoginDelegateQt() @@ -100,14 +103,13 @@ bool ResourceDispatcherHostLoginDelegateQt::isProxy() const return m_authInfo->is_proxy; } -void ResourceDispatcherHostLoginDelegateQt::triggerDialog() +void ResourceDispatcherHostLoginDelegateQt::triggerDialog(const content::ResourceRequestInfo::WebContentsGetter &webContentsGetter) { Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); - content::RenderFrameHost *renderFrameHost = content::RenderFrameHost::FromID(m_renderProcessId, m_renderFrameId); - if (!renderFrameHost) + content::WebContentsImpl *webContents = + static_cast(webContentsGetter.Run()); + if (!webContents) return; - content::RenderViewHost *renderViewHost = renderFrameHost->GetRenderViewHost(); - content::WebContentsImpl *webContents = static_cast(content::WebContents::FromRenderViewHost(renderViewHost)); WebContentsAdapterClient *client = WebContentsViewQt::from(webContents->GetView())->client(); AuthenticationDialogControllerPrivate *dialogControllerData = new AuthenticationDialogControllerPrivate(this); diff --git a/src/core/renderer_host/resource_dispatcher_host_delegate_qt.h b/src/core/renderer_host/resource_dispatcher_host_delegate_qt.h index 305f0cea5..c254a60f5 100644 --- a/src/core/renderer_host/resource_dispatcher_host_delegate_qt.h +++ b/src/core/renderer_host/resource_dispatcher_host_delegate_qt.h @@ -65,12 +65,9 @@ public: void sendAuthToRequester(bool success, const QString &user, const QString &password); private: - void triggerDialog(); + void triggerDialog(const content::ResourceRequestInfo::WebContentsGetter &); void destroy(); - int m_renderProcessId; - int m_renderFrameId; - scoped_refptr m_authInfo; // The request that wants login data. -- cgit v1.2.3