Changeset 202511 in webkit


Ignore:
Timestamp:
Jun 27, 2016 1:59:27 PM (8 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Alex Christensen <achristensen@webkit.org> 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.
Location:
trunk
Files:
3 added
32 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r202510 r202511  
     12016-06-27  Alex Christensen  <achristensen@webkit.org>
     2
     3        Send canAuthenticateAgainstProtectionSpace calls from NetworkProcess directly to UIProcess
     4        https://bugs.webkit.org/show_bug.cgi?id=159071
     5
     6        Reviewed by Brady Eidson.
     7
     8        * http/tests/xmlhttprequest/sync-delegate-callbacks-expected.txt: Added.
     9        * http/tests/xmlhttprequest/sync-delegate-callbacks.html: Added.
     10        * platform/ios-simulator-wk2/TestExpectations:
     11        * platform/mac/TestExpectations:
     12        * platform/wk2/http/tests/xmlhttprequest/sync-delegate-callbacks-expected.txt: Added.
     13
    1142016-06-27  Alexey Proskuryakov  <ap@apple.com>
    215
  • trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations

    r202412 r202511  
    18371837webkit.org/b/148709 fast/events/wheelevent-mousewheel-interaction.html [ Skip ]
    18381838
     1839# NSURLConnection doesn't allow us to clear the TLS session cache.  This is flaky on iOS9.
     1840http/tests/xmlhttprequest/sync-delegate-callbacks.html [ Pass Failure ]
     1841
    18391842# Flaky tests that need bugs
    18401843fast/dom/Window/post-message-crash.html [ Pass Failure ]
  • trunk/LayoutTests/platform/mac/TestExpectations

    r202496 r202511  
    703703# Always very slow, frequently timing out (only on bots, not locally).
    704704webkit.org/b/121331 [ Yosemite ElCapitan ] http/tests/misc/submit-post-keygen.html [ Pass Failure Timeout ]
     705
     706# NSURLConnection doesn't allow us to clear the TLS session cache.
     707[ Yosemite ElCapitan ] http/tests/xmlhttprequest/sync-delegate-callbacks.html [ Pass Failure ]
    705708
    706709# <rdar://problem/26701829> com.apple.WebKit.WebContent.Development crashed in com.apple.security: Security::Mutex::unlock + 9
  • trunk/Source/WebKit2/ChangeLog

    r202504 r202511  
     12016-06-27  Alex Christensen  <achristensen@webkit.org>
     2
     3        Send canAuthenticateAgainstProtectionSpace calls from NetworkProcess directly to UIProcess
     4        https://bugs.webkit.org/show_bug.cgi?id=159071
     5
     6        Reviewed by Brady Eidson.
     7
     8        When CFNetwork asks the NetworkProcess if we can authenticate against this protection space, we used to ask
     9        the WebProcess, which would call ResourceLoader::canAuthenticateAgainstProtectionSpace which would ask the FrameLoaderClient,
     10        which would synchronously ask the UIProcess.  Going directly from the NetworkProcess to the UIProcess gives us many advantages:
     11        1. It reduces IPC because we ask fewer loads.
     12        2. It reduces synchronous IPC because we are not using the same code path as WebKit1 any more.
     13        3. It allows us to check if the NetworkProcess is still valid in sendToNetworkingProcess, possibly fixing rdar://problem/26825408
     14        4. It allows us to ask the UIProcess when we get authentication challenges for synchronous xhr.
     15
     16        I added a new test http/tests/xmlhttprequest/sync-delegate-callbacks.html to verify the change in behavior of synchronous xhr.
     17        In order to make this test not flaky on platforms using NSURLSession, we clear the NSURLSessions used by WebKitTestRunner
     18        to make sure that the TLS session cache is cleared so we get NSURLAuthenticationChallenges corresponding to the NSURLConnection
     19        canAuthenticateAgainstProtectionSpace callback when we initiate the first HTTPS connection to 127.0.0.1 with this session.
     20
     21        * NetworkProcess/NetworkLoad.cpp:
     22        (WebKit::NetworkLoad::didReceiveChallenge):
     23        (WebKit::NetworkLoad::didReceiveResponseNetworkSession):
     24        (WebKit::NetworkLoad::canAuthenticateAgainstProtectionSpaceAsync):
     25        * NetworkProcess/NetworkProcess.cpp:
     26        (WebKit::NetworkProcess::clearCachedCredentials):
     27        (WebKit::NetworkProcess::ensurePrivateBrowsingSession):
     28        (WebKit::NetworkProcess::cancelDownload):
     29        (WebKit::NetworkProcess::canAuthenticateAgainstProtectionSpace):
     30        (WebKit::NetworkProcess::continueCanAuthenticateAgainstProtectionSpace):
     31        (WebKit::NetworkProcess::continueCanAuthenticateAgainstProtectionSpaceDownload):
     32        * NetworkProcess/NetworkProcess.h:
     33        * NetworkProcess/NetworkProcess.messages.in:
     34        * NetworkProcess/NetworkResourceLoader.cpp:
     35        (WebKit::NetworkResourceLoader::canAuthenticateAgainstProtectionSpaceAsync):
     36        * NetworkProcess/NetworkResourceLoader.h:
     37        * NetworkProcess/NetworkResourceLoader.messages.in:
     38        * NetworkProcess/NetworkSession.h:
     39        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
     40        (WebKit::NetworkSession::networkStorageSession):
     41        (WebKit::NetworkSession::clearCredentials):
     42        (WebKit::NetworkSession::dataTaskForIdentifier):
     43        * UIProcess/Downloads/DownloadProxy.cpp:
     44        (WebKit::DownloadProxy::canAuthenticateAgainstProtectionSpace):
     45        (WebKit::DownloadProxy::willSendRequest):
     46        * UIProcess/Network/NetworkProcessProxy.cpp:
     47        (WebKit::NetworkProcessProxy::logSampledDiagnosticMessageWithValue):
     48        (WebKit::NetworkProcessProxy::canAuthenticateAgainstProtectionSpace):
     49        (WebKit::NetworkProcessProxy::sendProcessWillSuspendImminently):
     50        * UIProcess/Network/NetworkProcessProxy.h:
     51        * UIProcess/Network/NetworkProcessProxy.messages.in:
     52        * UIProcess/WebPageProxy.cpp:
     53        (WebKit::WebPageProxy::backForwardClear):
     54        (WebKit::WebPageProxy::canAuthenticateAgainstProtectionSpace):
     55        (WebKit::WebPageProxy::didReceiveAuthenticationChallenge):
     56        (WebKit::WebPageProxy::canAuthenticateAgainstProtectionSpaceInFrame): Deleted.
     57        * UIProcess/WebPageProxy.h:
     58        * UIProcess/WebPageProxy.messages.in:
     59        * WebProcess/Network/WebResourceLoader.cpp:
     60        (WebKit::WebResourceLoader::didReceiveResource):
     61        (WebKit::WebResourceLoader::isAlwaysOnLoggingAllowed):
     62        (WebKit::WebResourceLoader::canAuthenticateAgainstProtectionSpace): Deleted.
     63        * WebProcess/Network/WebResourceLoader.h:
     64        * WebProcess/Network/WebResourceLoader.messages.in:
     65        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
     66        (WebKit::WebFrameLoaderClient::canAuthenticateAgainstProtectionSpace):
     67        * WebProcess/WebProcess.cpp:
     68        (WebKit::WebProcess::clearCachedCredentials):
     69        (WebKit::WebProcess::focusedWebPage):
     70
    1712016-06-27  Anders Carlsson  <andersca@apple.com>
    272
  • trunk/Source/WebKit2/NetworkProcess/NetworkLoad.cpp

    r202410 r202511  
    231231    m_challenge = challenge;
    232232
    233     if (m_client.isSynchronous()) {
    234         // FIXME: We should ask the WebProcess like the asynchronous case below does.
    235         // This is currently impossible as the WebProcess is blocked waiting on this synchronous load.
    236         // It's possible that we can jump straight to the UI process to resolve this.
    237         continueCanAuthenticateAgainstProtectionSpace(true);
    238         return;
    239     } else
    240         m_client.canAuthenticateAgainstProtectionSpaceAsync(challenge.protectionSpace());
     233    m_client.canAuthenticateAgainstProtectionSpaceAsync(challenge.protectionSpace());
    241234}
    242235
     
    339332        && !NetworkProcess::singleton().canHandleHTTPSServerTrustEvaluation()) {
    340333        continueCanAuthenticateAgainstProtectionSpace(false);
    341         return;
    342     }
    343 
    344     if (m_client.isSynchronous()) {
    345         // FIXME: We should ask the WebProcess like the asynchronous case below does.
    346         // This is currently impossible as the WebProcess is blocked waiting on this synchronous load.
    347         // It's possible that we can jump straight to the UI process to resolve this.
    348         continueCanAuthenticateAgainstProtectionSpace(true);
    349334        return;
    350335    }
  • trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp

    r202439 r202511  
    4545#include "WebCookieManager.h"
    4646#include "WebCoreArgumentCoders.h"
     47#include "WebPageProxyMessages.h"
    4748#include "WebProcessPoolMessages.h"
    4849#include "WebsiteData.h"
     
    279280{
    280281    NetworkStorageSession::defaultStorageSession().credentialStorage().clearCredentials();
    281 #if USE(NETWORK_SESSION) && !USE(CREDENTIAL_STORAGE_WITH_NETWORK_SESSION)
     282#if USE(NETWORK_SESSION)
    282283    NetworkSession::defaultSession().clearCredentials();
    283284#endif
     
    481482}
    482483   
     484#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
     485void NetworkProcess::canAuthenticateAgainstProtectionSpace(NetworkResourceLoader& loader, const WebCore::ProtectionSpace& protectionSpace)
     486{
     487    static uint64_t lastLoaderID = 0;
     488    uint64_t loaderID = ++lastLoaderID;
     489    m_waitingNetworkResourceLoaders.set(lastLoaderID, loader);
     490    parentProcessConnection()->send(Messages::NetworkProcessProxy::CanAuthenticateAgainstProtectionSpace(loaderID, loader.pageID(), loader.frameID(), protectionSpace), 0);
     491}
     492
     493void NetworkProcess::continueCanAuthenticateAgainstProtectionSpace(uint64_t loaderID, bool canAuthenticate)
     494{
     495    m_waitingNetworkResourceLoaders.take(loaderID).value()->continueCanAuthenticateAgainstProtectionSpace(canAuthenticate);
     496}
     497#endif
     498
    483499#if USE(NETWORK_SESSION)
    484 void NetworkProcess::continueCanAuthenticateAgainstProtectionSpace(DownloadID downloadID, bool canAuthenticate)
     500void NetworkProcess::continueCanAuthenticateAgainstProtectionSpaceDownload(DownloadID downloadID, bool canAuthenticate)
    485501{
    486502    downloadManager().continueCanAuthenticateAgainstProtectionSpace(downloadID, canAuthenticate);
  • trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h

    r202439 r202511  
    2424 */
    2525
    26 #ifndef NetworkProcess_h
    27 #define NetworkProcess_h
     26#pragma once
    2827
    2928#include "CacheModel.h"
     
    4847class CertificateInfo;
    4948class NetworkStorageSession;
     49class ProtectionSpace;
    5050class SecurityOrigin;
    5151class SessionID;
     
    5757class NetworkConnectionToWebProcess;
    5858class NetworkProcessSupplement;
     59class NetworkResourceLoader;
    5960enum class WebsiteDataFetchOption;
    6061enum class WebsiteDataType;
     
    109110    void findPendingDownloadLocation(NetworkDataTask&, ResponseCompletionHandler&&, const WebCore::ResourceRequest&);
    110111#endif
    111    
     112
     113#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
     114    void canAuthenticateAgainstProtectionSpace(NetworkResourceLoader&, const WebCore::ProtectionSpace&);
     115#endif
     116
    112117    void prefetchDNS(const String&);
    113118
     
    171176    void resumeDownload(WebCore::SessionID, DownloadID, const IPC::DataReference& resumeData, const String& path, const SandboxExtension::Handle&);
    172177    void cancelDownload(DownloadID);
     178#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
     179    void continueCanAuthenticateAgainstProtectionSpace(uint64_t resourceLoadIdentifier, bool canAuthenticate);
     180#endif
    173181#if USE(NETWORK_SESSION)
    174     void continueCanAuthenticateAgainstProtectionSpace(DownloadID, bool canAuthenticate);
     182    void continueCanAuthenticateAgainstProtectionSpaceDownload(DownloadID, bool canAuthenticate);
    175183    void continueWillSendRequest(DownloadID, WebCore::ResourceRequest&&);
    176184    void continueDecidePendingDownloadDestination(DownloadID, String destination, const SandboxExtension::Handle& sandboxExtensionHandle, bool allowOverwrite);
     
    207215
    208216    HashMap<uint64_t, Function<void ()>> m_sandboxExtensionForBlobsCompletionHandlers;
     217    HashMap<uint64_t, Ref<NetworkResourceLoader>> m_waitingNetworkResourceLoaders;
    209218
    210219#if PLATFORM(COCOA)
     
    223232
    224233} // namespace WebKit
    225 
    226 #endif // NetworkProcess_h
  • trunk/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in

    r199230 r202511  
    4545    ResumeDownload(WebCore::SessionID sessionID, WebKit::DownloadID downloadID, IPC::DataReference resumeData, String path, WebKit::SandboxExtension::Handle sandboxExtensionHandle)
    4646    CancelDownload(WebKit::DownloadID downloadID)
     47
     48#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
     49    ContinueCanAuthenticateAgainstProtectionSpace(uint64_t loaderID, bool canAuthenticate)
     50#endif
    4751#if USE(NETWORK_SESSION)
    48     ContinueCanAuthenticateAgainstProtectionSpace(WebKit::DownloadID downloadID, bool canAuthenticate)
     52    ContinueCanAuthenticateAgainstProtectionSpaceDownload(WebKit::DownloadID downloadID, bool canAuthenticate)
    4953    ContinueWillSendRequest(WebKit::DownloadID downloadID, WebCore::ResourceRequest request)
    5054    ContinueDecidePendingDownloadDestination(WebKit::DownloadID downloadID, String destination, WebKit::SandboxExtension::Handle sandboxExtensionHandle, bool allowOverwrite)
  • trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp

    r202154 r202511  
    3333#include "NetworkConnectionToWebProcess.h"
    3434#include "NetworkLoad.h"
     35#include "NetworkProcess.h"
    3536#include "NetworkProcessConnectionMessages.h"
    3637#include "WebCoreArgumentCoders.h"
     
    633634{
    634635#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
    635     sendAbortingOnFailure(Messages::WebResourceLoader::CanAuthenticateAgainstProtectionSpace(protectionSpace));
     636    NetworkProcess::singleton().canAuthenticateAgainstProtectionSpace(*this, protectionSpace);
    636637#else
    637638    UNUSED_PARAM(protectionSpace);
  • trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.h

    r201943 r202511  
    8181    WebCore::SessionID sessionID() const { return m_parameters.sessionID; }
    8282    ResourceLoadIdentifier identifier() const { return m_parameters.identifier; }
     83    uint64_t frameID() const { return m_parameters.webFrameID; }
     84    uint64_t pageID() const { return m_parameters.webPageID; }
    8385
    8486    struct SynchronousLoadData;
  • trunk/Source/WebKit2/NetworkProcess/NetworkResourceLoader.messages.in

    r192697 r202511  
    2525    ContinueWillSendRequest(WebCore::ResourceRequest request)
    2626    ContinueDidReceiveResponse()
    27 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
    28     ContinueCanAuthenticateAgainstProtectionSpace(bool canAuthenticate)
    29 #endif
    3027}
  • trunk/Source/WebKit2/NetworkProcess/NetworkSession.h

    r198457 r202511  
    7070#endif
    7171
    72 #if !USE(CREDENTIAL_STORAGE_WITH_NETWORK_SESSION)
    7372    void clearCredentials();
    74 #endif
    7573
    7674    NetworkDataTask* dataTaskForIdentifier(NetworkDataTask::TaskIdentifier, WebCore::StoredCredentials);
  • trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm

    r202184 r202511  
    414414}
    415415
    416 #if !USE(CREDENTIAL_STORAGE_WITH_NETWORK_SESSION)
    417416void NetworkSession::clearCredentials()
    418417{
     
    421420    ASSERT(m_downloadMap.isEmpty());
    422421    m_sessionWithCredentialStorage = [NSURLSession sessionWithConfiguration:m_sessionWithCredentialStorage.get().configuration delegate:static_cast<id>(m_sessionWithCredentialStorageDelegate.get()) delegateQueue:[NSOperationQueue mainQueue]];
    423 }
    424 #endif
     422    m_sessionWithoutCredentialStorage = [NSURLSession sessionWithConfiguration:m_sessionWithoutCredentialStorage.get().configuration delegate:static_cast<id>(m_sessionWithoutCredentialStorageDelegate.get()) delegateQueue:[NSOperationQueue mainQueue]];
     423}
    425424
    426425NetworkDataTask* NetworkSession::dataTaskForIdentifier(NetworkDataTask::TaskIdentifier taskIdentifier, WebCore::StoredCredentials storedCredentials)
  • trunk/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp

    r198893 r202511  
    125125    bool result = m_processPool->downloadClient().canAuthenticateAgainstProtectionSpace(getPtr(WebProtectionSpace::create(protectionSpace)));
    126126   
    127     networkProcessProxy->connection()->send(Messages::NetworkProcess::ContinueCanAuthenticateAgainstProtectionSpace(m_downloadID, result), 0);
     127    networkProcessProxy->connection()->send(Messages::NetworkProcess::ContinueCanAuthenticateAgainstProtectionSpaceDownload(m_downloadID, result), 0);
    128128}
    129129
  • trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.cpp

    r202331 r202511  
    351351}
    352352
     353#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
     354void NetworkProcessProxy::canAuthenticateAgainstProtectionSpace(uint64_t loaderID, uint64_t pageID, uint64_t frameID, const WebCore::ProtectionSpace& protectionSpace)
     355{
     356    WebPageProxy* page = WebProcessProxy::webPage(pageID);
     357    if (!page)
     358        return;
     359   
     360    page->canAuthenticateAgainstProtectionSpace(loaderID, frameID, protectionSpace);
     361}
     362#endif
     363
    353364void NetworkProcessProxy::sendProcessWillSuspendImminently()
    354365{
  • trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.h

    r199230 r202511  
    3838namespace WebCore {
    3939class AuthenticationChallenge;
     40class ProtectionSpace;
    4041class ResourceRequest;
    4142class SecurityOrigin;
     
    111112    void logSampledDiagnosticMessageWithResult(uint64_t pageID, const String& message, const String& description, uint32_t result);
    112113    void logSampledDiagnosticMessageWithValue(uint64_t pageID, const String& message, const String& description, const String& value);
     114#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
     115    void canAuthenticateAgainstProtectionSpace(uint64_t loaderID, uint64_t pageID, uint64_t frameID, const WebCore::ProtectionSpace&);
     116#endif
    113117
    114118    // ProcessLauncher::Client
  • trunk/Source/WebKit2/UIProcess/Network/NetworkProcessProxy.messages.in

    r199230 r202511  
    3939    LogSampledDiagnosticMessageWithResult(uint64_t pageID, String message, String description, uint32_t result)
    4040    LogSampledDiagnosticMessageWithValue(uint64_t pageID, String message, String description, String value)
     41
     42#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
     43    CanAuthenticateAgainstProtectionSpace(uint64_t loaderID, uint64_t pageID, uint64_t frameID, WebCore::ProtectionSpace protectionSpace)
     44#endif
    4145}
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r202455 r202511  
    53775377}
    53785378
    5379 void WebPageProxy::canAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID, const ProtectionSpace& coreProtectionSpace, bool& canAuthenticate)
    5380 {
     5379void WebPageProxy::canAuthenticateAgainstProtectionSpace(uint64_t loaderID, uint64_t frameID, const ProtectionSpace& coreProtectionSpace)
     5380{
     5381#if USE(PROTECTION_SPACE_AUTH_CALLBACK)
    53815382    WebFrameProxy* frame = m_process->webFrame(frameID);
    53825383    MESSAGE_CHECK(frame);
     
    53845385    RefPtr<WebProtectionSpace> protectionSpace = WebProtectionSpace::create(coreProtectionSpace);
    53855386
     5387    bool canAuthenticate;
    53865388    if (m_navigationClient)
    53875389        canAuthenticate = m_navigationClient->canAuthenticateAgainstProtectionSpace(*this, protectionSpace.get());
    53885390    else
    53895391        canAuthenticate = m_loaderClient->canAuthenticateAgainstProtectionSpaceInFrame(*this, *frame, protectionSpace.get());
     5392
     5393    m_process->processPool().sendToNetworkingProcess(Messages::NetworkProcess::ContinueCanAuthenticateAgainstProtectionSpace(loaderID, canAuthenticate));
     5394#endif
    53905395}
    53915396
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r202444 r202511  
    11171117    bool isAlwaysOnLoggingAllowed() const;
    11181118
     1119    void canAuthenticateAgainstProtectionSpace(uint64_t loaderID, uint64_t frameID, const WebCore::ProtectionSpace&);
     1120
    11191121private:
    11201122    WebPageProxy(PageClient&, WebProcessProxy&, uint64_t pageID, Ref<API::PageConfiguration>&&);
     
    13931395    void frameSetLargestFrameChanged(uint64_t frameID);
    13941396
    1395     void canAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID, const WebCore::ProtectionSpace&, bool& canAuthenticate);
    13961397    void didReceiveAuthenticationChallenge(uint64_t frameID, const WebCore::AuthenticationChallenge&, uint64_t challengeID);
    13971398
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in

    r201888 r202511  
    254254
    255255    # Authentication messages
    256     CanAuthenticateAgainstProtectionSpaceInFrame(uint64_t frameID, WebCore::ProtectionSpace protectionSpace) -> (bool canAuthenticate)
    257256    DidReceiveAuthenticationChallenge(uint64_t frameID, WebCore::AuthenticationChallenge challenge, uint64_t challengeID)
    258257
  • trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp

    r202119 r202511  
    212212#endif
    213213
    214 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
    215 void WebResourceLoader::canAuthenticateAgainstProtectionSpace(const ProtectionSpace& protectionSpace)
    216 {
    217     if (!m_coreLoader)
    218         return;
    219    
    220     bool result = m_coreLoader->canAuthenticateAgainstProtectionSpace(protectionSpace);
    221    
    222     send(Messages::NetworkResourceLoader::ContinueCanAuthenticateAgainstProtectionSpace(result));
    223 }
    224 #endif
    225 
    226214bool WebResourceLoader::isAlwaysOnLoggingAllowed() const
    227215{
  • trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.h

    r201708 r202511  
    8686#endif
    8787
    88 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
    89     void canAuthenticateAgainstProtectionSpace(const WebCore::ProtectionSpace&);
    90 #endif
    91 
    9288    RefPtr<WebCore::ResourceLoader> m_coreLoader;
    9389};
  • trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.messages.in

    r192697 r202511  
    2929    DidFailResourceLoad(WebCore::ResourceError error)
    3030
    31 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
    32     CanAuthenticateAgainstProtectionSpace(WebCore::ProtectionSpace protectionSpace)
    33 #endif
    34 
    3531#if ENABLE(SHAREABLE_RESOURCE)
    3632    // DidReceiveResource is for when we have the entire resource data available at once, such as when the resource is cached in memory
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp

    r202410 r202511  
    200200bool WebFrameLoaderClient::canAuthenticateAgainstProtectionSpace(DocumentLoader*, unsigned long, const ProtectionSpace& protectionSpace)
    201201{
    202     // FIXME: Authentication is a per-resource concept, but we don't do per-resource handling in the UIProcess at the API level quite yet.
    203     // Once we do, we might need to make sure authentication fits with our solution.
    204    
    205     WebPage* webPage = m_frame->page();
    206     if (!webPage)
    207         return false;
    208        
    209     bool canAuthenticate;
    210     if (!webPage->sendSync(Messages::WebPageProxy::CanAuthenticateAgainstProtectionSpaceInFrame(m_frame->frameID(), protectionSpace), Messages::WebPageProxy::CanAuthenticateAgainstProtectionSpaceInFrame::Reply(canAuthenticate)))
    211         return false;
    212    
    213     return canAuthenticate;
     202    // The WebKit 2 Networking process asks the UIProcess directly, so the WebContent process should never receive this callback.
     203    ASSERT_NOT_REACHED();
     204    return false;
    214205}
    215206#endif
  • trunk/Source/WebKit2/WebProcess/WebProcess.cpp

    r200819 r202511  
    537537{
    538538    NetworkStorageSession::defaultStorageSession().credentialStorage().clearCredentials();
    539 #if USE(NETWORK_SESSION) && !USE(CREDENTIAL_STORAGE_WITH_NETWORK_SESSION)
     539#if USE(NETWORK_SESSION)
    540540    NetworkSession::defaultSession().clearCredentials();
    541541#endif
  • trunk/Tools/ChangeLog

    r202481 r202511  
     12016-06-27  Alex Christensen  <achristensen@webkit.org>
     2
     3        Send canAuthenticateAgainstProtectionSpace calls from NetworkProcess directly to UIProcess
     4        https://bugs.webkit.org/show_bug.cgi?id=159071
     5
     6        Reviewed by Brady Eidson.
     7
     8        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
     9        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
     10        (WTR::TestRunner::setHandlesAuthenticationChallenges):
     11        (WTR::TestRunner::setShouldLogCanAuthenticateAgainstProtectionSpace):
     12        (WTR::TestRunner::setAuthenticationUsername):
     13        * WebKitTestRunner/InjectedBundle/TestRunner.h:
     14        * WebKitTestRunner/TestController.cpp:
     15        (WTR::TestController::TestController):
     16        (WTR::TestController::resetStateToConsistentValues):
     17        (WTR::TestController::didFinishNavigation):
     18        (WTR::TestController::canAuthenticateAgainstProtectionSpace):
     19        (WTR::TestController::didReceiveAuthenticationChallenge):
     20        (WTR::TestController::didCommitNavigation):
     21        * WebKitTestRunner/TestController.h:
     22        (WTR::TestController::setBlockAllPlugins):
     23        (WTR::TestController::setShouldLogHistoryClientCallbacks):
     24        (WTR::TestController::setShouldLogCanAuthenticateAgainstProtectionSpace):
     25        (WTR::TestController::isCurrentInvocation):
     26        * WebKitTestRunner/TestInvocation.cpp:
     27        (WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
     28        Added output so we can see when canAuthenticateAgainstProtectionSpace is called from the test expectations.
     29
    1302016-06-27  Per Arne Vollan  <pvollan@apple.com>
    231
  • trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl

    r201404 r202511  
    200200    // Authentication
    201201    void setHandlesAuthenticationChallenges(boolean value);
     202    void setShouldLogCanAuthenticateAgainstProtectionSpace(boolean value);
    202203    void setAuthenticationUsername(DOMString username);
    203204    void setAuthenticationPassword(DOMString password);
  • trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp

    r201404 r202511  
    908908}
    909909
     910void TestRunner::setShouldLogCanAuthenticateAgainstProtectionSpace(bool value)
     911{
     912    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetShouldLogCanAuthenticateAgainstProtectionSpace"));
     913    WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(value));
     914    WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), messageName.get(), messageBody.get());
     915}
     916
    910917void TestRunner::setAuthenticationUsername(JSStringRef username)
    911918{
  • trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h

    r201404 r202511  
    165165    // Authentication
    166166    void setHandlesAuthenticationChallenges(bool);
     167    void setShouldLogCanAuthenticateAgainstProtectionSpace(bool);
    167168    void setAuthenticationUsername(JSStringRef);
    168169    void setAuthenticationPassword(JSStringRef);
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r201904 r202511  
    120120
    121121TestController::TestController(int argc, const char* argv[])
    122     : m_verbose(false)
    123     , m_printSeparators(false)
    124     , m_usingServerMode(false)
    125     , m_gcBetweenTests(false)
    126     , m_shouldDumpPixelsForAllTests(false)
    127     , m_state(Initial)
    128     , m_doneResetting(false)
    129     , m_useWaitToDumpWatchdogTimer(true)
    130     , m_forceNoTimeout(false)
    131     , m_didPrintWebProcessCrashedMessage(false)
    132     , m_shouldExitWhenWebProcessCrashes(true)
    133     , m_beforeUnloadReturnValue(true)
    134     , m_isGeolocationPermissionSet(false)
    135     , m_isGeolocationPermissionAllowed(false)
    136     , m_policyDelegateEnabled(false)
    137     , m_policyDelegatePermissive(false)
    138     , m_handlesAuthenticationChallenges(false)
    139     , m_shouldBlockAllPlugins(false)
    140     , m_forceComplexText(false)
    141     , m_shouldUseAcceleratedDrawing(false)
    142     , m_shouldUseRemoteLayerTree(false)
    143     , m_shouldLogHistoryClientCallbacks(false)
    144     , m_shouldShowWebView(false)
    145122{
    146123    initialize(argc, argv);
     
    796773
    797774    m_shouldLogHistoryClientCallbacks = false;
     775    m_shouldLogCanAuthenticateAgainstProtectionSpace = false;
    798776
    799777    setHidden(false);
     
    15221500}
    15231501
    1524 bool TestController::canAuthenticateAgainstProtectionSpace(WKPageRef, WKProtectionSpaceRef protectionSpace, const void*)
    1525 {
    1526     WKProtectionSpaceAuthenticationScheme authenticationScheme = WKProtectionSpaceGetAuthenticationScheme(protectionSpace);
    1527 
    1528     if (authenticationScheme == kWKProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested) {
    1529         std::string host = toSTD(adoptWK(WKProtectionSpaceCopyHost(protectionSpace)).get());
    1530         return host == "localhost" || host == "127.0.0.1";
    1531     }
    1532 
    1533     return authenticationScheme <= kWKProtectionSpaceAuthenticationSchemeHTTPDigest;
     1502bool TestController::canAuthenticateAgainstProtectionSpace(WKPageRef page, WKProtectionSpaceRef protectionSpace, const void* clientInfo)
     1503{
     1504    return static_cast<TestController*>(const_cast<void*>(clientInfo))->canAuthenticateAgainstProtectionSpace(page, protectionSpace);
    15341505}
    15351506
     
    15941565{
    15951566    mainWebView()->focus();
     1567}
     1568
     1569bool TestController::canAuthenticateAgainstProtectionSpace(WKPageRef page, WKProtectionSpaceRef protectionSpace)
     1570{
     1571    if (m_shouldLogCanAuthenticateAgainstProtectionSpace)
     1572        m_currentInvocation->outputText("canAuthenticateAgainstProtectionSpace\n");
     1573    WKProtectionSpaceAuthenticationScheme authenticationScheme = WKProtectionSpaceGetAuthenticationScheme(protectionSpace);
     1574   
     1575    if (authenticationScheme == kWKProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested) {
     1576        std::string host = toSTD(adoptWK(WKProtectionSpaceCopyHost(protectionSpace)).get());
     1577        return host == "localhost" || host == "127.0.0.1";
     1578    }
     1579   
     1580    return authenticationScheme <= kWKProtectionSpaceAuthenticationSchemeHTTPDigest;
    15961581}
    15971582
  • trunk/Tools/WebKitTestRunner/TestController.h

    r200945 r202511  
    133133
    134134    void setShouldLogHistoryClientCallbacks(bool shouldLog) { m_shouldLogHistoryClientCallbacks = shouldLog; }
     135    void setShouldLogCanAuthenticateAgainstProtectionSpace(bool shouldLog) { m_shouldLogCanAuthenticateAgainstProtectionSpace = shouldLog; }
    135136
    136137    bool isCurrentInvocation(TestInvocation* invocation) const { return invocation == m_currentInvocation.get(); }
     
    240241    static void unavailablePluginButtonClicked(WKPageRef, WKPluginUnavailabilityReason, WKDictionaryRef, const void*);
    241242
    242     static bool canAuthenticateAgainstProtectionSpace(WKPageRef, WKProtectionSpaceRef, const void *clientInfo);
    243 
    244     static void didReceiveAuthenticationChallenge(WKPageRef, WKAuthenticationChallengeRef, const void *clientInfo);
     243    static bool canAuthenticateAgainstProtectionSpace(WKPageRef, WKProtectionSpaceRef, const void*);
     244    bool canAuthenticateAgainstProtectionSpace(WKPageRef, WKProtectionSpaceRef);
     245
     246    static void didReceiveAuthenticationChallenge(WKPageRef, WKAuthenticationChallengeRef, const void*);
    245247    void didReceiveAuthenticationChallenge(WKPageRef, WKAuthenticationChallengeRef);
    246248
     
    274276    std::unique_ptr<TestInvocation> m_currentInvocation;
    275277
    276     bool m_verbose;
    277     bool m_printSeparators;
    278     bool m_usingServerMode;
    279     bool m_gcBetweenTests;
    280     bool m_shouldDumpPixelsForAllTests;
     278    bool m_verbose { false };
     279    bool m_printSeparators { false };
     280    bool m_usingServerMode { false };
     281    bool m_gcBetweenTests { false };
     282    bool m_shouldDumpPixelsForAllTests { false };
    281283    std::vector<std::string> m_paths;
    282284    std::vector<std::string> m_allowedHosts;
     
    295297        RunningTest
    296298    };
    297     State m_state;
    298     bool m_doneResetting;
    299 
    300     bool m_useWaitToDumpWatchdogTimer;
    301     bool m_forceNoTimeout;
    302 
    303     bool m_didPrintWebProcessCrashedMessage;
    304     bool m_shouldExitWhenWebProcessCrashes;
    305    
    306     bool m_beforeUnloadReturnValue;
     299    State m_state { Initial };
     300    bool m_doneResetting { false };
     301
     302    bool m_useWaitToDumpWatchdogTimer { true };
     303    bool m_forceNoTimeout { false };
     304
     305    bool m_didPrintWebProcessCrashedMessage { false };
     306    bool m_shouldExitWhenWebProcessCrashes { true };
     307   
     308    bool m_beforeUnloadReturnValue { true };
    307309
    308310    std::unique_ptr<GeolocationProviderMock> m_geolocationProvider;
    309311    Vector<WKRetainPtr<WKGeolocationPermissionRequestRef> > m_geolocationPermissionRequests;
    310     bool m_isGeolocationPermissionSet;
    311     bool m_isGeolocationPermissionAllowed;
     312    bool m_isGeolocationPermissionSet { false };
     313    bool m_isGeolocationPermissionAllowed { false };
    312314
    313315    HashMap<String, RefPtr<OriginSettings>> m_cahcedUserMediaPermissions;
     
    316318    PermissionRequestList m_userMediaPermissionRequests;
    317319
    318     bool m_isUserMediaPermissionSet;
    319     bool m_isUserMediaPermissionAllowed;
    320 
    321     bool m_policyDelegateEnabled;
    322     bool m_policyDelegatePermissive;
    323 
    324     bool m_handlesAuthenticationChallenges;
     320    bool m_isUserMediaPermissionSet { false };
     321    bool m_isUserMediaPermissionAllowed { false };
     322
     323    bool m_policyDelegateEnabled { false };
     324    bool m_policyDelegatePermissive { false };
     325
     326    bool m_handlesAuthenticationChallenges { false };
    325327    String m_authenticationUsername;
    326328    String m_authenticationPassword;
    327329
    328     bool m_shouldBlockAllPlugins;
    329 
    330     bool m_forceComplexText;
    331     bool m_shouldUseAcceleratedDrawing;
    332     bool m_shouldUseRemoteLayerTree;
    333 
    334     bool m_shouldLogHistoryClientCallbacks;
    335     bool m_shouldShowWebView;
    336 
     330    bool m_shouldBlockAllPlugins { false };
     331
     332    bool m_forceComplexText { false };
     333    bool m_shouldUseAcceleratedDrawing { false };
     334    bool m_shouldUseRemoteLayerTree { false };
     335
     336    bool m_shouldLogCanAuthenticateAgainstProtectionSpace { false };
     337    bool m_shouldLogHistoryClientCallbacks { false };
     338    bool m_shouldShowWebView { false };
     339   
    337340    bool m_shouldDecideNavigationPolicyAfterDelay { false };
    338341
  • trunk/Tools/WebKitTestRunner/TestInvocation.cpp

    r202226 r202511  
    607607    }
    608608
     609    if (WKStringIsEqualToUTF8CString(messageName, "SetShouldLogCanAuthenticateAgainstProtectionSpace")) {
     610        ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
     611        WKBooleanRef value = static_cast<WKBooleanRef>(messageBody);
     612        TestController::singleton().setShouldLogCanAuthenticateAgainstProtectionSpace(WKBooleanGetValue(value));
     613        return;
     614    }
     615
    609616    if (WKStringIsEqualToUTF8CString(messageName, "SetAuthenticationUsername")) {
    610617        ASSERT(WKGetTypeID(messageBody) == WKStringGetTypeID());
Note: See TracChangeset for help on using the changeset viewer.