Title: [174827] trunk/Source/WebCore
Revision
174827
Author
[email protected]
Date
2014-10-17 11:49:02 -0700 (Fri, 17 Oct 2014)

Log Message

[iOS] Crash when load is canceled while waiting for the user to type HTTP authentication credentials
https://bugs.webkit.org/show_bug.cgi?id=137826
rdar://problem/17329599

Reviewed by Brady Eidson.

No new tests, as we don't have a way to simulate details of user interaction with
an auth dialog.

* platform/network/cf/ResourceHandleCFNet.cpp:
(WebCore::ResourceHandle::receivedCredential):
(WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential):
(WebCore::ResourceHandle::receivedRequestToPerformDefaultHandling):
(WebCore::ResourceHandle::receivedChallengeRejection):
Added null checks before passing m_connection for CFNetwork functions, making this
match what Mac code does when sending a message to a nil receiver.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (174826 => 174827)


--- trunk/Source/WebCore/ChangeLog	2014-10-17 18:28:57 UTC (rev 174826)
+++ trunk/Source/WebCore/ChangeLog	2014-10-17 18:49:02 UTC (rev 174827)
@@ -1,3 +1,22 @@
+2014-10-17  Alexey Proskuryakov  <[email protected]>
+
+        [iOS] Crash when load is canceled while waiting for the user to type HTTP authentication credentials
+        https://bugs.webkit.org/show_bug.cgi?id=137826
+        rdar://problem/17329599
+
+        Reviewed by Brady Eidson.
+
+        No new tests, as we don't have a way to simulate details of user interaction with
+        an auth dialog.
+
+        * platform/network/cf/ResourceHandleCFNet.cpp:
+        (WebCore::ResourceHandle::receivedCredential):
+        (WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential):
+        (WebCore::ResourceHandle::receivedRequestToPerformDefaultHandling):
+        (WebCore::ResourceHandle::receivedChallengeRejection):
+        Added null checks before passing m_connection for CFNetwork functions, making this
+        match what Mac code does when sending a message to a nil receiver.
+
 2014-10-17  Simon Fraser  <[email protected]>
 
         Fix the iOS build.

Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp (174826 => 174827)


--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp	2014-10-17 18:28:57 UTC (rev 174826)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp	2014-10-17 18:49:02 UTC (rev 174827)
@@ -431,13 +431,15 @@
             urlToStore = challenge.failureResponse().url();      
         CredentialStorage::set(webCredential, challenge.protectionSpace(), urlToStore);
 
+        if (d->m_connection) {
 #if PLATFORM(COCOA)
-        CFURLConnectionUseCredential(d->m_connection.get(), webCredential.cfCredential(), challenge.cfURLAuthChallengeRef());
+            CFURLConnectionUseCredential(d->m_connection.get(), webCredential.cfCredential(), challenge.cfURLAuthChallengeRef());
 #else
-        RetainPtr<CFURLCredentialRef> cfCredential = adoptCF(createCF(webCredential));
-        CFURLConnectionUseCredential(d->m_connection.get(), cfCredential.get(), challenge.cfURLAuthChallengeRef());
+            RetainPtr<CFURLCredentialRef> cfCredential = adoptCF(createCF(webCredential));
+            CFURLConnectionUseCredential(d->m_connection.get(), cfCredential.get(), challenge.cfURLAuthChallengeRef());
 #endif
-    } else {
+        }
+    } else if (d->m_connection) {
 #if PLATFORM(COCOA)
         CFURLConnectionUseCredential(d->m_connection.get(), credential.cfCredential(), challenge.cfURLAuthChallengeRef());
 #else
@@ -457,7 +459,8 @@
     if (challenge != d->m_currentWebChallenge)
         return;
 
-    CFURLConnectionUseCredential(d->m_connection.get(), 0, challenge.cfURLAuthChallengeRef());
+    if (d->m_connection)
+        CFURLConnectionUseCredential(d->m_connection.get(), 0, challenge.cfURLAuthChallengeRef());
 
     clearAuthentication();
 }
@@ -480,7 +483,8 @@
     if (challenge != d->m_currentWebChallenge)
         return;
 
-    CFURLConnectionPerformDefaultHandlingForChallenge(d->m_connection.get(), challenge.cfURLAuthChallengeRef());
+    if (d->m_connection)
+        CFURLConnectionPerformDefaultHandlingForChallenge(d->m_connection.get(), challenge.cfURLAuthChallengeRef());
 
     clearAuthentication();
 }
@@ -493,7 +497,8 @@
     if (challenge != d->m_currentWebChallenge)
         return;
 
-    CFURLConnectionRejectChallenge(d->m_connection.get(), challenge.cfURLAuthChallengeRef());
+    if (d->m_connection)
+        CFURLConnectionRejectChallenge(d->m_connection.get(), challenge.cfURLAuthChallengeRef());
 
     clearAuthentication();
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to