Title: [140874] trunk/Source/WebKit2
Revision
140874
Author
[email protected]
Date
2013-01-25 16:03:48 -0800 (Fri, 25 Jan 2013)

Log Message

HTTP Authentication should be directly between the NetworkProcess and the UIProcess
<rdar://problem/13074829> and https://bugs.webkit.org/show_bug.cgi?id=107974

Reviewed by Alexey Proskuryakov.

Some of this patch is refactoring to enable more flexibility in the authentication mechanism
and the rest is actually implementing Network->UI process authentication.

Expose the same AuthenticationManager to anyone in the NetworkProcess asking for it:
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::authenticationManager):
(WebKit::NetworkProcess::downloadsAuthenticationManager):
* NetworkProcess/NetworkProcess.h:

* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::didReceiveAuthenticationChallenge): Instead of messaging to
  the WebProcess, tell the NetworkProcess AuthenticationManager.

Add WebPageID and WebFrameID members to SchedulableLoader that they receive from
* NetworkProcess/SchedulableLoader.cpp:
* NetworkProcess/SchedulableLoader.h:
(WebKit::SchedulableLoader::webPageID):
(WebKit::SchedulableLoader::webFrameID):

Add a 3rd form of "didReceiveAuthenticationChallenge" for NetworkProcess use:
* Shared/Authentication/AuthenticationManager.cpp:
(WebKit::AuthenticationManager::mapChallengeToIdentifier):
(WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
* Shared/Authentication/AuthenticationManager.h:
* Shared/Authentication/mac/AuthenticationManager.mac.mm:
(WebKit::AuthenticationManager::tryUsePlatformCertificateInfoForChallenge): Remove a now obsolete comment

Include the WebPage and WebFrame ID for the originator of this request in case it results in a challenge:
* Shared/Network/NetworkResourceLoadParameters.cpp:
(WebKit::NetworkResourceLoadParameters::NetworkResourceLoadParameters):
(WebKit::NetworkResourceLoadParameters::encode):
(WebKit::NetworkResourceLoadParameters::decode):
* Shared/Network/NetworkResourceLoadParameters.h:
(WebKit::NetworkResourceLoadParameters::webPageID):
(WebKit::NetworkResourceLoadParameters::webFrameID):

Create a AuthenticationChallengeProxy pointing back to the NetworkProcess (instead of a WebProcess),
and send the challenge to the appropriate WebPageProxy:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/Network/NetworkProcessProxy.messages.in:

Refactor didReceiveAuthenticationChallenge so an outsider can directly hand over an AuthenticationChallengeProxy:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didReceiveAuthenticationChallenge):
(WebKit::WebPageProxy::didReceiveAuthenticationChallengeProxy):
* UIProcess/WebPageProxy.h:

Add a global WebPageID -> WebPageProxy map so parties with an ID don't need to know which process it belongs to:
* UIProcess/WebProcessProxy.cpp:
(WebKit::globalPageMap):
(WebKit::WebProcessProxy::webPage):
(WebKit::WebProcessProxy::createWebPage):
(WebKit::WebProcessProxy::addExistingWebPage):
(WebKit::WebProcessProxy::removeWebPage):
* UIProcess/WebProcessProxy.h:

* WebProcess/Network/WebResourceLoadScheduler.cpp:
(WebKit::WebResourceLoadScheduler::scheduleLoad):

* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::loadResourceSynchronously): Pass 0 for WebFrameID and WebPageID since synchronous
  loads don't go through "normal" authentication channels and don't need them. Yet.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (140873 => 140874)


--- trunk/Source/WebKit2/ChangeLog	2013-01-25 23:56:07 UTC (rev 140873)
+++ trunk/Source/WebKit2/ChangeLog	2013-01-26 00:03:48 UTC (rev 140874)
@@ -1,3 +1,75 @@
+2013-01-25  Brady Eidson  <[email protected]>
+
+        HTTP Authentication should be directly between the NetworkProcess and the UIProcess
+        <rdar://problem/13074829> and https://bugs.webkit.org/show_bug.cgi?id=107974
+
+        Reviewed by Alexey Proskuryakov.
+
+        Some of this patch is refactoring to enable more flexibility in the authentication mechanism
+        and the rest is actually implementing Network->UI process authentication.
+
+        Expose the same AuthenticationManager to anyone in the NetworkProcess asking for it:
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::authenticationManager):
+        (WebKit::NetworkProcess::downloadsAuthenticationManager):
+        * NetworkProcess/NetworkProcess.h:
+
+        * NetworkProcess/NetworkResourceLoader.cpp:
+        (WebKit::NetworkResourceLoader::didReceiveAuthenticationChallenge): Instead of messaging to
+          the WebProcess, tell the NetworkProcess AuthenticationManager.
+
+        Add WebPageID and WebFrameID members to SchedulableLoader that they receive from 
+        * NetworkProcess/SchedulableLoader.cpp:
+        * NetworkProcess/SchedulableLoader.h:
+        (WebKit::SchedulableLoader::webPageID):
+        (WebKit::SchedulableLoader::webFrameID):
+
+        Add a 3rd form of "didReceiveAuthenticationChallenge" for NetworkProcess use:
+        * Shared/Authentication/AuthenticationManager.cpp:
+        (WebKit::AuthenticationManager::mapChallengeToIdentifier):
+        (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
+        * Shared/Authentication/AuthenticationManager.h:
+        * Shared/Authentication/mac/AuthenticationManager.mac.mm:
+        (WebKit::AuthenticationManager::tryUsePlatformCertificateInfoForChallenge): Remove a now obsolete comment
+
+        Include the WebPage and WebFrame ID for the originator of this request in case it results in a challenge:
+        * Shared/Network/NetworkResourceLoadParameters.cpp:
+        (WebKit::NetworkResourceLoadParameters::NetworkResourceLoadParameters):
+        (WebKit::NetworkResourceLoadParameters::encode):
+        (WebKit::NetworkResourceLoadParameters::decode):
+        * Shared/Network/NetworkResourceLoadParameters.h:
+        (WebKit::NetworkResourceLoadParameters::webPageID):
+        (WebKit::NetworkResourceLoadParameters::webFrameID):
+
+        Create a AuthenticationChallengeProxy pointing back to the NetworkProcess (instead of a WebProcess),
+        and send the challenge to the appropriate WebPageProxy:
+        * UIProcess/Network/NetworkProcessProxy.cpp:
+        (WebKit::NetworkProcessProxy::didReceiveAuthenticationChallenge):
+        * UIProcess/Network/NetworkProcessProxy.h:
+        * UIProcess/Network/NetworkProcessProxy.messages.in:
+
+        Refactor didReceiveAuthenticationChallenge so an outsider can directly hand over an AuthenticationChallengeProxy:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::didReceiveAuthenticationChallenge):
+        (WebKit::WebPageProxy::didReceiveAuthenticationChallengeProxy):
+        * UIProcess/WebPageProxy.h:
+
+        Add a global WebPageID -> WebPageProxy map so parties with an ID don't need to know which process it belongs to:
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::globalPageMap):
+        (WebKit::WebProcessProxy::webPage):
+        (WebKit::WebProcessProxy::createWebPage):
+        (WebKit::WebProcessProxy::addExistingWebPage):
+        (WebKit::WebProcessProxy::removeWebPage):
+        * UIProcess/WebProcessProxy.h:
+
+        * WebProcess/Network/WebResourceLoadScheduler.cpp:
+        (WebKit::WebResourceLoadScheduler::scheduleLoad):
+
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
+        (WebKit::WebPlatformStrategies::loadResourceSynchronously): Pass 0 for WebFrameID and WebPageID since synchronous
+          loads don't go through "normal" authentication channels and don't need them. Yet.
+
 2013-01-25  Alexey Proskuryakov  <[email protected]>
 
         <rdar://problem/13089261> Crash in WKSandboxExtensionGetSerializedFormat when opening Web Inspector

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp (140873 => 140874)


--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp	2013-01-25 23:56:07 UTC (rev 140873)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp	2013-01-26 00:03:48 UTC (rev 140874)
@@ -70,6 +70,11 @@
 {
 }
 
+AuthenticationManager& NetworkProcess::authenticationManager()
+{
+    return *supplement<AuthenticationManager>();
+}
+
 DownloadManager& NetworkProcess::downloadManager()
 {
     DEFINE_STATIC_LOCAL(DownloadManager, downloadManager, (this));
@@ -131,7 +136,7 @@
 
 AuthenticationManager& NetworkProcess::downloadsAuthenticationManager()
 {
-    return *supplement<AuthenticationManager>();
+    return authenticationManager();
 }
 
 void NetworkProcess::initializeNetworkProcess(const NetworkProcessCreationParameters& parameters)

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h (140873 => 140874)


--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h	2013-01-25 23:56:07 UTC (rev 140873)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h	2013-01-26 00:03:48 UTC (rev 140874)
@@ -68,6 +68,7 @@
 
     NetworkResourceLoadScheduler& networkResourceLoadScheduler() { return m_networkResourceLoadScheduler; }
 
+    AuthenticationManager& authenticationManager();
     DownloadManager& downloadManager();
 
 private:

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp (140873 => 140874)


--- trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp	2013-01-25 23:56:07 UTC (rev 140873)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp	2013-01-26 00:03:48 UTC (rev 140874)
@@ -28,6 +28,7 @@
 
 #if ENABLE(NETWORK_PROCESS)
 
+#include "AuthenticationManager.h"
 #include "DataReference.h"
 #include "Logging.h"
 #include "NetworkConnectionToWebProcess.h"
@@ -230,7 +231,7 @@
     ASSERT(!m_currentAuthenticationChallenge);
     m_currentAuthenticationChallenge = adoptPtr(new AuthenticationChallenge(challenge));
 
-    send(Messages::WebResourceLoader::DidReceiveAuthenticationChallenge(*m_currentAuthenticationChallenge));
+    NetworkProcess::shared().authenticationManager().didReceiveAuthenticationChallenge(webPageID(), webFrameID(), *m_currentAuthenticationChallenge);
 }
 
 void NetworkResourceLoader::didCancelAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge& challenge)

Modified: trunk/Source/WebKit2/NetworkProcess/SchedulableLoader.cpp (140873 => 140874)


--- trunk/Source/WebKit2/NetworkProcess/SchedulableLoader.cpp	2013-01-25 23:56:07 UTC (rev 140873)
+++ trunk/Source/WebKit2/NetworkProcess/SchedulableLoader.cpp	2013-01-26 00:03:48 UTC (rev 140874)
@@ -32,6 +32,8 @@
 
 SchedulableLoader::SchedulableLoader(const NetworkResourceLoadParameters& parameters, NetworkConnectionToWebProcess* connection)
     : m_identifier(parameters.identifier())
+    , m_webPageID(parameters.webPageID())
+    , m_webFrameID(parameters.webFrameID())
     , m_request(parameters.request())
     , m_priority(parameters.priority())
     , m_contentSniffingPolicy(parameters.contentSniffingPolicy())

Modified: trunk/Source/WebKit2/NetworkProcess/SchedulableLoader.h (140873 => 140874)


--- trunk/Source/WebKit2/NetworkProcess/SchedulableLoader.h	2013-01-25 23:56:07 UTC (rev 140873)
+++ trunk/Source/WebKit2/NetworkProcess/SchedulableLoader.h	2013-01-26 00:03:48 UTC (rev 140874)
@@ -41,6 +41,8 @@
     virtual ~SchedulableLoader();
 
     ResourceLoadIdentifier identifier() const { return m_identifier; }
+    uint64_t webPageID() const { return m_webPageID; }
+    uint64_t webFrameID() const { return m_webFrameID; }
     const WebCore::ResourceRequest& request() const { return m_request; }
     WebCore::ResourceLoadPriority priority() const { return m_priority; }
     WebCore::ContentSniffingPolicy contentSniffingPolicy() const { return m_contentSniffingPolicy; }
@@ -65,6 +67,8 @@
 
 private:
     ResourceLoadIdentifier m_identifier;
+    uint64_t m_webPageID;
+    uint64_t m_webFrameID;
     WebCore::ResourceRequest m_request;
     WebCore::ResourceLoadPriority m_priority;
     WebCore::ContentSniffingPolicy m_contentSniffingPolicy;

Modified: trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.cpp (140873 => 140874)


--- trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.cpp	2013-01-25 23:56:07 UTC (rev 140873)
+++ trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.cpp	2013-01-26 00:03:48 UTC (rev 140874)
@@ -36,15 +36,20 @@
 #include "WebPageProxyMessages.h"
 #include <WebCore/AuthenticationChallenge.h>
 #include <WebCore/AuthenticationClient.h>
+#include <wtf/Atomics.h>
 
+#if ENABLE(NETWORK_PROCESS)
+#include "NetworkProcessProxyMessages.h"
+#endif
+
 using namespace WebCore;
 
 namespace WebKit {
 
 static uint64_t generateAuthenticationChallengeID()
 {
-    static uint64_t uniqueAuthenticationChallengeID = 1;
-    return uniqueAuthenticationChallengeID++;
+    static int64_t uniqueAuthenticationChallengeID;
+    return atomicIncrement(&uniqueAuthenticationChallengeID);
 }
 
 const AtomicString& AuthenticationManager::supplementName()
@@ -64,23 +69,34 @@
     didReceiveAuthenticationManagerMessage(connection, messageID, decoder);
 }
 
+uint64_t AuthenticationManager::establishIdentifierForChallenge(const WebCore::AuthenticationChallenge& authenticationChallenge)
+{
+    uint64_t challengeID = generateAuthenticationChallengeID();
+    m_challenges.set(challengeID, authenticationChallenge);
+    return challengeID;
+}
+
 void AuthenticationManager::didReceiveAuthenticationChallenge(WebFrame* frame, const AuthenticationChallenge& authenticationChallenge)
 {
     ASSERT(frame);
     ASSERT(frame->page());
+    
+    m_process->send(Messages::WebPageProxy::DidReceiveAuthenticationChallenge(frame->frameID(), authenticationChallenge, establishIdentifierForChallenge(authenticationChallenge)), frame->page()->pageID());
+}
 
-    uint64_t challengeID = generateAuthenticationChallengeID();
-    m_challenges.set(challengeID, authenticationChallenge);    
+#if ENABLE(NETWORK_PROCESS)
+void AuthenticationManager::didReceiveAuthenticationChallenge(uint64_t pageID, uint64_t frameID, const AuthenticationChallenge& authenticationChallenge)
+{
+    ASSERT(pageID);
+    ASSERT(frameID);
     
-    m_process->send(Messages::WebPageProxy::DidReceiveAuthenticationChallenge(frame->frameID(), authenticationChallenge, challengeID), frame->page()->pageID());
+    m_process->send(Messages::NetworkProcessProxy::DidReceiveAuthenticationChallenge(pageID, frameID, authenticationChallenge, establishIdentifierForChallenge(authenticationChallenge)));
 }
+#endif
 
 void AuthenticationManager::didReceiveAuthenticationChallenge(Download* download, const AuthenticationChallenge& authenticationChallenge)
 {
-    uint64_t challengeID = generateAuthenticationChallengeID();
-    m_challenges.set(challengeID, authenticationChallenge);
-
-    download->send(Messages::DownloadProxy::DidReceiveAuthenticationChallenge(authenticationChallenge, challengeID));
+    download->send(Messages::DownloadProxy::DidReceiveAuthenticationChallenge(authenticationChallenge, establishIdentifierForChallenge(authenticationChallenge)));
 }
 
 // Currently, only Mac knows how to respond to authentication challenges with certificate info.

Modified: trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.h (140873 => 140874)


--- trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.h	2013-01-25 23:56:07 UTC (rev 140873)
+++ trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.h	2013-01-26 00:03:48 UTC (rev 140874)
@@ -52,7 +52,11 @@
 
     static const AtomicString& supplementName();
 
+    // Called for resources in the WebProcess (NetworkProcess disabled)
     void didReceiveAuthenticationChallenge(WebFrame*, const WebCore::AuthenticationChallenge&);
+    // Called for resources in the NetworkProcess (NetworkProcess enabled)
+    void didReceiveAuthenticationChallenge(uint64_t pageID, uint64_t frameID, const WebCore::AuthenticationChallenge&);
+    // Called for downloads with or without the NetworkProcess
     void didReceiveAuthenticationChallenge(Download*, const WebCore::AuthenticationChallenge&);
 
     void useCredentialForChallenge(uint64_t challengeID, const WebCore::Credential&, const PlatformCertificateInfo&);
@@ -66,6 +70,8 @@
 
     bool tryUsePlatformCertificateInfoForChallenge(const WebCore::AuthenticationChallenge&, const PlatformCertificateInfo&);
 
+    uint64_t establishIdentifierForChallenge(const WebCore::AuthenticationChallenge&);
+
     ChildProcess* m_process;
 
     typedef HashMap<uint64_t, WebCore::AuthenticationChallenge> AuthenticationChallengeMap;

Modified: trunk/Source/WebKit2/Shared/Authentication/mac/AuthenticationManager.mac.mm (140873 => 140874)


--- trunk/Source/WebKit2/Shared/Authentication/mac/AuthenticationManager.mac.mm	2013-01-25 23:56:07 UTC (rev 140873)
+++ trunk/Source/WebKit2/Shared/Authentication/mac/AuthenticationManager.mac.mm	2013-01-26 00:03:48 UTC (rev 140874)
@@ -38,9 +38,6 @@
 
 bool AuthenticationManager::tryUsePlatformCertificateInfoForChallenge(const AuthenticationChallenge& challenge, const PlatformCertificateInfo& certificateInfo)
 {
-    // FIXME (NetworkProcess): This occurs in the WebProcess and therefore won't work.
-    // We need this to happen in the NetworkProcess.
-
     CFArrayRef chain = certificateInfo.certificateChain();
     if (!chain)
         return false;

Modified: trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.cpp (140873 => 140874)


--- trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.cpp	2013-01-25 23:56:07 UTC (rev 140873)
+++ trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.cpp	2013-01-26 00:03:48 UTC (rev 140874)
@@ -38,15 +38,20 @@
 
 namespace WebKit {
 NetworkResourceLoadParameters::NetworkResourceLoadParameters()
-    : m_priority(ResourceLoadPriorityVeryLow)
+    : m_identifier(0)
+    , m_webPageID(0)
+    , m_webFrameID(0)
+    , m_priority(ResourceLoadPriorityVeryLow)
     , m_contentSniffingPolicy(SniffContent)
     , m_allowStoredCredentials(DoNotAllowStoredCredentials)
     , m_inPrivateBrowsingMode(false)
 {
 }
 
-NetworkResourceLoadParameters::NetworkResourceLoadParameters(ResourceLoadIdentifier identifier, const ResourceRequest& request, ResourceLoadPriority priority, ContentSniffingPolicy contentSniffingPolicy, StoredCredentials allowStoredCredentials, bool inPrivateBrowsingMode)
+NetworkResourceLoadParameters::NetworkResourceLoadParameters(ResourceLoadIdentifier identifier, uint64_t webPageID, uint64_t webFrameID, const ResourceRequest& request, ResourceLoadPriority priority, ContentSniffingPolicy contentSniffingPolicy, StoredCredentials allowStoredCredentials, bool inPrivateBrowsingMode)
     : m_identifier(identifier)
+    , m_webPageID(webPageID)
+    , m_webFrameID(webFrameID)
     , m_request(request)
     , m_priority(priority)
     , m_contentSniffingPolicy(contentSniffingPolicy)
@@ -58,6 +63,8 @@
 void NetworkResourceLoadParameters::encode(CoreIPC::ArgumentEncoder& encoder) const
 {
     encoder.encode(m_identifier);
+    encoder.encode(m_webPageID);
+    encoder.encode(m_webFrameID);
     encoder.encode(m_request);
 
     encoder.encode(static_cast<bool>(m_request.httpBody()));
@@ -103,6 +110,12 @@
     if (!decoder->decode(result.m_identifier))
         return false;
 
+    if (!decoder->decode(result.m_webPageID))
+        return false;
+
+    if (!decoder->decode(result.m_webFrameID))
+        return false;
+
     if (!decoder->decode(result.m_request))
         return false;
 

Modified: trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.h (140873 => 140874)


--- trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.h	2013-01-25 23:56:07 UTC (rev 140873)
+++ trunk/Source/WebKit2/Shared/Network/NetworkResourceLoadParameters.h	2013-01-26 00:03:48 UTC (rev 140874)
@@ -45,12 +45,14 @@
 class NetworkResourceLoadParameters {
 public:
     NetworkResourceLoadParameters();
-    NetworkResourceLoadParameters(ResourceLoadIdentifier, const WebCore::ResourceRequest&, WebCore::ResourceLoadPriority, WebCore::ContentSniffingPolicy, WebCore::StoredCredentials, bool inPrivateBrowsingMode);
+    NetworkResourceLoadParameters(ResourceLoadIdentifier, uint64_t webPageID, uint64_t webFrameID, const WebCore::ResourceRequest&, WebCore::ResourceLoadPriority, WebCore::ContentSniffingPolicy, WebCore::StoredCredentials, bool inPrivateBrowsingMode);
 
     void encode(CoreIPC::ArgumentEncoder&) const;
     static bool decode(CoreIPC::ArgumentDecoder*, NetworkResourceLoadParameters&);
 
     ResourceLoadIdentifier identifier() const { return m_identifier; }
+    uint64_t webPageID() const { return m_webPageID; }
+    uint64_t webFrameID() const { return m_webFrameID; }
     const WebCore::ResourceRequest& request() const { return m_request; }
     const SandboxExtension::HandleArray& requestBodySandboxExtensions() const { return m_requestBodySandboxExtensions; }
     const SandboxExtension::Handle& resourceSandboxExtension() const { return m_resourceSandboxExtension; }
@@ -61,6 +63,8 @@
 
 private:
     ResourceLoadIdentifier m_identifier;
+    uint64_t m_webPageID;
+    uint64_t m_webFrameID;
     WebCore::ResourceRequest m_request;
     SandboxExtension::HandleArray m_requestBodySandboxExtensions; // Created automatically for the sender.
     SandboxExtension::Handle m_resourceSandboxExtension; // Created automatically for the sender.

Modified: trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp (140873 => 140874)


--- trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp	2013-01-25 23:56:07 UTC (rev 140873)
+++ trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp	2013-01-26 00:03:48 UTC (rev 140874)
@@ -28,6 +28,7 @@
 
 #if ENABLE(NETWORK_PROCESS)
 
+#include "AuthenticationChallengeProxy.h"
 #include "DownloadProxyMessages.h"
 #include "NetworkProcessCreationParameters.h"
 #include "NetworkProcessMessages.h"
@@ -39,6 +40,8 @@
 #include "SecItemShimProxy.h"
 #endif
 
+#define MESSAGE_CHECK(assertion) MESSAGE_CHECK_BASE(assertion, connection())
+
 using namespace WebCore;
 
 namespace WebKit {
@@ -165,6 +168,15 @@
 #endif
 }
 
+void NetworkProcessProxy::didReceiveAuthenticationChallenge(uint64_t pageID, uint64_t frameID, const WebCore::AuthenticationChallenge& coreChallenge, uint64_t challengeID)
+{
+    WebPageProxy* page = WebProcessProxy::webPage(pageID);
+    MESSAGE_CHECK(page);
+
+    RefPtr<AuthenticationChallengeProxy> authenticationChallenge = AuthenticationChallengeProxy::create(coreChallenge, challengeID, connection());
+    page->didReceiveAuthenticationChallengeProxy(frameID, authenticationChallenge.release());
+}
+
 void NetworkProcessProxy::didFinishLaunching(ProcessLauncher* launcher, CoreIPC::Connection::Identifier connectionIdentifier)
 {
     ChildProcessProxy::didFinishLaunching(launcher, connectionIdentifier);

Modified: trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h (140873 => 140874)


--- trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h	2013-01-25 23:56:07 UTC (rev 140873)
+++ trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h	2013-01-26 00:03:48 UTC (rev 140874)
@@ -39,6 +39,10 @@
 #include "CustomProtocolManagerProxy.h"
 #endif
 
+namespace WebCore {
+class AuthenticationChallenge;
+}
+
 namespace WebKit {
 
 class DownloadProxy;
@@ -75,7 +79,8 @@
     // Message handlers
     void didReceiveNetworkProcessProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::MessageDecoder&);
     void didCreateNetworkConnectionToWebProcess(const CoreIPC::Attachment&);
-    
+    void didReceiveAuthenticationChallenge(uint64_t pageID, uint64_t frameID, const WebCore::AuthenticationChallenge&, uint64_t challengeID);
+
     // ProcessLauncher::Client
     virtual void didFinishLaunching(ProcessLauncher*, CoreIPC::Connection::Identifier);
 

Modified: trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.messages.in (140873 => 140874)


--- trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.messages.in	2013-01-25 23:56:07 UTC (rev 140873)
+++ trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.messages.in	2013-01-26 00:03:48 UTC (rev 140874)
@@ -24,6 +24,8 @@
 
 messages -> NetworkProcessProxy LegacyReceiver {
     DidCreateNetworkConnectionToWebProcess(CoreIPC::Attachment connectionIdentifier)
+
+    DidReceiveAuthenticationChallenge(uint64_t pageID, uint64_t frameID, WebCore::AuthenticationChallenge challenge, uint64_t challengeID)
 }
 
 #endif // ENABLE(NETWORK_PROCESS)

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (140873 => 140874)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2013-01-25 23:56:07 UTC (rev 140873)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2013-01-26 00:03:48 UTC (rev 140874)
@@ -3848,11 +3848,17 @@
 
 void WebPageProxy::didReceiveAuthenticationChallenge(uint64_t frameID, const AuthenticationChallenge& coreChallenge, uint64_t challengeID)
 {
+    didReceiveAuthenticationChallengeProxy(frameID, AuthenticationChallengeProxy::create(coreChallenge, challengeID, m_process->connection()));
+}
+
+void WebPageProxy::didReceiveAuthenticationChallengeProxy(uint64_t frameID, PassRefPtr<AuthenticationChallengeProxy> prpAuthenticationChallenge)
+{
+    ASSERT(prpAuthenticationChallenge);
+
     WebFrameProxy* frame = m_process->webFrame(frameID);
     MESSAGE_CHECK(frame);
 
-    RefPtr<AuthenticationChallengeProxy> authenticationChallenge = AuthenticationChallengeProxy::create(coreChallenge, challengeID, m_process->connection());
-    
+    RefPtr<AuthenticationChallengeProxy> authenticationChallenge = prpAuthenticationChallenge;
     m_loaderClient.didReceiveAuthenticationChallengeInFrame(this, frame, authenticationChallenge.get());
 }
 

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (140873 => 140874)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2013-01-25 23:56:07 UTC (rev 140873)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2013-01-26 00:03:48 UTC (rev 140874)
@@ -757,6 +757,8 @@
     bool mainFrameInViewSourceMode() const { return m_mainFrameInViewSourceMode; }
     void setMainFrameInViewSourceMode(bool);
 
+    void didReceiveAuthenticationChallengeProxy(uint64_t frameID, PassRefPtr<AuthenticationChallengeProxy>);
+
 private:
     WebPageProxy(PageClient*, PassRefPtr<WebProcessProxy>, WebPageGroup*, uint64_t pageID);
 

Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp (140873 => 140874)


--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp	2013-01-25 23:56:07 UTC (rev 140873)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp	2013-01-26 00:03:48 UTC (rev 140874)
@@ -77,6 +77,13 @@
     return uniquePageID++;
 }
 
+static WebProcessProxy::WebPageProxyMap& globalPageMap()
+{
+    ASSERT(isMainThread());
+    DEFINE_STATIC_LOCAL(WebProcessProxy::WebPageProxyMap, pageMap, ());
+    return pageMap;
+}
+
 #if ENABLE(NETSCAPE_PLUGIN_API)
 static WorkQueue& pluginWorkQueue()
 {
@@ -153,9 +160,9 @@
     m_messageReceiverMap.removeMessageReceiver(messageReceiverName, destinationID);
 }
 
-WebPageProxy* WebProcessProxy::webPage(uint64_t pageID) const
+WebPageProxy* WebProcessProxy::webPage(uint64_t pageID)
 {
-    return m_pageMap.get(pageID);
+    return globalPageMap().get(pageID);
 }
 
 PassRefPtr<WebPageProxy> WebProcessProxy::createWebPage(PageClient* pageClient, WebContext*, WebPageGroup* pageGroup)
@@ -163,17 +170,21 @@
     uint64_t pageID = generatePageID();
     RefPtr<WebPageProxy> webPage = WebPageProxy::create(pageClient, this, pageGroup, pageID);
     m_pageMap.set(pageID, webPage.get());
+    globalPageMap().set(pageID, webPage.get());
     return webPage.release();
 }
 
 void WebProcessProxy::addExistingWebPage(WebPageProxy* webPage, uint64_t pageID)
 {
     m_pageMap.set(pageID, webPage);
+    globalPageMap().set(pageID, webPage);
 }
 
 void WebProcessProxy::removeWebPage(uint64_t pageID)
 {
     m_pageMap.remove(pageID);
+    globalPageMap().remove(pageID);
+
 }
 
 Vector<WebPageProxy*> WebProcessProxy::pages() const

Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.h (140873 => 140874)


--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.h	2013-01-25 23:56:07 UTC (rev 140873)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.h	2013-01-26 00:03:48 UTC (rev 140874)
@@ -59,8 +59,9 @@
 
 class WebProcessProxy : public ThreadSafeRefCounted<WebProcessProxy>, public ChildProcessProxy, ResponsivenessTimer::Client, CoreIPC::Connection::QueueClient {
 public:
+    typedef HashMap<uint64_t, RefPtr<WebBackForwardListItem> > WebBackForwardListItemMap;
     typedef HashMap<uint64_t, RefPtr<WebFrameProxy> > WebFrameProxyMap;
-    typedef HashMap<uint64_t, RefPtr<WebBackForwardListItem> > WebBackForwardListItemMap;
+    typedef HashMap<uint64_t, WebPageProxy*> WebPageProxyMap;
 
     static PassRefPtr<WebProcessProxy> create(PassRefPtr<WebContext>);
     ~WebProcessProxy();
@@ -78,7 +79,7 @@
 
     WebContext* context() const { return m_context.get(); }
 
-    WebPageProxy* webPage(uint64_t pageID) const;
+    static WebPageProxy* webPage(uint64_t pageID);
     PassRefPtr<WebPageProxy> createWebPage(PageClient*, WebContext*, WebPageGroup*);
     void addExistingWebPage(WebPageProxy*, uint64_t pageID);
     void removeWebPage(uint64_t pageID);
@@ -187,7 +188,7 @@
     bool m_mayHaveUniversalFileReadSandboxExtension; // True if a read extension for "/" was ever granted - we don't track whether WebProcess still has it.
     HashSet<String> m_localPathsWithAssumedReadAccess;
 
-    HashMap<uint64_t, WebPageProxy*> m_pageMap;
+    WebPageProxyMap m_pageMap;
     WebFrameProxyMap m_frameMap;
     WebBackForwardListItemMap m_backForwardListItemMap;
 

Modified: trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp (140873 => 140874)


--- trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp	2013-01-25 23:56:07 UTC (rev 140873)
+++ trunk/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp	2013-01-26 00:03:48 UTC (rev 140874)
@@ -32,6 +32,9 @@
 #include "NetworkResourceLoadParameters.h"
 #include "WebCoreArgumentCoders.h"
 #include "WebErrors.h"
+#include "WebFrame.h"
+#include "WebFrameLoaderClient.h"
+#include "WebPage.h"
 #include "WebProcess.h"
 #include "WebResourceLoader.h"
 #include <WebCore/DocumentLoader.h>
@@ -97,7 +100,10 @@
     StoredCredentials allowStoredCredentials = resourceLoader->shouldUseCredentialStorage() ? AllowStoredCredentials : DoNotAllowStoredCredentials;
     bool privateBrowsingEnabled = resourceLoader->frameLoader()->frame()->settings()->privateBrowsingEnabled();
 
-    NetworkResourceLoadParameters loadParameters(identifier, resourceLoader->request(), priority, contentSniffingPolicy, allowStoredCredentials, privateBrowsingEnabled);
+    WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(resourceLoader->frameLoader()->client())->webFrame();
+    WebPage* webPage = webFrame->page();
+
+    NetworkResourceLoadParameters loadParameters(identifier, webPage->pageID(), webFrame->frameID(), resourceLoader->request(), priority, contentSniffingPolicy, allowStoredCredentials, privateBrowsingEnabled);
     if (!WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::ScheduleResourceLoad(loadParameters), 0)) {
         // We probably failed to schedule this load with the NetworkProcess because it had crashed.
         // This load will never succeed so we will schedule it to fail asynchronously.

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp (140873 => 140874)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp	2013-01-25 23:56:07 UTC (rev 140873)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp	2013-01-26 00:03:48 UTC (rev 140874)
@@ -228,7 +228,7 @@
 
     CoreIPC::DataReference dataReference;
 
-    NetworkResourceLoadParameters loadParameters(resourceLoadIdentifier, request, ResourceLoadPriorityHighest, SniffContent, storedCredentials, context->storageSession().isPrivateBrowsingSession());
+    NetworkResourceLoadParameters loadParameters(resourceLoadIdentifier, 0, 0, request, ResourceLoadPriorityHighest, SniffContent, storedCredentials, context->storageSession().isPrivateBrowsingSession());
     if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad(loadParameters), Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::Reply(error, response, dataReference), 0)) {
         response = ResourceResponse();
         error = internalError(request.url());
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to