Title: [269140] branches/safari-610-branch
Revision
269140
Author
[email protected]
Date
2020-10-28 23:31:36 -0700 (Wed, 28 Oct 2020)

Log 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

Modified Paths

Diff

Modified: branches/safari-610-branch/Source/WebKit/ChangeLog (269139 => 269140)


--- branches/safari-610-branch/Source/WebKit/ChangeLog	2020-10-29 06:31:32 UTC (rev 269139)
+++ branches/safari-610-branch/Source/WebKit/ChangeLog	2020-10-29 06:31:36 UTC (rev 269140)
@@ -1,3 +1,50 @@
+2020-10-28  Russell Epstein  <[email protected]>
+
+        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
+
+    2020-10-27  Alex Christensen  <[email protected]>
+
+            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.
+
+            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):
+
 2020-10-27  Russell Epstein  <[email protected]>
 
         Cherry-pick r268878. rdar://problem/70733353

Modified: branches/safari-610-branch/Source/WebKit/Shared/mac/SecItemShim.cpp (269139 => 269140)


--- branches/safari-610-branch/Source/WebKit/Shared/mac/SecItemShim.cpp	2020-10-29 06:31:32 UTC (rev 269139)
+++ branches/safari-610-branch/Source/WebKit/Shared/mac/SecItemShim.cpp	2020-10-29 06:31:36 UTC (rev 269140)
@@ -143,7 +143,7 @@
 {
     globalNetworkProcess() = makeWeakPtr(process);
 
-#if PLATFORM(IOS_FAMILY)
+#if PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && !CPU(X86_64))
     struct _CFNFrameworksStubs stubs = {
         .version = 0,
         .SecItem_stub_CopyMatching = webSecItemCopyMatching,
@@ -155,7 +155,7 @@
     _CFURLConnectionSetFrameworkStubs(&stubs);
 #endif
 
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) && CPU(X86_64)
     const SecItemShimCallbacks callbacks = {
         webSecItemCopyMatching,
         webSecItemAdd,

Modified: branches/safari-610-branch/Tools/ChangeLog (269139 => 269140)


--- branches/safari-610-branch/Tools/ChangeLog	2020-10-29 06:31:32 UTC (rev 269139)
+++ branches/safari-610-branch/Tools/ChangeLog	2020-10-29 06:31:36 UTC (rev 269140)
@@ -1,3 +1,43 @@
+2020-10-28  Russell Epstein  <[email protected]>
+
+        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
+
+    2020-10-27  Alex Christensen  <[email protected]>
+
+            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.
+
+            * TestWebKitAPI/Tests/WebKitCocoa/Challenge.mm:
+            (TEST):
+
 2020-10-27  Russell Epstein  <[email protected]>
 
         Cherry-pick r268878. rdar://problem/70733353

Modified: branches/safari-610-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/Challenge.mm (269139 => 269140)


--- branches/safari-610-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/Challenge.mm	2020-10-29 06:31:32 UTC (rev 269139)
+++ branches/safari-610-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/Challenge.mm	2020-10-29 06:31:36 UTC (rev 269140)
@@ -345,6 +345,40 @@
     [[webView configuration].processPool _clearPermanentCredentialsForProtectionSpace:protectionSpace];
 }
 
+TEST(Challenge, BasicPersistentCredential)
+{
+    using namespace TestWebKitAPI;
+    HTTPServer server(HTTPServer::respondWithChallengeThenOK);
+    auto delegate = [[TestNavigationDelegate new] autorelease];
+    __block RetainPtr<NSURLProtectionSpace> protectionSpace;
+    auto credentialStorage = [NSURLCredentialStorage sharedCredentialStorage];
+    delegate.didReceiveAuthenticationChallenge = ^(WKWebView *, NSURLAuthenticationChallenge *challenge, void (^completionHandler)(NSURLSessionAuthChallengeDisposition, NSURLCredential *)) {
+        protectionSpace = challenge.protectionSpace;
+        NSURLCredential *existingCredential = [credentialStorage defaultCredentialForProtectionSpace:protectionSpace.get()];
+        EXPECT_NULL(existingCredential);
+        EXPECT_WK_STREQ(protectionSpace.get().authenticationMethod, NSURLAuthenticationMethodHTTPBasic);
+        completionHandler(NSURLSessionAuthChallengeUseCredential, [NSURLCredential credentialWithUser:@"testuser" password:@"testpassword" persistence:NSURLCredentialPersistencePermanent]);
+    };
+    auto webView = [[WKWebView new] autorelease];
+    webView.navigationDelegate = delegate;
+    [webView loadRequest:server.request()];
+    [delegate waitForDidFinishNavigation];
+
+    NSURLCredential *storedCredential = nil;
+    while (!storedCredential) {
+        storedCredential = [[NSURLCredentialStorage sharedCredentialStorage] defaultCredentialForProtectionSpace:protectionSpace.get()];
+        Util::spinRunLoop();
+    }
+    EXPECT_NOT_NULL(storedCredential);
+    EXPECT_WK_STREQ(storedCredential.user, "testuser");
+    EXPECT_WK_STREQ(storedCredential.password, "testpassword");
+    EXPECT_EQ(storedCredential.persistence, NSURLCredentialPersistencePermanent);
+
+    [credentialStorage removeCredential:storedCredential forProtectionSpace:protectionSpace.get()];
+    NSURLCredential *removedCredential = [credentialStorage defaultCredentialForProtectionSpace:protectionSpace.get()];
+    EXPECT_NULL(removedCredential);
+}
+
 #endif // HAVE(NETWORK_FRAMEWORK)
 
 #if HAVE(SSL)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to