Title: [202511] trunk
Revision
202511
Author
[email protected]
Date
2016-06-27 13:59:27 -0700 (Mon, 27 Jun 2016)

Log Message

Send canAuthenticateAgainstProtectionSpace calls from NetworkProcess directly to UIProcess
https://bugs.webkit.org/show_bug.cgi?id=159071

Patch by Alex Christensen <[email protected]> on 2016-06-27
Reviewed by Brady Eidson.

Source/WebKit2:

When CFNetwork asks the NetworkProcess if we can authenticate against this protection space, we used to ask
the WebProcess, which would call ResourceLoader::canAuthenticateAgainstProtectionSpace which would ask the FrameLoaderClient,
which would synchronously ask the UIProcess.  Going directly from the NetworkProcess to the UIProcess gives us many advantages:
1. It reduces IPC because we ask fewer loads.
2. It reduces synchronous IPC because we are not using the same code path as WebKit1 any more.
3. It allows us to check if the NetworkProcess is still valid in sendToNetworkingProcess, possibly fixing rdar://problem/26825408
4. It allows us to ask the UIProcess when we get authentication challenges for synchronous xhr.

I added a new test http/tests/xmlhttprequest/sync-delegate-callbacks.html to verify the change in behavior of synchronous xhr.
In order to make this test not flaky on platforms using NSURLSession, we clear the NSURLSessions used by WebKitTestRunner
to make sure that the TLS session cache is cleared so we get NSURLAuthenticationChallenges corresponding to the NSURLConnection
canAuthenticateAgainstProtectionSpace callback when we initiate the first HTTPS connection to 127.0.0.1 with this session.

* NetworkProcess/NetworkLoad.cpp:
(WebKit::NetworkLoad::didReceiveChallenge):
(WebKit::NetworkLoad::didReceiveResponseNetworkSession):
(WebKit::NetworkLoad::canAuthenticateAgainstProtectionSpaceAsync):
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::clearCachedCredentials):
(WebKit::NetworkProcess::ensurePrivateBrowsingSession):
(WebKit::NetworkProcess::cancelDownload):
(WebKit::NetworkProcess::canAuthenticateAgainstProtectionSpace):
(WebKit::NetworkProcess::continueCanAuthenticateAgainstProtectionSpace):
(WebKit::NetworkProcess::continueCanAuthenticateAgainstProtectionSpaceDownload):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::canAuthenticateAgainstProtectionSpaceAsync):
* NetworkProcess/NetworkResourceLoader.h:
* NetworkProcess/NetworkResourceLoader.messages.in:
* NetworkProcess/NetworkSession.h:
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(WebKit::NetworkSession::networkStorageSession):
(WebKit::NetworkSession::clearCredentials):
(WebKit::NetworkSession::dataTaskForIdentifier):
* UIProcess/Downloads/DownloadProxy.cpp:
(WebKit::DownloadProxy::canAuthenticateAgainstProtectionSpace):
(WebKit::DownloadProxy::willSendRequest):
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::logSampledDiagnosticMessageWithValue):
(WebKit::NetworkProcessProxy::canAuthenticateAgainstProtectionSpace):
(WebKit::NetworkProcessProxy::sendProcessWillSuspendImminently):
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/Network/NetworkProcessProxy.messages.in:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::backForwardClear):
(WebKit::WebPageProxy::canAuthenticateAgainstProtectionSpace):
(WebKit::WebPageProxy::didReceiveAuthenticationChallenge):
(WebKit::WebPageProxy::canAuthenticateAgainstProtectionSpaceInFrame): Deleted.
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/Network/WebResourceLoader.cpp:
(WebKit::WebResourceLoader::didReceiveResource):
(WebKit::WebResourceLoader::isAlwaysOnLoggingAllowed):
(WebKit::WebResourceLoader::canAuthenticateAgainstProtectionSpace): Deleted.
* WebProcess/Network/WebResourceLoader.h:
* WebProcess/Network/WebResourceLoader.messages.in:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::canAuthenticateAgainstProtectionSpace):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::clearCachedCredentials):
(WebKit::WebProcess::focusedWebPage):

Tools:

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setHandlesAuthenticationChallenges):
(WTR::TestRunner::setShouldLogCanAuthenticateAgainstProtectionSpace):
(WTR::TestRunner::setAuthenticationUsername):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::TestController):
(WTR::TestController::resetStateToConsistentValues):
(WTR::TestController::didFinishNavigation):
(WTR::TestController::canAuthenticateAgainstProtectionSpace):
(WTR::TestController::didReceiveAuthenticationChallenge):
(WTR::TestController::didCommitNavigation):
* WebKitTestRunner/TestController.h:
(WTR::TestController::setBlockAllPlugins):
(WTR::TestController::setShouldLogHistoryClientCallbacks):
(WTR::TestController::setShouldLogCanAuthenticateAgainstProtectionSpace):
(WTR::TestController::isCurrentInvocation):
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
Added output so we can see when canAuthenticateAgainstProtectionSpace is called from the test expectations.

LayoutTests:

* http/tests/xmlhttprequest/sync-delegate-callbacks-expected.txt: Added.
* http/tests/xmlhttprequest/sync-delegate-callbacks.html: Added.
* platform/ios-simulator-wk2/TestExpectations:
* platform/mac/TestExpectations:
* platform/wk2/http/tests/xmlhttprequest/sync-delegate-callbacks-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (202510 => 202511)


--- trunk/LayoutTests/ChangeLog	2016-06-27 20:52:43 UTC (rev 202510)
+++ trunk/LayoutTests/ChangeLog	2016-06-27 20:59:27 UTC (rev 202511)
@@ -1,3 +1,16 @@
+2016-06-27  Alex Christensen  <[email protected]>
+
+        Send canAuthenticateAgainstProtectionSpace calls from NetworkProcess directly to UIProcess
+        https://bugs.webkit.org/show_bug.cgi?id=159071
+
+        Reviewed by Brady Eidson.
+
+        * http/tests/xmlhttprequest/sync-delegate-callbacks-expected.txt: Added.
+        * http/tests/xmlhttprequest/sync-delegate-callbacks.html: Added.
+        * platform/ios-simulator-wk2/TestExpectations:
+        * platform/mac/TestExpectations:
+        * platform/wk2/http/tests/xmlhttprequest/sync-delegate-callbacks-expected.txt: Added.
+
 2016-06-27  Alexey Proskuryakov  <[email protected]>
 
         Remove OS X Mavericks test results

Added: trunk/LayoutTests/http/tests/xmlhttprequest/sync-delegate-callbacks-expected.txt (0 => 202511)


--- trunk/LayoutTests/http/tests/xmlhttprequest/sync-delegate-callbacks-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/sync-delegate-callbacks-expected.txt	2016-06-27 20:59:27 UTC (rev 202511)
@@ -0,0 +1,5 @@
+ALERT: sending synchronous xhr
+ALERT: hello
+ALERT: sending synchronous xhr
+ALERT: hello
+

Added: trunk/LayoutTests/http/tests/xmlhttprequest/sync-delegate-callbacks.html (0 => 202511)


--- trunk/LayoutTests/http/tests/xmlhttprequest/sync-delegate-callbacks.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/xmlhttprequest/sync-delegate-callbacks.html	2016-06-27 20:59:27 UTC (rev 202511)
@@ -0,0 +1,19 @@
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    // FIXME: http://webkit.org/b/65196
+    if (testRunner.setShouldLogCanAuthenticateAgainstProtectionSpace)
+        testRunner.setShouldLogCanAuthenticateAgainstProtectionSpace(true);
+}
+for (var i = 0; i < 2; i++) {
+    alert("sending synchronous xhr");
+	try {
+		var req = new XMLHttpRequest();
+		req.open("GET", "https://127.0.0.1:8443/xmlhttprequest/resources/allow-any-origin.php", false);
+		req.send(null);
+	} catch (ex) {
+		alert(ex);
+	}
+	alert(req.responseText);
+}
+</script>

Modified: trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations (202510 => 202511)


--- trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations	2016-06-27 20:52:43 UTC (rev 202510)
+++ trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations	2016-06-27 20:59:27 UTC (rev 202511)
@@ -1836,6 +1836,9 @@
 webkit.org/b/148709 fast/events/wheelevent-basic.html [ Skip ]
 webkit.org/b/148709 fast/events/wheelevent-mousewheel-interaction.html [ Skip ]
 
+# NSURLConnection doesn't allow us to clear the TLS session cache.  This is flaky on iOS9.
+http/tests/xmlhttprequest/sync-delegate-callbacks.html [ Pass Failure ]
+
 # Flaky tests that need bugs
 fast/dom/Window/post-message-crash.html [ Pass Failure ]
 

Modified: trunk/LayoutTests/platform/mac/TestExpectations (202510 => 202511)


--- trunk/LayoutTests/platform/mac/TestExpectations	2016-06-27 20:52:43 UTC (rev 202510)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2016-06-27 20:59:27 UTC (rev 202511)
@@ -703,6 +703,9 @@
 # Always very slow, frequently timing out (only on bots, not locally).
 webkit.org/b/121331 [ Yosemite ElCapitan ] http/tests/misc/submit-post-keygen.html [ Pass Failure Timeout ]
 
+# NSURLConnection doesn't allow us to clear the TLS session cache.
+[ Yosemite ElCapitan ] http/tests/xmlhttprequest/sync-delegate-callbacks.html [ Pass Failure ]
+
 # <rdar://problem/26701829> com.apple.WebKit.WebContent.Development crashed in com.apple.security: Security::Mutex::unlock + 9
 [ Sierra+ ] http/tests/misc/submit-post-keygen.html [ Pass Failure Timeout Crash ]
 

Added: trunk/LayoutTests/platform/wk2/http/tests/xmlhttprequest/sync-delegate-callbacks-expected.txt (0 => 202511)


--- trunk/LayoutTests/platform/wk2/http/tests/xmlhttprequest/sync-delegate-callbacks-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/wk2/http/tests/xmlhttprequest/sync-delegate-callbacks-expected.txt	2016-06-27 20:59:27 UTC (rev 202511)
@@ -0,0 +1,6 @@
+ALERT: sending synchronous xhr
+canAuthenticateAgainstProtectionSpace
+ALERT: hello
+ALERT: sending synchronous xhr
+ALERT: hello
+

Modified: trunk/Source/WebKit2/ChangeLog (202510 => 202511)


--- trunk/Source/WebKit2/ChangeLog	2016-06-27 20:52:43 UTC (rev 202510)
+++ trunk/Source/WebKit2/ChangeLog	2016-06-27 20:59:27 UTC (rev 202511)
@@ -1,3 +1,73 @@
+2016-06-27  Alex Christensen  <[email protected]>
+
+        Send canAuthenticateAgainstProtectionSpace calls from NetworkProcess directly to UIProcess
+        https://bugs.webkit.org/show_bug.cgi?id=159071
+
+        Reviewed by Brady Eidson.
+
+        When CFNetwork asks the NetworkProcess if we can authenticate against this protection space, we used to ask
+        the WebProcess, which would call ResourceLoader::canAuthenticateAgainstProtectionSpace which would ask the FrameLoaderClient,
+        which would synchronously ask the UIProcess.  Going directly from the NetworkProcess to the UIProcess gives us many advantages:
+        1. It reduces IPC because we ask fewer loads.
+        2. It reduces synchronous IPC because we are not using the same code path as WebKit1 any more.
+        3. It allows us to check if the NetworkProcess is still valid in sendToNetworkingProcess, possibly fixing rdar://problem/26825408
+        4. It allows us to ask the UIProcess when we get authentication challenges for synchronous xhr.
+
+        I added a new test http/tests/xmlhttprequest/sync-delegate-callbacks.html to verify the change in behavior of synchronous xhr.
+        In order to make this test not flaky on platforms using NSURLSession, we clear the NSURLSessions used by WebKitTestRunner
+        to make sure that the TLS session cache is cleared so we get NSURLAuthenticationChallenges corresponding to the NSURLConnection
+        canAuthenticateAgainstProtectionSpace callback when we initiate the first HTTPS connection to 127.0.0.1 with this session. 
+
+        * NetworkProcess/NetworkLoad.cpp:
+        (WebKit::NetworkLoad::didReceiveChallenge):
+        (WebKit::NetworkLoad::didReceiveResponseNetworkSession):
+        (WebKit::NetworkLoad::canAuthenticateAgainstProtectionSpaceAsync):
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::clearCachedCredentials):
+        (WebKit::NetworkProcess::ensurePrivateBrowsingSession):
+        (WebKit::NetworkProcess::cancelDownload):
+        (WebKit::NetworkProcess::canAuthenticateAgainstProtectionSpace):
+        (WebKit::NetworkProcess::continueCanAuthenticateAgainstProtectionSpace):
+        (WebKit::NetworkProcess::continueCanAuthenticateAgainstProtectionSpaceDownload):
+        * NetworkProcess/NetworkProcess.h:
+        * NetworkProcess/NetworkProcess.messages.in:
+        * NetworkProcess/NetworkResourceLoader.cpp:
+        (WebKit::NetworkResourceLoader::canAuthenticateAgainstProtectionSpaceAsync):
+        * NetworkProcess/NetworkResourceLoader.h:
+        * NetworkProcess/NetworkResourceLoader.messages.in:
+        * NetworkProcess/NetworkSession.h:
+        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+        (WebKit::NetworkSession::networkStorageSession):
+        (WebKit::NetworkSession::clearCredentials):
+        (WebKit::NetworkSession::dataTaskForIdentifier):
+        * UIProcess/Downloads/DownloadProxy.cpp:
+        (WebKit::DownloadProxy::canAuthenticateAgainstProtectionSpace):
+        (WebKit::DownloadProxy::willSendRequest):
+        * UIProcess/Network/NetworkProcessProxy.cpp:
+        (WebKit::NetworkProcessProxy::logSampledDiagnosticMessageWithValue):
+        (WebKit::NetworkProcessProxy::canAuthenticateAgainstProtectionSpace):
+        (WebKit::NetworkProcessProxy::sendProcessWillSuspendImminently):
+        * UIProcess/Network/NetworkProcessProxy.h:
+        * UIProcess/Network/NetworkProcessProxy.messages.in:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::backForwardClear):
+        (WebKit::WebPageProxy::canAuthenticateAgainstProtectionSpace):
+        (WebKit::WebPageProxy::didReceiveAuthenticationChallenge):
+        (WebKit::WebPageProxy::canAuthenticateAgainstProtectionSpaceInFrame): Deleted.
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * WebProcess/Network/WebResourceLoader.cpp:
+        (WebKit::WebResourceLoader::didReceiveResource):
+        (WebKit::WebResourceLoader::isAlwaysOnLoggingAllowed):
+        (WebKit::WebResourceLoader::canAuthenticateAgainstProtectionSpace): Deleted.
+        * WebProcess/Network/WebResourceLoader.h:
+        * WebProcess/Network/WebResourceLoader.messages.in:
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::canAuthenticateAgainstProtectionSpace):
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::clearCachedCredentials):
+        (WebKit::WebProcess::focusedWebPage):
+
 2016-06-27  Anders Carlsson  <[email protected]>
 
         Discounted items are displayed with positive values

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkLoad.cpp (202510 => 202511)


--- trunk/Source/WebKit2/NetworkProcess/NetworkLoad.cpp	2016-06-27 20:52:43 UTC (rev 202510)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkLoad.cpp	2016-06-27 20:59:27 UTC (rev 202511)
@@ -230,14 +230,7 @@
     m_challengeCompletionHandler = WTFMove(completionHandler);
     m_challenge = challenge;
 
-    if (m_client.isSynchronous()) {
-        // FIXME: We should ask the WebProcess like the asynchronous case below does.
-        // This is currently impossible as the WebProcess is blocked waiting on this synchronous load.
-        // It's possible that we can jump straight to the UI process to resolve this.
-        continueCanAuthenticateAgainstProtectionSpace(true);
-        return;
-    } else
-        m_client.canAuthenticateAgainstProtectionSpaceAsync(challenge.protectionSpace());
+    m_client.canAuthenticateAgainstProtectionSpaceAsync(challenge.protectionSpace());
 }
 
 void NetworkLoad::didReceiveResponseNetworkSession(ResourceResponse&& response, ResponseCompletionHandler&& completionHandler)
@@ -341,14 +334,6 @@
         return;
     }
 
-    if (m_client.isSynchronous()) {
-        // FIXME: We should ask the WebProcess like the asynchronous case below does.
-        // This is currently impossible as the WebProcess is blocked waiting on this synchronous load.
-        // It's possible that we can jump straight to the UI process to resolve this.
-        continueCanAuthenticateAgainstProtectionSpace(true);
-        return;
-    }
-
     m_client.canAuthenticateAgainstProtectionSpaceAsync(protectionSpace);
 }
 #endif

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp (202510 => 202511)


--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp	2016-06-27 20:52:43 UTC (rev 202510)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp	2016-06-27 20:59:27 UTC (rev 202511)
@@ -44,6 +44,7 @@
 #include "StatisticsData.h"
 #include "WebCookieManager.h"
 #include "WebCoreArgumentCoders.h"
+#include "WebPageProxyMessages.h"
 #include "WebProcessPoolMessages.h"
 #include "WebsiteData.h"
 #include "WebsiteDataFetchOption.h"
@@ -278,7 +279,7 @@
 void NetworkProcess::clearCachedCredentials()
 {
     NetworkStorageSession::defaultStorageSession().credentialStorage().clearCredentials();
-#if USE(NETWORK_SESSION) && !USE(CREDENTIAL_STORAGE_WITH_NETWORK_SESSION)
+#if USE(NETWORK_SESSION)
     NetworkSession::defaultSession().clearCredentials();
 #endif
 }
@@ -480,8 +481,23 @@
     downloadManager().cancelDownload(downloadID);
 }
     
+#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
+void NetworkProcess::canAuthenticateAgainstProtectionSpace(NetworkResourceLoader& loader, const WebCore::ProtectionSpace& protectionSpace)
+{
+    static uint64_t lastLoaderID = 0;
+    uint64_t loaderID = ++lastLoaderID;
+    m_waitingNetworkResourceLoaders.set(lastLoaderID, loader);
+    parentProcessConnection()->send(Messages::NetworkProcessProxy::CanAuthenticateAgainstProtectionSpace(loaderID, loader.pageID(), loader.frameID(), protectionSpace), 0);
+}
+
+void NetworkProcess::continueCanAuthenticateAgainstProtectionSpace(uint64_t loaderID, bool canAuthenticate)
+{
+    m_waitingNetworkResourceLoaders.take(loaderID).value()->continueCanAuthenticateAgainstProtectionSpace(canAuthenticate);
+}
+#endif
+
 #if USE(NETWORK_SESSION)
-void NetworkProcess::continueCanAuthenticateAgainstProtectionSpace(DownloadID downloadID, bool canAuthenticate)
+void NetworkProcess::continueCanAuthenticateAgainstProtectionSpaceDownload(DownloadID downloadID, bool canAuthenticate)
 {
     downloadManager().continueCanAuthenticateAgainstProtectionSpace(downloadID, canAuthenticate);
 }

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h (202510 => 202511)


--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h	2016-06-27 20:52:43 UTC (rev 202510)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h	2016-06-27 20:59:27 UTC (rev 202511)
@@ -23,8 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef NetworkProcess_h
-#define NetworkProcess_h
+#pragma once
 
 #include "CacheModel.h"
 #include "ChildProcess.h"
@@ -47,6 +46,7 @@
 class DownloadID;
 class CertificateInfo;
 class NetworkStorageSession;
+class ProtectionSpace;
 class SecurityOrigin;
 class SessionID;
 struct SecurityOriginData;
@@ -56,6 +56,7 @@
 class AuthenticationManager;
 class NetworkConnectionToWebProcess;
 class NetworkProcessSupplement;
+class NetworkResourceLoader;
 enum class WebsiteDataFetchOption;
 enum class WebsiteDataType;
 struct NetworkProcessCreationParameters;
@@ -108,7 +109,11 @@
 #if USE(NETWORK_SESSION)
     void findPendingDownloadLocation(NetworkDataTask&, ResponseCompletionHandler&&, const WebCore::ResourceRequest&);
 #endif
-    
+
+#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
+    void canAuthenticateAgainstProtectionSpace(NetworkResourceLoader&, const WebCore::ProtectionSpace&);
+#endif
+
     void prefetchDNS(const String&);
 
     void ensurePrivateBrowsingSession(WebCore::SessionID);
@@ -170,8 +175,11 @@
     void downloadRequest(WebCore::SessionID, DownloadID, const WebCore::ResourceRequest&);
     void resumeDownload(WebCore::SessionID, DownloadID, const IPC::DataReference& resumeData, const String& path, const SandboxExtension::Handle&);
     void cancelDownload(DownloadID);
+#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
+    void continueCanAuthenticateAgainstProtectionSpace(uint64_t resourceLoadIdentifier, bool canAuthenticate);
+#endif
 #if USE(NETWORK_SESSION)
-    void continueCanAuthenticateAgainstProtectionSpace(DownloadID, bool canAuthenticate);
+    void continueCanAuthenticateAgainstProtectionSpaceDownload(DownloadID, bool canAuthenticate);
     void continueWillSendRequest(DownloadID, WebCore::ResourceRequest&&);
     void continueDecidePendingDownloadDestination(DownloadID, String destination, const SandboxExtension::Handle& sandboxExtensionHandle, bool allowOverwrite);
 #endif
@@ -206,6 +214,7 @@
     NetworkProcessSupplementMap m_supplements;
 
     HashMap<uint64_t, Function<void ()>> m_sandboxExtensionForBlobsCompletionHandlers;
+    HashMap<uint64_t, Ref<NetworkResourceLoader>> m_waitingNetworkResourceLoaders;
 
 #if PLATFORM(COCOA)
     void platformInitializeNetworkProcessCocoa(const NetworkProcessCreationParameters&);
@@ -222,5 +231,3 @@
 };
 
 } // namespace WebKit
-
-#endif // NetworkProcess_h

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in (202510 => 202511)


--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in	2016-06-27 20:52:43 UTC (rev 202510)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in	2016-06-27 20:59:27 UTC (rev 202511)
@@ -44,8 +44,12 @@
     DownloadRequest(WebCore::SessionID sessionID, WebKit::DownloadID downloadID, WebCore::ResourceRequest request)
     ResumeDownload(WebCore::SessionID sessionID, WebKit::DownloadID downloadID, IPC::DataReference resumeData, String path, WebKit::SandboxExtension::Handle sandboxExtensionHandle)
     CancelDownload(WebKit::DownloadID downloadID)
+
+#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
+    ContinueCanAuthenticateAgainstProtectionSpace(uint64_t loaderID, bool canAuthenticate)
+#endif
 #if USE(NETWORK_SESSION)
-    ContinueCanAuthenticateAgainstProtectionSpace(WebKit::DownloadID downloadID, bool canAuthenticate)
+    ContinueCanAuthenticateAgainstProtectionSpaceDownload(WebKit::DownloadID downloadID, bool canAuthenticate)
     ContinueWillSendRequest(WebKit::DownloadID downloadID, WebCore::ResourceRequest request)
     ContinueDecidePendingDownloadDestination(WebKit::DownloadID downloadID, String destination, WebKit::SandboxExtension::Handle sandboxExtensionHandle, bool allowOverwrite)
 #endif

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp (202510 => 202511)


--- trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp	2016-06-27 20:52:43 UTC (rev 202510)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp	2016-06-27 20:59:27 UTC (rev 202511)
@@ -32,6 +32,7 @@
 #include "NetworkCache.h"
 #include "NetworkConnectionToWebProcess.h"
 #include "NetworkLoad.h"
+#include "NetworkProcess.h"
 #include "NetworkProcessConnectionMessages.h"
 #include "WebCoreArgumentCoders.h"
 #include "WebResourceLoaderMessages.h"
@@ -632,7 +633,7 @@
 void NetworkResourceLoader::canAuthenticateAgainstProtectionSpaceAsync(const ProtectionSpace& protectionSpace)
 {
 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
-    sendAbortingOnFailure(Messages::WebResourceLoader::CanAuthenticateAgainstProtectionSpace(protectionSpace));
+    NetworkProcess::singleton().canAuthenticateAgainstProtectionSpace(*this, protectionSpace);
 #else
     UNUSED_PARAM(protectionSpace);
 #endif

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h (202510 => 202511)


--- trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h	2016-06-27 20:52:43 UTC (rev 202510)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h	2016-06-27 20:59:27 UTC (rev 202511)
@@ -80,6 +80,8 @@
     NetworkConnectionToWebProcess& connectionToWebProcess() { return m_connection; }
     WebCore::SessionID sessionID() const { return m_parameters.sessionID; }
     ResourceLoadIdentifier identifier() const { return m_parameters.identifier; }
+    uint64_t frameID() const { return m_parameters.webFrameID; }
+    uint64_t pageID() const { return m_parameters.webPageID; }
 
     struct SynchronousLoadData;
 

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.messages.in (202510 => 202511)


--- trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.messages.in	2016-06-27 20:52:43 UTC (rev 202510)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.messages.in	2016-06-27 20:59:27 UTC (rev 202511)
@@ -24,7 +24,4 @@
 
     ContinueWillSendRequest(WebCore::ResourceRequest request)
     ContinueDidReceiveResponse()
-#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
-    ContinueCanAuthenticateAgainstProtectionSpace(bool canAuthenticate)
-#endif
 }

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkSession.h (202510 => 202511)


--- trunk/Source/WebKit2/NetworkProcess/NetworkSession.h	2016-06-27 20:52:43 UTC (rev 202510)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkSession.h	2016-06-27 20:59:27 UTC (rev 202511)
@@ -69,9 +69,7 @@
     static void setSourceApplicationAuditTokenData(RetainPtr<CFDataRef>&&);
 #endif
 
-#if !USE(CREDENTIAL_STORAGE_WITH_NETWORK_SESSION)
     void clearCredentials();
-#endif
 
     NetworkDataTask* dataTaskForIdentifier(NetworkDataTask::TaskIdentifier, WebCore::StoredCredentials);
 

Modified: trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm (202510 => 202511)


--- trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2016-06-27 20:52:43 UTC (rev 202510)
+++ trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2016-06-27 20:59:27 UTC (rev 202511)
@@ -413,7 +413,6 @@
     return *m_networkStorageSession;
 }
 
-#if !USE(CREDENTIAL_STORAGE_WITH_NETWORK_SESSION)
 void NetworkSession::clearCredentials()
 {
     ASSERT(m_dataTaskMapWithCredentials.isEmpty());
@@ -420,8 +419,8 @@
     ASSERT(m_dataTaskMapWithoutCredentials.isEmpty());
     ASSERT(m_downloadMap.isEmpty());
     m_sessionWithCredentialStorage = [NSURLSession sessionWithConfiguration:m_sessionWithCredentialStorage.get().configuration delegate:static_cast<id>(m_sessionWithCredentialStorageDelegate.get()) delegateQueue:[NSOperationQueue mainQueue]];
+    m_sessionWithoutCredentialStorage = [NSURLSession sessionWithConfiguration:m_sessionWithoutCredentialStorage.get().configuration delegate:static_cast<id>(m_sessionWithoutCredentialStorageDelegate.get()) delegateQueue:[NSOperationQueue mainQueue]];
 }
-#endif
 
 NetworkDataTask* NetworkSession::dataTaskForIdentifier(NetworkDataTask::TaskIdentifier taskIdentifier, WebCore::StoredCredentials storedCredentials)
 {

Modified: trunk/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp (202510 => 202511)


--- trunk/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp	2016-06-27 20:52:43 UTC (rev 202510)
+++ trunk/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp	2016-06-27 20:59:27 UTC (rev 202511)
@@ -124,7 +124,7 @@
 
     bool result = m_processPool->downloadClient().canAuthenticateAgainstProtectionSpace(getPtr(WebProtectionSpace::create(protectionSpace)));
     
-    networkProcessProxy->connection()->send(Messages::NetworkProcess::ContinueCanAuthenticateAgainstProtectionSpace(m_downloadID, result), 0);
+    networkProcessProxy->connection()->send(Messages::NetworkProcess::ContinueCanAuthenticateAgainstProtectionSpaceDownload(m_downloadID, result), 0);
 }
 
 void DownloadProxy::willSendRequest(const ResourceRequest& proposedRequest, const ResourceResponse& redirectResponse)

Modified: trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp (202510 => 202511)


--- trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp	2016-06-27 20:52:43 UTC (rev 202510)
+++ trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp	2016-06-27 20:59:27 UTC (rev 202511)
@@ -350,6 +350,17 @@
     page->logSampledDiagnosticMessageWithValue(message, description, value);
 }
 
+#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
+void NetworkProcessProxy::canAuthenticateAgainstProtectionSpace(uint64_t loaderID, uint64_t pageID, uint64_t frameID, const WebCore::ProtectionSpace& protectionSpace)
+{
+    WebPageProxy* page = WebProcessProxy::webPage(pageID);
+    if (!page)
+        return;
+    
+    page->canAuthenticateAgainstProtectionSpace(loaderID, frameID, protectionSpace);
+}
+#endif
+
 void NetworkProcessProxy::sendProcessWillSuspendImminently()
 {
     if (!canSendMessage())

Modified: trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h (202510 => 202511)


--- trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h	2016-06-27 20:52:43 UTC (rev 202510)
+++ trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h	2016-06-27 20:59:27 UTC (rev 202511)
@@ -37,6 +37,7 @@
 
 namespace WebCore {
 class AuthenticationChallenge;
+class ProtectionSpace;
 class ResourceRequest;
 class SecurityOrigin;
 class SessionID;
@@ -110,6 +111,9 @@
     void logSampledDiagnosticMessage(uint64_t pageID, const String& message, const String& description);
     void logSampledDiagnosticMessageWithResult(uint64_t pageID, const String& message, const String& description, uint32_t result);
     void logSampledDiagnosticMessageWithValue(uint64_t pageID, const String& message, const String& description, const String& value);
+#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
+    void canAuthenticateAgainstProtectionSpace(uint64_t loaderID, uint64_t pageID, uint64_t frameID, const WebCore::ProtectionSpace&);
+#endif
 
     // ProcessLauncher::Client
     void didFinishLaunching(ProcessLauncher*, IPC::Connection::Identifier) override;

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


--- trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.messages.in	2016-06-27 20:52:43 UTC (rev 202510)
+++ trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.messages.in	2016-06-27 20:59:27 UTC (rev 202511)
@@ -38,4 +38,8 @@
     LogSampledDiagnosticMessage(uint64_t pageID, String message, String description)
     LogSampledDiagnosticMessageWithResult(uint64_t pageID, String message, String description, uint32_t result)
     LogSampledDiagnosticMessageWithValue(uint64_t pageID, String message, String description, String value)
+
+#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
+    CanAuthenticateAgainstProtectionSpace(uint64_t loaderID, uint64_t pageID, uint64_t frameID, WebCore::ProtectionSpace protectionSpace)
+#endif
 }

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (202510 => 202511)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-06-27 20:52:43 UTC (rev 202510)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-06-27 20:59:27 UTC (rev 202511)
@@ -5376,17 +5376,22 @@
     m_backForwardList->clear();
 }
 
-void WebPageProxy::canAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID, const ProtectionSpace& coreProtectionSpace, bool& canAuthenticate)
+void WebPageProxy::canAuthenticateAgainstProtectionSpace(uint64_t loaderID, uint64_t frameID, const ProtectionSpace& coreProtectionSpace)
 {
+#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
     WebFrameProxy* frame = m_process->webFrame(frameID);
     MESSAGE_CHECK(frame);
 
     RefPtr<WebProtectionSpace> protectionSpace = WebProtectionSpace::create(coreProtectionSpace);
 
+    bool canAuthenticate;
     if (m_navigationClient)
         canAuthenticate = m_navigationClient->canAuthenticateAgainstProtectionSpace(*this, protectionSpace.get());
     else
         canAuthenticate = m_loaderClient->canAuthenticateAgainstProtectionSpaceInFrame(*this, *frame, protectionSpace.get());
+
+    m_process->processPool().sendToNetworkingProcess(Messages::NetworkProcess::ContinueCanAuthenticateAgainstProtectionSpace(loaderID, canAuthenticate));
+#endif
 }
 
 void WebPageProxy::didReceiveAuthenticationChallenge(uint64_t frameID, const AuthenticationChallenge& coreChallenge, uint64_t challengeID)

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (202510 => 202511)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2016-06-27 20:52:43 UTC (rev 202510)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2016-06-27 20:59:27 UTC (rev 202511)
@@ -1116,6 +1116,8 @@
 
     bool isAlwaysOnLoggingAllowed() const;
 
+    void canAuthenticateAgainstProtectionSpace(uint64_t loaderID, uint64_t frameID, const WebCore::ProtectionSpace&);
+
 private:
     WebPageProxy(PageClient&, WebProcessProxy&, uint64_t pageID, Ref<API::PageConfiguration>&&);
     void platformInitialize();
@@ -1392,7 +1394,6 @@
     void focusedFrameChanged(uint64_t frameID);
     void frameSetLargestFrameChanged(uint64_t frameID);
 
-    void canAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID, const WebCore::ProtectionSpace&, bool& canAuthenticate);
     void didReceiveAuthenticationChallenge(uint64_t frameID, const WebCore::AuthenticationChallenge&, uint64_t challengeID);
 
     void didFinishLoadingDataForCustomContentProvider(const String& suggestedFilename, const IPC::DataReference&);

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (202510 => 202511)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2016-06-27 20:52:43 UTC (rev 202510)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2016-06-27 20:59:27 UTC (rev 202511)
@@ -253,7 +253,6 @@
 #endif
 
     # Authentication messages
-    CanAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID, WebCore::ProtectionSpace protectionSpace) -> (bool canAuthenticate)
     DidReceiveAuthenticationChallenge(uint64_t frameID, WebCore::AuthenticationChallenge challenge, uint64_t challengeID)
 
     # Database messages

Modified: trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp (202510 => 202511)


--- trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp	2016-06-27 20:52:43 UTC (rev 202510)
+++ trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp	2016-06-27 20:59:27 UTC (rev 202511)
@@ -211,18 +211,6 @@
 }
 #endif
 
-#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
-void WebResourceLoader::canAuthenticateAgainstProtectionSpace(const ProtectionSpace& protectionSpace)
-{
-    if (!m_coreLoader)
-        return;
-    
-    bool result = m_coreLoader->canAuthenticateAgainstProtectionSpace(protectionSpace);
-    
-    send(Messages::NetworkResourceLoader::ContinueCanAuthenticateAgainstProtectionSpace(result));
-}
-#endif
-
 bool WebResourceLoader::isAlwaysOnLoggingAllowed() const
 {
     return resourceLoader() && resourceLoader()->isAlwaysOnLoggingAllowed();

Modified: trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.h (202510 => 202511)


--- trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.h	2016-06-27 20:52:43 UTC (rev 202510)
+++ trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.h	2016-06-27 20:59:27 UTC (rev 202511)
@@ -85,10 +85,6 @@
     void didReceiveResource(const ShareableResource::Handle&, double finishTime);
 #endif
 
-#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
-    void canAuthenticateAgainstProtectionSpace(const WebCore::ProtectionSpace&);
-#endif
-
     RefPtr<WebCore::ResourceLoader> m_coreLoader;
 };
 

Modified: trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.messages.in (202510 => 202511)


--- trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.messages.in	2016-06-27 20:52:43 UTC (rev 202510)
+++ trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.messages.in	2016-06-27 20:59:27 UTC (rev 202511)
@@ -28,10 +28,6 @@
     DidFinishResourceLoad(double finishTime)
     DidFailResourceLoad(WebCore::ResourceError error)
 
-#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
-    CanAuthenticateAgainstProtectionSpace(WebCore::ProtectionSpace protectionSpace)
-#endif
-
 #if ENABLE(SHAREABLE_RESOURCE)
     // DidReceiveResource is for when we have the entire resource data available at once, such as when the resource is cached in memory
     DidReceiveResource(WebKit::ShareableResource::Handle resource, double finishTime)

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (202510 => 202511)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2016-06-27 20:52:43 UTC (rev 202510)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2016-06-27 20:59:27 UTC (rev 202511)
@@ -199,18 +199,9 @@
 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
 bool WebFrameLoaderClient::canAuthenticateAgainstProtectionSpace(DocumentLoader*, unsigned long, const ProtectionSpace& protectionSpace)
 {
-    // FIXME: Authentication is a per-resource concept, but we don't do per-resource handling in the UIProcess at the API level quite yet.
-    // Once we do, we might need to make sure authentication fits with our solution.
-    
-    WebPage* webPage = m_frame->page();
-    if (!webPage)
-        return false;
-        
-    bool canAuthenticate;
-    if (!webPage->sendSync(Messages::WebPageProxy::CanAuthenticateAgainstProtectionSpaceInFrame(m_frame->frameID(), protectionSpace), Messages::WebPageProxy::CanAuthenticateAgainstProtectionSpaceInFrame::Reply(canAuthenticate)))
-        return false;
-    
-    return canAuthenticate;
+    // The WebKit 2 Networking process asks the UIProcess directly, so the WebContent process should never receive this callback.
+    ASSERT_NOT_REACHED();
+    return false;
 }
 #endif
 

Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (202510 => 202511)


--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp	2016-06-27 20:52:43 UTC (rev 202510)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp	2016-06-27 20:59:27 UTC (rev 202511)
@@ -536,7 +536,7 @@
 void WebProcess::clearCachedCredentials()
 {
     NetworkStorageSession::defaultStorageSession().credentialStorage().clearCredentials();
-#if USE(NETWORK_SESSION) && !USE(CREDENTIAL_STORAGE_WITH_NETWORK_SESSION)
+#if USE(NETWORK_SESSION)
     NetworkSession::defaultSession().clearCredentials();
 #endif
 }

Modified: trunk/Tools/ChangeLog (202510 => 202511)


--- trunk/Tools/ChangeLog	2016-06-27 20:52:43 UTC (rev 202510)
+++ trunk/Tools/ChangeLog	2016-06-27 20:59:27 UTC (rev 202511)
@@ -1,3 +1,32 @@
+2016-06-27  Alex Christensen  <[email protected]>
+
+        Send canAuthenticateAgainstProtectionSpace calls from NetworkProcess directly to UIProcess
+        https://bugs.webkit.org/show_bug.cgi?id=159071
+
+        Reviewed by Brady Eidson.
+
+        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::setHandlesAuthenticationChallenges):
+        (WTR::TestRunner::setShouldLogCanAuthenticateAgainstProtectionSpace):
+        (WTR::TestRunner::setAuthenticationUsername):
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::TestController):
+        (WTR::TestController::resetStateToConsistentValues):
+        (WTR::TestController::didFinishNavigation):
+        (WTR::TestController::canAuthenticateAgainstProtectionSpace):
+        (WTR::TestController::didReceiveAuthenticationChallenge):
+        (WTR::TestController::didCommitNavigation):
+        * WebKitTestRunner/TestController.h:
+        (WTR::TestController::setBlockAllPlugins):
+        (WTR::TestController::setShouldLogHistoryClientCallbacks):
+        (WTR::TestController::setShouldLogCanAuthenticateAgainstProtectionSpace):
+        (WTR::TestController::isCurrentInvocation):
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
+        Added output so we can see when canAuthenticateAgainstProtectionSpace is called from the test expectations.
+
 2016-06-27  Per Arne Vollan  <[email protected]>
 
         [Win] The test fast/events/wheel-event-outside-body.html is timing out.

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (202510 => 202511)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2016-06-27 20:52:43 UTC (rev 202510)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2016-06-27 20:59:27 UTC (rev 202511)
@@ -199,6 +199,7 @@
 
     // Authentication
     void setHandlesAuthenticationChallenges(boolean value);
+    void setShouldLogCanAuthenticateAgainstProtectionSpace(boolean value);
     void setAuthenticationUsername(DOMString username);
     void setAuthenticationPassword(DOMString password);
 

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (202510 => 202511)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2016-06-27 20:52:43 UTC (rev 202510)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2016-06-27 20:59:27 UTC (rev 202511)
@@ -907,6 +907,13 @@
     WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), messageName.get(), messageBody.get());
 }
 
+void TestRunner::setShouldLogCanAuthenticateAgainstProtectionSpace(bool value)
+{
+    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetShouldLogCanAuthenticateAgainstProtectionSpace"));
+    WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(value));
+    WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), messageName.get(), messageBody.get());
+}
+
 void TestRunner::setAuthenticationUsername(JSStringRef username)
 {
     WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetAuthenticationUsername"));

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (202510 => 202511)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2016-06-27 20:52:43 UTC (rev 202510)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2016-06-27 20:59:27 UTC (rev 202511)
@@ -164,6 +164,7 @@
 
     // Authentication
     void setHandlesAuthenticationChallenges(bool);
+    void setShouldLogCanAuthenticateAgainstProtectionSpace(bool);
     void setAuthenticationUsername(JSStringRef);
     void setAuthenticationPassword(JSStringRef);
 

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (202510 => 202511)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2016-06-27 20:52:43 UTC (rev 202510)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2016-06-27 20:59:27 UTC (rev 202511)
@@ -119,29 +119,6 @@
 }
 
 TestController::TestController(int argc, const char* argv[])
-    : m_verbose(false)
-    , m_printSeparators(false)
-    , m_usingServerMode(false)
-    , m_gcBetweenTests(false)
-    , m_shouldDumpPixelsForAllTests(false)
-    , m_state(Initial)
-    , m_doneResetting(false)
-    , m_useWaitToDumpWatchdogTimer(true)
-    , m_forceNoTimeout(false)
-    , m_didPrintWebProcessCrashedMessage(false)
-    , m_shouldExitWhenWebProcessCrashes(true)
-    , m_beforeUnloadReturnValue(true)
-    , m_isGeolocationPermissionSet(false)
-    , m_isGeolocationPermissionAllowed(false)
-    , m_policyDelegateEnabled(false)
-    , m_policyDelegatePermissive(false)
-    , m_handlesAuthenticationChallenges(false)
-    , m_shouldBlockAllPlugins(false)
-    , m_forceComplexText(false)
-    , m_shouldUseAcceleratedDrawing(false)
-    , m_shouldUseRemoteLayerTree(false)
-    , m_shouldLogHistoryClientCallbacks(false)
-    , m_shouldShowWebView(false)
 {
     initialize(argc, argv);
     controller = this;
@@ -795,6 +772,7 @@
     m_shouldBlockAllPlugins = false;
 
     m_shouldLogHistoryClientCallbacks = false;
+    m_shouldLogCanAuthenticateAgainstProtectionSpace = false;
 
     setHidden(false);
 
@@ -1521,16 +1499,9 @@
     static_cast<TestController*>(const_cast<void*>(clientInfo))->didFinishNavigation(page, navigation);
 }
 
-bool TestController::canAuthenticateAgainstProtectionSpace(WKPageRef, WKProtectionSpaceRef protectionSpace, const void*)
+bool TestController::canAuthenticateAgainstProtectionSpace(WKPageRef page, WKProtectionSpaceRef protectionSpace, const void* clientInfo)
 {
-    WKProtectionSpaceAuthenticationScheme authenticationScheme = WKProtectionSpaceGetAuthenticationScheme(protectionSpace);
-
-    if (authenticationScheme == kWKProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested) {
-        std::string host = toSTD(adoptWK(WKProtectionSpaceCopyHost(protectionSpace)).get());
-        return host == "localhost" || host == "127.0.0.1";
-    }
-
-    return authenticationScheme <= kWKProtectionSpaceAuthenticationSchemeHTTPDigest;
+    return static_cast<TestController*>(const_cast<void*>(clientInfo))->canAuthenticateAgainstProtectionSpace(page, protectionSpace);
 }
 
 void TestController::didReceiveAuthenticationChallenge(WKPageRef page, WKAuthenticationChallengeRef authenticationChallenge, const void *clientInfo)
@@ -1595,6 +1566,20 @@
     mainWebView()->focus();
 }
 
+bool TestController::canAuthenticateAgainstProtectionSpace(WKPageRef page, WKProtectionSpaceRef protectionSpace)
+{
+    if (m_shouldLogCanAuthenticateAgainstProtectionSpace)
+        m_currentInvocation->outputText("canAuthenticateAgainstProtectionSpace\n");
+    WKProtectionSpaceAuthenticationScheme authenticationScheme = WKProtectionSpaceGetAuthenticationScheme(protectionSpace);
+    
+    if (authenticationScheme == kWKProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested) {
+        std::string host = toSTD(adoptWK(WKProtectionSpaceCopyHost(protectionSpace)).get());
+        return host == "localhost" || host == "127.0.0.1";
+    }
+    
+    return authenticationScheme <= kWKProtectionSpaceAuthenticationSchemeHTTPDigest;
+}
+
 void TestController::didFinishNavigation(WKPageRef page, WKNavigationRef navigation)
 {
     if (m_state != Resetting)

Modified: trunk/Tools/WebKitTestRunner/TestController.h (202510 => 202511)


--- trunk/Tools/WebKitTestRunner/TestController.h	2016-06-27 20:52:43 UTC (rev 202510)
+++ trunk/Tools/WebKitTestRunner/TestController.h	2016-06-27 20:59:27 UTC (rev 202511)
@@ -132,6 +132,7 @@
     void setBlockAllPlugins(bool shouldBlock) { m_shouldBlockAllPlugins = shouldBlock; }
 
     void setShouldLogHistoryClientCallbacks(bool shouldLog) { m_shouldLogHistoryClientCallbacks = shouldLog; }
+    void setShouldLogCanAuthenticateAgainstProtectionSpace(bool shouldLog) { m_shouldLogCanAuthenticateAgainstProtectionSpace = shouldLog; }
 
     bool isCurrentInvocation(TestInvocation* invocation) const { return invocation == m_currentInvocation.get(); }
 
@@ -239,9 +240,10 @@
 
     static void unavailablePluginButtonClicked(WKPageRef, WKPluginUnavailabilityReason, WKDictionaryRef, const void*);
 
-    static bool canAuthenticateAgainstProtectionSpace(WKPageRef, WKProtectionSpaceRef, const void *clientInfo);
+    static bool canAuthenticateAgainstProtectionSpace(WKPageRef, WKProtectionSpaceRef, const void*);
+    bool canAuthenticateAgainstProtectionSpace(WKPageRef, WKProtectionSpaceRef);
 
-    static void didReceiveAuthenticationChallenge(WKPageRef, WKAuthenticationChallengeRef, const void *clientInfo);
+    static void didReceiveAuthenticationChallenge(WKPageRef, WKAuthenticationChallengeRef, const void*);
     void didReceiveAuthenticationChallenge(WKPageRef, WKAuthenticationChallengeRef);
 
     static void decidePolicyForNavigationAction(WKPageRef, WKNavigationActionRef, WKFramePolicyListenerRef, WKTypeRef, const void*);
@@ -273,11 +275,11 @@
 
     std::unique_ptr<TestInvocation> m_currentInvocation;
 
-    bool m_verbose;
-    bool m_printSeparators;
-    bool m_usingServerMode;
-    bool m_gcBetweenTests;
-    bool m_shouldDumpPixelsForAllTests;
+    bool m_verbose { false };
+    bool m_printSeparators { false };
+    bool m_usingServerMode { false };
+    bool m_gcBetweenTests { false };
+    bool m_shouldDumpPixelsForAllTests { false };
     std::vector<std::string> m_paths;
     std::vector<std::string> m_allowedHosts;
     WKRetainPtr<WKStringRef> m_injectedBundlePath;
@@ -294,21 +296,21 @@
         Resetting,
         RunningTest
     };
-    State m_state;
-    bool m_doneResetting;
+    State m_state { Initial };
+    bool m_doneResetting { false };
 
-    bool m_useWaitToDumpWatchdogTimer;
-    bool m_forceNoTimeout;
+    bool m_useWaitToDumpWatchdogTimer { true };
+    bool m_forceNoTimeout { false };
 
-    bool m_didPrintWebProcessCrashedMessage;
-    bool m_shouldExitWhenWebProcessCrashes;
+    bool m_didPrintWebProcessCrashedMessage { false };
+    bool m_shouldExitWhenWebProcessCrashes { true };
     
-    bool m_beforeUnloadReturnValue;
+    bool m_beforeUnloadReturnValue { true };
 
     std::unique_ptr<GeolocationProviderMock> m_geolocationProvider;
     Vector<WKRetainPtr<WKGeolocationPermissionRequestRef> > m_geolocationPermissionRequests;
-    bool m_isGeolocationPermissionSet;
-    bool m_isGeolocationPermissionAllowed;
+    bool m_isGeolocationPermissionSet { false };
+    bool m_isGeolocationPermissionAllowed { false };
 
     HashMap<String, RefPtr<OriginSettings>> m_cahcedUserMediaPermissions;
 
@@ -315,25 +317,26 @@
     typedef Vector<std::pair<String, WKRetainPtr<WKUserMediaPermissionRequestRef>>> PermissionRequestList;
     PermissionRequestList m_userMediaPermissionRequests;
 
-    bool m_isUserMediaPermissionSet;
-    bool m_isUserMediaPermissionAllowed;
+    bool m_isUserMediaPermissionSet { false };
+    bool m_isUserMediaPermissionAllowed { false };
 
-    bool m_policyDelegateEnabled;
-    bool m_policyDelegatePermissive;
+    bool m_policyDelegateEnabled { false };
+    bool m_policyDelegatePermissive { false };
 
-    bool m_handlesAuthenticationChallenges;
+    bool m_handlesAuthenticationChallenges { false };
     String m_authenticationUsername;
     String m_authenticationPassword;
 
-    bool m_shouldBlockAllPlugins;
+    bool m_shouldBlockAllPlugins { false };
 
-    bool m_forceComplexText;
-    bool m_shouldUseAcceleratedDrawing;
-    bool m_shouldUseRemoteLayerTree;
+    bool m_forceComplexText { false };
+    bool m_shouldUseAcceleratedDrawing { false };
+    bool m_shouldUseRemoteLayerTree { false };
 
-    bool m_shouldLogHistoryClientCallbacks;
-    bool m_shouldShowWebView;
-
+    bool m_shouldLogCanAuthenticateAgainstProtectionSpace { false };
+    bool m_shouldLogHistoryClientCallbacks { false };
+    bool m_shouldShowWebView { false };
+    
     bool m_shouldDecideNavigationPolicyAfterDelay { false };
 
     std::unique_ptr<EventSenderProxy> m_eventSenderProxy;

Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (202510 => 202511)


--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp	2016-06-27 20:52:43 UTC (rev 202510)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp	2016-06-27 20:59:27 UTC (rev 202511)
@@ -606,6 +606,13 @@
         return;
     }
 
+    if (WKStringIsEqualToUTF8CString(messageName, "SetShouldLogCanAuthenticateAgainstProtectionSpace")) {
+        ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
+        WKBooleanRef value = static_cast<WKBooleanRef>(messageBody);
+        TestController::singleton().setShouldLogCanAuthenticateAgainstProtectionSpace(WKBooleanGetValue(value));
+        return;
+    }
+
     if (WKStringIsEqualToUTF8CString(messageName, "SetAuthenticationUsername")) {
         ASSERT(WKGetTypeID(messageBody) == WKStringGetTypeID());
         WKStringRef username = static_cast<WKStringRef>(messageBody);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to