Diff
Modified: trunk/Source/WebKit2/ChangeLog (137863 => 137864)
--- trunk/Source/WebKit2/ChangeLog 2012-12-17 02:10:28 UTC (rev 137863)
+++ trunk/Source/WebKit2/ChangeLog 2012-12-17 02:14:19 UTC (rev 137864)
@@ -1,3 +1,31 @@
+2012-12-16 Anders Carlsson <[email protected]>
+
+ Implement authentication for downloads
+ https://bugs.webkit.org/show_bug.cgi?id=105146
+ <rdar://problem/12239483>
+
+ Reviewed by Sam Weinig.
+
+ * NetworkProcess/NetworkProcess.cpp:
+ (WebKit::NetworkProcess::NetworkProcess):
+ (WebKit::NetworkProcess::initialize):
+ (WebKit::NetworkProcess::didReceiveMessage):
+ (WebKit::NetworkProcess::didReceiveSyncMessage):
+ (WebKit::NetworkProcess::downloadsAuthenticationManager):
+ * NetworkProcess/NetworkProcess.h:
+ * UIProcess/Downloads/DownloadProxy.cpp:
+ (WebKit::DownloadProxy::didReceiveAuthenticationChallenge):
+ * WebProcess/Downloads/Download.cpp:
+ (WebKit::Download::didReceiveAuthenticationChallenge):
+ * WebProcess/Downloads/DownloadManager.cpp:
+ (WebKit::DownloadManager::downloadsAuthenticationManager):
+ * WebProcess/Downloads/DownloadManager.h:
+ * WebProcess/Downloads/mac/DownloadMac.mm:
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::downloadsAuthenticationManager):
+ (WebKit::WebProcess::didReceiveSyncMessage):
+ * WebProcess/WebProcess.h:
+
2012-12-16 Huang Dongsung <[email protected]>
Coordinated Graphics: Small refactor of CoordinatedLayerTreeHost and CoordinatedGraphicsLayer.
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp (137863 => 137864)
--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp 2012-12-17 02:10:28 UTC (rev 137863)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp 2012-12-17 02:14:19 UTC (rev 137864)
@@ -54,6 +54,7 @@
NetworkProcess::NetworkProcess()
: m_hasSetCacheModel(false)
, m_cacheModel(CacheModelDocumentViewer)
+ , m_downloadsAuthenticationManager(m_messageReceiverMap)
{
}
@@ -74,6 +75,8 @@
m_uiConnection = CoreIPC::Connection::createClientConnection(serverIdentifier, this, runLoop);
m_uiConnection->setDidCloseOnConnectionWorkQueueCallback(didCloseOnConnectionWorkQueue);
m_uiConnection->open();
+
+ m_downloadsAuthenticationManager.setConnection(m_uiConnection.get());
}
void NetworkProcess::removeNetworkConnectionToWebProcess(NetworkConnectionToWebProcess* connection)
@@ -91,6 +94,9 @@
void NetworkProcess::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder)
{
+ if (m_messageReceiverMap.dispatchMessage(connection, messageID, decoder))
+ return;
+
#if ENABLE(CUSTOM_PROTOCOLS)
if (messageID.is<CoreIPC::MessageClassCustomProtocolManager>()) {
CustomProtocolManager::shared().didReceiveMessage(connection, messageID, decoder);
@@ -101,6 +107,11 @@
didReceiveNetworkProcessMessage(connection, messageID, decoder);
}
+void NetworkProcess::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder, OwnPtr<CoreIPC::MessageEncoder>& replyEncoder)
+{
+ m_messageReceiverMap.dispatchSyncMessage(connection, messageID, decoder, replyEncoder);
+}
+
void NetworkProcess::didClose(CoreIPC::Connection*)
{
// The UIProcess just crashed.
@@ -127,6 +138,11 @@
return m_uiConnection.get();
}
+AuthenticationManager& NetworkProcess::downloadsAuthenticationManager()
+{
+ return m_downloadsAuthenticationManager;
+}
+
void NetworkProcess::initializeNetworkProcess(const NetworkProcessCreationParameters& parameters)
{
#if !LOG_DISABLED
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h (137863 => 137864)
--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h 2012-12-17 02:10:28 UTC (rev 137863)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h 2012-12-17 02:14:19 UTC (rev 137864)
@@ -28,9 +28,11 @@
#if ENABLE(NETWORK_PROCESS)
+#include "AuthenticationManager.h"
#include "CacheModel.h"
#include "ChildProcess.h"
#include "DownloadManager.h"
+#include "MessageReceiverMap.h"
#include "NetworkResourceLoadScheduler.h"
#include <wtf/Forward.h>
@@ -67,6 +69,7 @@
// CoreIPC::Connection::Client
virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&) OVERRIDE;
+ virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&, OwnPtr<CoreIPC::MessageEncoder>&);
virtual void didClose(CoreIPC::Connection*) OVERRIDE;
virtual void didReceiveInvalidMessage(CoreIPC::Connection*, CoreIPC::StringReference messageReceiverName, CoreIPC::StringReference messageName) OVERRIDE;
@@ -74,6 +77,7 @@
virtual void didCreateDownload() OVERRIDE;
virtual void didDestroyDownload() OVERRIDE;
virtual CoreIPC::Connection* downloadProxyConnection() OVERRIDE;
+ virtual AuthenticationManager& downloadsAuthenticationManager() OVERRIDE;
// Message Handlers
void didReceiveNetworkProcessMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);
@@ -95,6 +99,8 @@
// The connection to the UI process.
RefPtr<CoreIPC::Connection> m_uiConnection;
+ CoreIPC::MessageReceiverMap m_messageReceiverMap;
+
// Connections to WebProcesses.
Vector<RefPtr<NetworkConnectionToWebProcess> > m_webProcessConnections;
@@ -103,6 +109,8 @@
String m_diskCacheDirectory;
bool m_hasSetCacheModel;
CacheModel m_cacheModel;
+
+ AuthenticationManager m_downloadsAuthenticationManager;
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp (137863 => 137864)
--- trunk/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp 2012-12-17 02:10:28 UTC (rev 137863)
+++ trunk/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp 2012-12-17 02:14:19 UTC (rev 137864)
@@ -122,10 +122,20 @@
if (!m_webContext)
return;
- // FIXME (Multi-WebProcess): <rdar://problem/12239483> Downloads shouldn't be handled in the web process.
- // Once this is fixed, remove WebContext::deprecatedSharedProcess().
-
- RefPtr<AuthenticationChallengeProxy> authenticationChallengeProxy = AuthenticationChallengeProxy::create(authenticationChallenge, challengeID, m_webContext->deprecatedSharedProcess()->connection());
+ RefPtr<CoreIPC::Connection> connection;
+
+ if (m_webContext->usesNetworkProcess()) {
+#if ENABLE(NETWORK_PROCESS)
+ if (NetworkProcessProxy* networkProcess = m_webContext->networkProcess())
+ connection = networkProcess->connection();
+#endif
+ } else {
+ // FIXME: Remove WebContext::deprecatedSharedProcess().
+ connection = m_webContext->deprecatedSharedProcess()->connection();
+ }
+
+ RefPtr<AuthenticationChallengeProxy> authenticationChallengeProxy = AuthenticationChallengeProxy::create(authenticationChallenge, challengeID, connection.get());
+
m_webContext->downloadClient().didReceiveAuthenticationChallenge(m_webContext.get(), this, authenticationChallengeProxy.get());
}
Modified: trunk/Source/WebKit2/WebProcess/Downloads/Download.cpp (137863 => 137864)
--- trunk/Source/WebKit2/WebProcess/Downloads/Download.cpp 2012-12-17 02:10:28 UTC (rev 137863)
+++ trunk/Source/WebKit2/WebProcess/Downloads/Download.cpp 2012-12-17 02:14:19 UTC (rev 137864)
@@ -79,7 +79,7 @@
void Download::didReceiveAuthenticationChallenge(const AuthenticationChallenge& authenticationChallenge)
{
-// AuthenticationManager::shared().didReceiveAuthenticationChallenge(this, authenticationChallenge);
+ m_downloadManager.downloadsAuthenticationManager().didReceiveAuthenticationChallenge(this, authenticationChallenge);
}
void Download::didReceiveResponse(const ResourceResponse& response)
Modified: trunk/Source/WebKit2/WebProcess/Downloads/DownloadManager.cpp (137863 => 137864)
--- trunk/Source/WebKit2/WebProcess/Downloads/DownloadManager.cpp 2012-12-17 02:10:28 UTC (rev 137863)
+++ trunk/Source/WebKit2/WebProcess/Downloads/DownloadManager.cpp 2012-12-17 02:14:19 UTC (rev 137864)
@@ -88,6 +88,11 @@
return m_client->downloadProxyConnection();
}
+AuthenticationManager& DownloadManager::downloadsAuthenticationManager()
+{
+ return m_client->downloadsAuthenticationManager();
+}
+
#if PLATFORM(QT)
void DownloadManager::startTransfer(uint64_t downloadID, const String& destination)
{
Modified: trunk/Source/WebKit2/WebProcess/Downloads/DownloadManager.h (137863 => 137864)
--- trunk/Source/WebKit2/WebProcess/Downloads/DownloadManager.h 2012-12-17 02:10:28 UTC (rev 137863)
+++ trunk/Source/WebKit2/WebProcess/Downloads/DownloadManager.h 2012-12-17 02:14:19 UTC (rev 137864)
@@ -42,6 +42,7 @@
namespace WebKit {
+class AuthenticationManager;
class Download;
class WebPage;
@@ -55,9 +56,8 @@
virtual void didCreateDownload() = 0;
virtual void didDestroyDownload() = 0;
-
- // This is the connection where DownloadProxy messages should be sent.
virtual CoreIPC::Connection* downloadProxyConnection() = 0;
+ virtual AuthenticationManager& downloadsAuthenticationManager() = 0;
};
explicit DownloadManager(Client*);
@@ -74,6 +74,7 @@
void didDestroyDownload();
CoreIPC::Connection* downloadProxyConnection();
+ AuthenticationManager& downloadsAuthenticationManager();
#if PLATFORM(QT)
void startTransfer(uint64_t downloadID, const String& destination);
Modified: trunk/Source/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm (137863 => 137864)
--- trunk/Source/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm 2012-12-17 02:10:28 UTC (rev 137863)
+++ trunk/Source/WebKit2/WebProcess/Downloads/mac/DownloadMac.mm 2012-12-17 02:14:19 UTC (rev 137864)
@@ -109,7 +109,6 @@
{
}
-// FIXME (NetworkProcess): Downloads and their credentials have to go through the NetworkProcess
void Download::receivedCredential(const AuthenticationChallenge& authenticationChallenge, const Credential& credential)
{
[authenticationChallenge.sender() useCredential:mac(credential) forAuthenticationChallenge:authenticationChallenge.nsURLAuthenticationChallenge()];
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (137863 => 137864)
--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2012-12-17 02:10:28 UTC (rev 137863)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2012-12-17 02:14:19 UTC (rev 137864)
@@ -237,6 +237,11 @@
return m_connection.get();
}
+AuthenticationManager& WebProcess::downloadsAuthenticationManager()
+{
+ return m_authenticationManager;
+}
+
void WebProcess::initializeWebProcess(const WebProcessCreationParameters& parameters, CoreIPC::MessageDecoder& decoder)
{
ASSERT(m_pageMap.isEmpty());
@@ -596,7 +601,6 @@
void WebProcess::didReceiveSyncMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder, OwnPtr<CoreIPC::MessageEncoder>& replyEncoder)
{
m_messageReceiverMap.dispatchSyncMessage(connection, messageID, decoder, replyEncoder);
- return;
}
void WebProcess::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder)
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.h (137863 => 137864)
--- trunk/Source/WebKit2/WebProcess/WebProcess.h 2012-12-17 02:10:28 UTC (rev 137863)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.h 2012-12-17 02:14:19 UTC (rev 137864)
@@ -227,6 +227,7 @@
virtual void didCreateDownload() OVERRIDE;
virtual void didDestroyDownload() OVERRIDE;
virtual CoreIPC::Connection* downloadProxyConnection() OVERRIDE;
+ virtual AuthenticationManager& downloadsAuthenticationManager() OVERRIDE;
void initializeWebProcess(const WebProcessCreationParameters&, CoreIPC::MessageDecoder&);
void platformInitializeWebProcess(const WebProcessCreationParameters&, CoreIPC::MessageDecoder&);