⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 269140 in webkit


Ignore:
Timestamp:
Oct 28, 2020, 11:31:36 PM (6 years ago)
Author:
Russell Epstein
Message:

Cherry-pick r269094. rdar://problem/70795299

Use _CFURLConnectionSetFrameworkStubs for SecItemShim instead of DYLD_INTERPOSE on Apple Silicon Macs
https://bugs.webkit.org/show_bug.cgi?id=218269
<rdar://problem/70491533>

Reviewed by Darin Adler.

Source/WebKit:

r171066 introduced the use of _CFURLConnectionSetFrameworkStubs on iOS for CFNetwork to be able
to get and set credentials as the UI process. This is also needed on Apple Silicon Macs.
We should eventually replace it with an even cleaner per-NSURLSession solution, but this is a step
in the right direction, and I verified manually that it fixes the radar.

Covered by an API test that used to fail on Apple Silicon Macs.

  • Shared/mac/SecItemShim.cpp: (WebKit::initializeSecItemShim):

Tools:

  • TestWebKitAPI/Tests/WebKitCocoa/Challenge.mm: (TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269094 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
branches/safari-610-branch
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-610-branch/Source/WebKit/ChangeLog

    r269087 r269140  
     12020-10-28  Russell Epstein  <repstein@apple.com>
     2
     3        Cherry-pick r269094. rdar://problem/70795299
     4
     5    Use _CFURLConnectionSetFrameworkStubs for SecItemShim instead of DYLD_INTERPOSE on Apple Silicon Macs
     6    https://bugs.webkit.org/show_bug.cgi?id=218269
     7    <rdar://problem/70491533>
     8   
     9    Reviewed by Darin Adler.
     10   
     11    Source/WebKit:
     12   
     13    r171066 introduced the use of _CFURLConnectionSetFrameworkStubs on iOS for CFNetwork to be able
     14    to get and set credentials as the UI process.  This is also needed on Apple Silicon Macs.
     15    We should eventually replace it with an even cleaner per-NSURLSession solution, but this is a step
     16    in the right direction, and I verified manually that it fixes the radar.
     17   
     18    Covered by an API test that used to fail on Apple Silicon Macs.
     19   
     20    * Shared/mac/SecItemShim.cpp:
     21    (WebKit::initializeSecItemShim):
     22   
     23    Tools:
     24   
     25    * TestWebKitAPI/Tests/WebKitCocoa/Challenge.mm:
     26    (TEST):
     27   
     28    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269094 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     29
     30    2020-10-27  Alex Christensen  <achristensen@webkit.org>
     31
     32            Use _CFURLConnectionSetFrameworkStubs for SecItemShim instead of DYLD_INTERPOSE on Apple Silicon Macs
     33            https://bugs.webkit.org/show_bug.cgi?id=218269
     34            <rdar://problem/70491533>
     35
     36            Reviewed by Darin Adler.
     37
     38            r171066 introduced the use of _CFURLConnectionSetFrameworkStubs on iOS for CFNetwork to be able
     39            to get and set credentials as the UI process.  This is also needed on Apple Silicon Macs.
     40            We should eventually replace it with an even cleaner per-NSURLSession solution, but this is a step
     41            in the right direction, and I verified manually that it fixes the radar.
     42
     43            Covered by an API test that used to fail on Apple Silicon Macs.
     44
     45            * Shared/mac/SecItemShim.cpp:
     46            (WebKit::initializeSecItemShim):
     47
    1482020-10-27  Russell Epstein  <repstein@apple.com>
    249
  • branches/safari-610-branch/Source/WebKit/Shared/mac/SecItemShim.cpp

    r248014 r269140  
    144144    globalNetworkProcess() = makeWeakPtr(process);
    145145
    146 #if PLATFORM(IOS_FAMILY)
     146#if PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && !CPU(X86_64))
    147147    struct _CFNFrameworksStubs stubs = {
    148148        .version = 0,
     
    156156#endif
    157157
    158 #if PLATFORM(MAC)
     158#if PLATFORM(MAC) && CPU(X86_64)
    159159    const SecItemShimCallbacks callbacks = {
    160160        webSecItemCopyMatching,
  • branches/safari-610-branch/Tools/ChangeLog

    r269087 r269140  
     12020-10-28  Russell Epstein  <repstein@apple.com>
     2
     3        Cherry-pick r269094. rdar://problem/70795299
     4
     5    Use _CFURLConnectionSetFrameworkStubs for SecItemShim instead of DYLD_INTERPOSE on Apple Silicon Macs
     6    https://bugs.webkit.org/show_bug.cgi?id=218269
     7    <rdar://problem/70491533>
     8   
     9    Reviewed by Darin Adler.
     10   
     11    Source/WebKit:
     12   
     13    r171066 introduced the use of _CFURLConnectionSetFrameworkStubs on iOS for CFNetwork to be able
     14    to get and set credentials as the UI process.  This is also needed on Apple Silicon Macs.
     15    We should eventually replace it with an even cleaner per-NSURLSession solution, but this is a step
     16    in the right direction, and I verified manually that it fixes the radar.
     17   
     18    Covered by an API test that used to fail on Apple Silicon Macs.
     19   
     20    * Shared/mac/SecItemShim.cpp:
     21    (WebKit::initializeSecItemShim):
     22   
     23    Tools:
     24   
     25    * TestWebKitAPI/Tests/WebKitCocoa/Challenge.mm:
     26    (TEST):
     27   
     28    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269094 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     29
     30    2020-10-27  Alex Christensen  <achristensen@webkit.org>
     31
     32            Use _CFURLConnectionSetFrameworkStubs for SecItemShim instead of DYLD_INTERPOSE on Apple Silicon Macs
     33            https://bugs.webkit.org/show_bug.cgi?id=218269
     34            <rdar://problem/70491533>
     35
     36            Reviewed by Darin Adler.
     37
     38            * TestWebKitAPI/Tests/WebKitCocoa/Challenge.mm:
     39            (TEST):
     40
    1412020-10-27  Russell Epstein  <repstein@apple.com>
    242
  • branches/safari-610-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/Challenge.mm

    r265150 r269140  
    344344    // Clear persistent credentials created by this test.
    345345    [[webView configuration].processPool _clearPermanentCredentialsForProtectionSpace:protectionSpace];
     346}
     347
     348TEST(Challenge, BasicPersistentCredential)
     349{
     350    using namespace TestWebKitAPI;
     351    HTTPServer server(HTTPServer::respondWithChallengeThenOK);
     352    auto delegate = [[TestNavigationDelegate new] autorelease];
     353    __block RetainPtr<NSURLProtectionSpace> protectionSpace;
     354    auto credentialStorage = [NSURLCredentialStorage sharedCredentialStorage];
     355    delegate.didReceiveAuthenticationChallenge = ^(WKWebView *, NSURLAuthenticationChallenge *challenge, void (^completionHandler)(NSURLSessionAuthChallengeDisposition, NSURLCredential *)) {
     356        protectionSpace = challenge.protectionSpace;
     357        NSURLCredential *existingCredential = [credentialStorage defaultCredentialForProtectionSpace:protectionSpace.get()];
     358        EXPECT_NULL(existingCredential);
     359        EXPECT_WK_STREQ(protectionSpace.get().authenticationMethod, NSURLAuthenticationMethodHTTPBasic);
     360        completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialWithUser:@"testuser" password:@"testpassword" persistence:NSURLCredentialPersistencePermanent]);
     361    };
     362    auto webView = [[WKWebView new] autorelease];
     363    webView.navigationDelegate = delegate;
     364    [webView loadRequest:server.request()];
     365    [delegate waitForDidFinishNavigation];
     366
     367    NSURLCredential *storedCredential = nil;
     368    while (!storedCredential) {
     369        storedCredential = [[NSURLCredentialStorage sharedCredentialStorage] defaultCredentialForProtectionSpace:protectionSpace.get()];
     370        Util::spinRunLoop();
     371    }
     372    EXPECT_NOT_NULL(storedCredential);
     373    EXPECT_WK_STREQ(storedCredential.user, "testuser");
     374    EXPECT_WK_STREQ(storedCredential.password, "testpassword");
     375    EXPECT_EQ(storedCredential.persistence, NSURLCredentialPersistencePermanent);
     376
     377    [credentialStorage removeCredential:storedCredential forProtectionSpace:protectionSpace.get()];
     378    NSURLCredential *removedCredential = [credentialStorage defaultCredentialForProtectionSpace:protectionSpace.get()];
     379    EXPECT_NULL(removedCredential);
    346380}
    347381
Note: See TracChangeset for help on using the changeset viewer.