Title: [91554] trunk/Source/WebCore
Revision
91554
Author
psola...@apple.com
Date
2011-07-21 22:27:03 -0700 (Thu, 21 Jul 2011)

Log Message

https://bugs.webkit.org/show_bug.cgi?id=65002
Get authentication to work with USE(CFNETWORK) on Mac

Reviewed by David Kilzer.

Instead of creating a new CFURLAuthChallengeRef, we save and reuse the same object as the
one given to us by CFNetwork.

* platform/network/mac/AuthenticationMac.mm:
(-[WebCoreAuthenticationClientAsChallengeSender setCFChallenge:]): Accessor methods for the
new CFURLAuthChallengeRef ivar.
(-[WebCoreAuthenticationClientAsChallengeSender cfChallenge]):
(WebCore::core): Create AuthenticationChallenge using the saved CFURLAuthChallengeRef.
(WebCore::mac): Use the CFURLAuthChallengeRef object in AuthenticationChallenge instead of
creating a new one.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (91553 => 91554)


--- trunk/Source/WebCore/ChangeLog	2011-07-22 05:24:24 UTC (rev 91553)
+++ trunk/Source/WebCore/ChangeLog	2011-07-22 05:27:03 UTC (rev 91554)
@@ -1,3 +1,21 @@
+2011-07-21  Pratik Solanki  <psola...@apple.com>
+
+        https://bugs.webkit.org/show_bug.cgi?id=65002
+        Get authentication to work with USE(CFNETWORK) on Mac
+
+        Reviewed by David Kilzer.
+
+        Instead of creating a new CFURLAuthChallengeRef, we save and reuse the same object as the
+        one given to us by CFNetwork.
+
+        * platform/network/mac/AuthenticationMac.mm:
+        (-[WebCoreAuthenticationClientAsChallengeSender setCFChallenge:]): Accessor methods for the
+        new CFURLAuthChallengeRef ivar.
+        (-[WebCoreAuthenticationClientAsChallengeSender cfChallenge]):
+        (WebCore::core): Create AuthenticationChallenge using the saved CFURLAuthChallengeRef.
+        (WebCore::mac): Use the CFURLAuthChallengeRef object in AuthenticationChallenge instead of
+        creating a new one.
+
 2011-07-21  Kent Tamura  <tk...@chromium.org>
 
         REGRESSION(r90971): Placeholder and search cancel button are visible even in elements with visibility:hidden.

Modified: trunk/Source/WebCore/platform/network/mac/AuthenticationMac.mm (91553 => 91554)


--- trunk/Source/WebCore/platform/network/mac/AuthenticationMac.mm	2011-07-22 05:24:24 UTC (rev 91553)
+++ trunk/Source/WebCore/platform/network/mac/AuthenticationMac.mm	2011-07-22 05:27:03 UTC (rev 91554)
@@ -43,7 +43,6 @@
 @end
 
 @interface NSURLAuthenticationChallenge (Details)
--(CFURLAuthChallengeRef)_createCFAuthChallenge;
 +(NSURLAuthenticationChallenge *)_authenticationChallengeForCFAuthChallenge:(CFURLAuthChallengeRef)cfChallenge sender:(id <NSURLAuthenticationChallengeSender>)sender;
 @end
 
@@ -59,6 +58,9 @@
 @interface WebCoreAuthenticationClientAsChallengeSender : NSObject <NSURLAuthenticationChallengeSender>
 {
     AuthenticationClient* m_client;
+#if USE(CFNETWORK)
+    CFURLAuthChallengeRef m_cfChallenge;
+#endif
 }
 - (id)initWithAuthenticationClient:(AuthenticationClient*)client;
 - (AuthenticationClient*)client;
@@ -104,6 +106,18 @@
         m_client->receivedCancellation(core(challenge));
 }
 
+#if USE(CFNETWORK)
+- (void)setCFChallenge:(CFURLAuthChallengeRef)challenge
+{
+    m_cfChallenge = challenge;
+}
+
+- (CFURLAuthChallengeRef)cfChallenge
+{
+    return m_cfChallenge;
+}
+#endif
+
 @end
 
 namespace WebCore {
@@ -113,8 +127,7 @@
 AuthenticationChallenge core(NSURLAuthenticationChallenge *macChallenge)
 {
     WebCoreAuthenticationClientAsChallengeSender *challengeSender = (WebCoreAuthenticationClientAsChallengeSender*) [macChallenge sender];
-    AuthenticationClient* authClient = [challengeSender client];
-    return AuthenticationChallenge([macChallenge _createCFAuthChallenge], authClient);
+    return AuthenticationChallenge([challengeSender cfChallenge], [challengeSender client]);
 }
 
 Credential core(NSURLCredential *macCredential)
@@ -137,7 +150,10 @@
 {
     AuthenticationClient* authClient = coreChallenge.authenticationClient();
     RetainPtr<WebCoreAuthenticationClientAsChallengeSender> challengeSender(AdoptNS, [[WebCoreAuthenticationClientAsChallengeSender alloc] initWithAuthenticationClient:authClient]);
-    RetainPtr<CFURLAuthChallengeRef> authChallenge(AdoptCF, createCF(coreChallenge));
+    RetainPtr<CFURLAuthChallengeRef> authChallenge = coreChallenge.cfURLAuthChallengeRef();
+    if (!authChallenge)
+        authChallenge.adoptCF(createCF(coreChallenge));
+    [challengeSender.get() setCFChallenge:authChallenge.get()];
     return [[NSURLAuthenticationChallenge _authenticationChallengeForCFAuthChallenge:authChallenge.get() sender:challengeSender.get()] autorelease];
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to