Changeset 203743 in webkit


Ignore:
Timestamp:
Jul 26, 2016 3:31:25 PM (8 years ago)
Author:
ddkilzer@apple.com
Message:

Networking process crash due to missing -[WebCoreAuthenticationClientAsChallengeSender performDefaultHandlingForAuthenticationChallenge:] implementation
https://bugs.webkit.org/show_bug.cgi?id=156947
<rdar://problem/23325160>

Reviewed by Alex Christensen.

Source/WebCore:

Test: http/tests/xmlhttprequest/auth-reject-protection-space.html

  • platform/network/mac/AuthenticationMac.mm:

(-[WebCoreAuthenticationClientAsChallengeSender performDefaultHandlingForAuthenticationChallenge:]): Added.
(-[WebCoreAuthenticationClientAsChallengeSender rejectProtectionSpaceAndContinueWithChallenge:]): Added.

Source/WebKit2:

  • UIProcess/API/C/WKAuthenticationDecisionListener.cpp:

(WKAuthenticationDecisionListenerRejectProtectionSpaceAndContinue):

  • UIProcess/API/C/WKAuthenticationDecisionListener.h:

Added new SPI for testing corresponding to calling the completion handler of
WKWebView.didReceiveAuthenticationChallenge with NSURLSessionAuthChallengeRejectProtectionSpace.

Tools:

  • DumpRenderTree/TestRunner.cpp:

(TestRunner::TestRunner):
(setRejectsProtectionSpaceAndContinueForAuthenticationChallengesCallback):

  • DumpRenderTree/TestRunner.h:

(TestRunner::rejectsProtectionSpaceAndContinueForAuthenticationChallenges):
(TestRunner::setRejectsProtectionSpaceAndContinueForAuthenticationChallenges):

  • DumpRenderTree/mac/ResourceLoadDelegate.mm:

(-[ResourceLoadDelegate webView:resource:didReceiveAuthenticationChallenge:fromDataSource:]):

  • WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
  • WebKitTestRunner/InjectedBundle/TestRunner.cpp:

(WTR::TestRunner::queueNonLoadingScript):
(WTR::TestRunner::setRejectsProtectionSpaceAndContinueForAuthenticationChallenges):

  • WebKitTestRunner/InjectedBundle/TestRunner.h:
  • WebKitTestRunner/TestController.cpp:

(WTR::TestController::didReceiveAuthenticationChallenge):

  • WebKitTestRunner/TestController.h:

(WTR::TestController::setRejectsProtectionSpaceAndContinueForAuthenticationChallenges):

  • WebKitTestRunner/TestInvocation.cpp:

(WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
Add TestRunner.setRejectsProtectionSpaceAndContinueForAuthenticationChallenges to use for testing.

LayoutTests:

  • http/tests/xmlhttprequest/auth-reject-protection-space-expected.txt: Added.
  • http/tests/xmlhttprequest/auth-reject-protection-space.html: Added.
Location:
trunk
Files:
2 added
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r203740 r203743  
     12016-07-26  David Kilzer <ddkilzer@apple.com>
     2
     3        Networking process crash due to missing -[WebCoreAuthenticationClientAsChallengeSender performDefaultHandlingForAuthenticationChallenge:] implementation
     4        https://bugs.webkit.org/show_bug.cgi?id=156947
     5        <rdar://problem/23325160>
     6
     7        Reviewed by Alex Christensen.
     8
     9        * http/tests/xmlhttprequest/auth-reject-protection-space-expected.txt: Added.
     10        * http/tests/xmlhttprequest/auth-reject-protection-space.html: Added.
     11
    1122016-07-26  Chris Dumez  <cdumez@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r203740 r203743  
     12016-07-26  David Kilzer <ddkilzer@apple.com>
     2
     3        Networking process crash due to missing -[WebCoreAuthenticationClientAsChallengeSender performDefaultHandlingForAuthenticationChallenge:] implementation
     4        https://bugs.webkit.org/show_bug.cgi?id=156947
     5        <rdar://problem/23325160>
     6
     7        Reviewed by Alex Christensen.
     8
     9        Test: http/tests/xmlhttprequest/auth-reject-protection-space.html
     10
     11        * platform/network/mac/AuthenticationMac.mm:
     12        (-[WebCoreAuthenticationClientAsChallengeSender performDefaultHandlingForAuthenticationChallenge:]): Added.
     13        (-[WebCoreAuthenticationClientAsChallengeSender rejectProtectionSpaceAndContinueWithChallenge:]): Added.
     14
    1152016-07-26  Chris Dumez  <cdumez@apple.com>
    216
  • trunk/Source/WebCore/platform/network/mac/AuthenticationMac.mm

    r180183 r203743  
    7272}
    7373
     74- (void)performDefaultHandlingForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
     75{
     76    if (m_client)
     77        m_client->receivedRequestToPerformDefaultHandling(core(challenge));
     78}
     79
     80- (void)rejectProtectionSpaceAndContinueWithChallenge:(NSURLAuthenticationChallenge *)challenge
     81{
     82    if (m_client)
     83        m_client->receivedChallengeRejection(core(challenge));
     84}
     85
    7486- (void)useCredential:(NSURLCredential *)credential forAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
    7587{
  • trunk/Source/WebKit2/ChangeLog

    r203741 r203743  
     12016-07-26  David Kilzer <ddkilzer@apple.com>
     2
     3        Networking process crash due to missing -[WebCoreAuthenticationClientAsChallengeSender performDefaultHandlingForAuthenticationChallenge:] implementation
     4        https://bugs.webkit.org/show_bug.cgi?id=156947
     5        <rdar://problem/23325160>
     6
     7        Reviewed by Alex Christensen.
     8
     9        * UIProcess/API/C/WKAuthenticationDecisionListener.cpp:
     10        (WKAuthenticationDecisionListenerRejectProtectionSpaceAndContinue):
     11        * UIProcess/API/C/WKAuthenticationDecisionListener.h:
     12        Added new SPI for testing corresponding to calling the completion handler of
     13        WKWebView.didReceiveAuthenticationChallenge with NSURLSessionAuthChallengeRejectProtectionSpace.
     14
    1152016-07-26  Anders Carlsson  <andersca@apple.com>
    216
  • trunk/Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.cpp

    r176829 r203743  
    4747    toImpl(authenticationListener)->cancel();
    4848}
     49
     50void WKAuthenticationDecisionListenerRejectProtectionSpaceAndContinue(WKAuthenticationDecisionListenerRef authenticationListener)
     51{
     52    toImpl(authenticationListener)->rejectProtectionSpaceAndContinue();
     53}
  • trunk/Source/WebKit2/UIProcess/API/C/WKAuthenticationDecisionListener.h

    r168541 r203743  
    3737WK_EXPORT void WKAuthenticationDecisionListenerUseCredential(WKAuthenticationDecisionListenerRef authenticationListener, WKCredentialRef credential);
    3838WK_EXPORT void WKAuthenticationDecisionListenerCancel(WKAuthenticationDecisionListenerRef authenticationListener);
     39WK_EXPORT void WKAuthenticationDecisionListenerRejectProtectionSpaceAndContinue(WKAuthenticationDecisionListenerRef);
    3940
    4041#ifdef __cplusplus
  • trunk/Tools/ChangeLog

    r203742 r203743  
     12016-07-26  David Kilzer <ddkilzer@apple.com>
     2
     3        Networking process crash due to missing -[WebCoreAuthenticationClientAsChallengeSender performDefaultHandlingForAuthenticationChallenge:] implementation
     4        https://bugs.webkit.org/show_bug.cgi?id=156947
     5        <rdar://problem/23325160>
     6
     7        Reviewed by Alex Christensen.
     8
     9        * DumpRenderTree/TestRunner.cpp:
     10        (TestRunner::TestRunner):
     11        (setRejectsProtectionSpaceAndContinueForAuthenticationChallengesCallback):
     12        * DumpRenderTree/TestRunner.h:
     13        (TestRunner::rejectsProtectionSpaceAndContinueForAuthenticationChallenges):
     14        (TestRunner::setRejectsProtectionSpaceAndContinueForAuthenticationChallenges):
     15        * DumpRenderTree/mac/ResourceLoadDelegate.mm:
     16        (-[ResourceLoadDelegate webView:resource:didReceiveAuthenticationChallenge:fromDataSource:]):
     17        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
     18        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
     19        (WTR::TestRunner::queueNonLoadingScript):
     20        (WTR::TestRunner::setRejectsProtectionSpaceAndContinueForAuthenticationChallenges):
     21        * WebKitTestRunner/InjectedBundle/TestRunner.h:
     22        * WebKitTestRunner/TestController.cpp:
     23        (WTR::TestController::didReceiveAuthenticationChallenge):
     24        * WebKitTestRunner/TestController.h:
     25        (WTR::TestController::setRejectsProtectionSpaceAndContinueForAuthenticationChallenges):
     26        * WebKitTestRunner/TestInvocation.cpp:
     27        (WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
     28        Add TestRunner.setRejectsProtectionSpaceAndContinueForAuthenticationChallenges to use for testing.
     29
    1302016-07-26  David Kilzer  <ddkilzer@apple.com>
    231
  • trunk/Tools/DumpRenderTree/TestRunner.cpp

    r201404 r203743  
    105105    , m_isGeolocationPermissionSet(false)
    106106    , m_geolocationPermission(false)
     107    , m_rejectsProtectionSpaceAndContinueForAuthenticationChallenges(false)
    107108    , m_handlesAuthenticationChallenges(false)
    108109    , m_isPrinting(false)
     
    10621063    controller->setGeolocationPermission(JSValueToBoolean(context, arguments[0]));
    10631064
     1065    return JSValueMakeUndefined(context);
     1066}
     1067
     1068static JSValueRef setRejectsProtectionSpaceAndContinueForAuthenticationChallengesCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     1069{
     1070    // Has mac & windows implementation
     1071    if (argumentCount < 1)
     1072        return JSValueMakeUndefined(context);
     1073   
     1074    TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
     1075    controller->setRejectsProtectionSpaceAndContinueForAuthenticationChallenges(JSValueToBoolean(context, arguments[0]));
     1076   
    10641077    return JSValueMakeUndefined(context);
    10651078}
     
    21292142        { "setDomainRelaxationForbiddenForURLScheme", setDomainRelaxationForbiddenForURLSchemeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    21302143        { "setGeolocationPermission", setGeolocationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     2144        { "setRejectsProtectionSpaceAndContinueForAuthenticationChallenges", setRejectsProtectionSpaceAndContinueForAuthenticationChallengesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    21312145        { "setHandlesAuthenticationChallenges", setHandlesAuthenticationChallengesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    21322146        { "setIconDatabaseEnabled", setIconDatabaseEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
  • trunk/Tools/DumpRenderTree/TestRunner.h

    r201404 r203743  
    266266    void setAlwaysAcceptCookies(bool);
    267267   
     268    bool rejectsProtectionSpaceAndContinueForAuthenticationChallenges() const { return m_rejectsProtectionSpaceAndContinueForAuthenticationChallenges; }
     269    void setRejectsProtectionSpaceAndContinueForAuthenticationChallenges(bool value) { m_rejectsProtectionSpaceAndContinueForAuthenticationChallenges = value; }
     270   
    268271    bool handlesAuthenticationChallenges() const { return m_handlesAuthenticationChallenges; }
    269272    void setHandlesAuthenticationChallenges(bool handlesAuthenticationChallenges) { m_handlesAuthenticationChallenges = handlesAuthenticationChallenges; }
     
    409412    bool m_isGeolocationPermissionSet;
    410413    bool m_geolocationPermission;
     414    bool m_rejectsProtectionSpaceAndContinueForAuthenticationChallenges;
    411415    bool m_handlesAuthenticationChallenges;
    412416    bool m_isPrinting;
  • trunk/Tools/DumpRenderTree/mac/ResourceLoadDelegate.mm

    r182017 r203743  
    196196- (void)webView:(WebView *)wv resource:(id)identifier didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge fromDataSource:(WebDataSource *)dataSource
    197197{
     198    if (gTestRunner->rejectsProtectionSpaceAndContinueForAuthenticationChallenges()) {
     199        printf("Simulating reject protection space and continue for authentication challenge\n");
     200
     201        [[challenge sender] rejectProtectionSpaceAndContinueWithChallenge:challenge];
     202        return;
     203    }
     204
    198205    if (!gTestRunner->handlesAuthenticationChallenges()) {
    199206        NSString *string = [NSString stringWithFormat:@"%@ - didReceiveAuthenticationChallenge - Simulating cancelled authentication sheet", identifier];
  • trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl

    r203075 r203743  
    200200
    201201    // Authentication
     202    void setRejectsProtectionSpaceAndContinueForAuthenticationChallenges(boolean value);
    202203    void setHandlesAuthenticationChallenges(boolean value);
    203204    void setShouldLogCanAuthenticateAgainstProtectionSpace(boolean value);
  • trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp

    r203075 r203743  
    908908}
    909909
     910void TestRunner::setRejectsProtectionSpaceAndContinueForAuthenticationChallenges(bool value)
     911{
     912    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetRejectsProtectionSpaceAndContinueForAuthenticationChallenges"));
     913    WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(value));
     914    WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), messageName.get(), messageBody.get());
     915}
     916   
    910917void TestRunner::setHandlesAuthenticationChallenges(bool handlesAuthenticationChallenges)
    911918{
    912     WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetHandlesAuthenticationChallenge"));
     919    WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetHandlesAuthenticationChallenges"));
    913920    WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(handlesAuthenticationChallenges));
    914921    WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), messageName.get(), messageBody.get());
  • trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h

    r203075 r203743  
    165165
    166166    // Authentication
     167    void setRejectsProtectionSpaceAndContinueForAuthenticationChallenges(bool);
    167168    void setHandlesAuthenticationChallenges(bool);
    168169    void setShouldLogCanAuthenticateAgainstProtectionSpace(bool);
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r203674 r203743  
    16121612    }
    16131613
     1614    if (m_rejectsProtectionSpaceAndContinueForAuthenticationChallenges) {
     1615        m_currentInvocation->outputText("Simulating reject protection space and continue for authentication challenge\n");
     1616        WKAuthenticationDecisionListenerRejectProtectionSpaceAndContinue(decisionListener);
     1617        return;
     1618    }
     1619
    16141620    std::string host = toSTD(adoptWK(WKProtectionSpaceCopyHost(protectionSpace)).get());
    16151621    int port = WKProtectionSpaceGetPort(protectionSpace);
  • trunk/Tools/WebKitTestRunner/TestController.h

    r203075 r203743  
    126126    WorkQueueManager& workQueueManager() { return m_workQueueManager; }
    127127
     128    void setRejectsProtectionSpaceAndContinueForAuthenticationChallenges(bool value) { m_rejectsProtectionSpaceAndContinueForAuthenticationChallenges = value; }
    128129    void setHandlesAuthenticationChallenges(bool value) { m_handlesAuthenticationChallenges = value; }
    129130    void setAuthenticationUsername(String username) { m_authenticationUsername = username; }
     
    325326    bool m_policyDelegatePermissive { false };
    326327
     328    bool m_rejectsProtectionSpaceAndContinueForAuthenticationChallenges { false };
    327329    bool m_handlesAuthenticationChallenges { false };
    328330    String m_authenticationUsername;
  • trunk/Tools/WebKitTestRunner/TestInvocation.cpp

    r203075 r203743  
    600600    }
    601601
    602     if (WKStringIsEqualToUTF8CString(messageName, "SetHandlesAuthenticationChallenge")) {
     602    if (WKStringIsEqualToUTF8CString(messageName, "SetRejectsProtectionSpaceAndContinueForAuthenticationChallenges")) {
     603        ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
     604        WKBooleanRef value = static_cast<WKBooleanRef>(messageBody);
     605        TestController::singleton().setRejectsProtectionSpaceAndContinueForAuthenticationChallenges(WKBooleanGetValue(value));
     606        return;
     607    }
     608
     609    if (WKStringIsEqualToUTF8CString(messageName, "SetHandlesAuthenticationChallenges")) {
    603610        ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
    604611        WKBooleanRef value = static_cast<WKBooleanRef>(messageBody);
Note: See TracChangeset for help on using the changeset viewer.