Title: [193654] trunk/Source/WebKit2
Revision
193654
Author
cdu...@apple.com
Date
2015-12-07 14:44:33 -0800 (Mon, 07 Dec 2015)

Log Message

[WK2] Regression(r187691): If a page is showing an auth pane in one tab, any new tabs with same page hang until credentials are entered in first tab
https://bugs.webkit.org/show_bug.cgi?id=151960
<rdar://problem/23618112>

Reviewed by Alex Christensen.

After r187691, if a page is showing an auth pane in one tab, any new
tabs with same page hang until credentials are entered in first tab.
This is because we coalescing all authentication challenges from the
same domain, no matter what tab they are for. This can be confusing
so we now only coalesce authentication challenges within each tab,
by leveraging the pageID (in addition to the domain).

* Shared/Authentication/AuthenticationManager.cpp:
(WebKit::AuthenticationManager::shouldCoalesceChallenge):
(WebKit::AuthenticationManager::coalesceChallengesMatching):
(WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
* Shared/Authentication/AuthenticationManager.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (193653 => 193654)


--- trunk/Source/WebKit2/ChangeLog	2015-12-07 22:32:27 UTC (rev 193653)
+++ trunk/Source/WebKit2/ChangeLog	2015-12-07 22:44:33 UTC (rev 193654)
@@ -1,3 +1,24 @@
+2015-12-07  Chris Dumez  <cdu...@apple.com>
+
+        [WK2] Regression(r187691): If a page is showing an auth pane in one tab, any new tabs with same page hang until credentials are entered in first tab
+        https://bugs.webkit.org/show_bug.cgi?id=151960
+        <rdar://problem/23618112>
+
+        Reviewed by Alex Christensen.
+
+        After r187691, if a page is showing an auth pane in one tab, any new
+        tabs with same page hang until credentials are entered in first tab.
+        This is because we coalescing all authentication challenges from the
+        same domain, no matter what tab they are for. This can be confusing
+        so we now only coalesce authentication challenges within each tab,
+        by leveraging the pageID (in addition to the domain).
+
+        * Shared/Authentication/AuthenticationManager.cpp:
+        (WebKit::AuthenticationManager::shouldCoalesceChallenge):
+        (WebKit::AuthenticationManager::coalesceChallengesMatching):
+        (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge):
+        * Shared/Authentication/AuthenticationManager.h:
+
 2015-12-07  Beth Dakin  <bda...@apple.com>
 
         Hook up request and show for typing candidates in WK1

Modified: trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.cpp (193653 => 193654)


--- trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.cpp	2015-12-07 22:32:27 UTC (rev 193653)
+++ trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.cpp	2015-12-07 22:44:33 UTC (rev 193654)
@@ -76,13 +76,13 @@
     return challengeID;
 }
 
-bool AuthenticationManager::shouldCoalesceChallenge(uint64_t challengeID, const AuthenticationChallenge& challenge) const
+bool AuthenticationManager::shouldCoalesceChallenge(uint64_t pageID, uint64_t challengeID, const AuthenticationChallenge& challenge) const
 {
     if (!canCoalesceChallenge(challenge))
         return false;
 
     for (auto& item : m_challenges) {
-        if (item.key != challengeID && ProtectionSpace::compare(challenge.protectionSpace(), item.value.challenge.protectionSpace()))
+        if (item.key != challengeID && item.value.pageID == pageID && ProtectionSpace::compare(challenge.protectionSpace(), item.value.challenge.protectionSpace()))
             return true;
     }
     return false;
@@ -100,7 +100,7 @@
         return challengesToCoalesce;
 
     for (auto& item : m_challenges) {
-        if (item.key != challengeID && ProtectionSpace::compare(challenge.challenge.protectionSpace(), item.value.challenge.protectionSpace()))
+        if (item.key != challengeID && item.value.pageID == challenge.pageID && ProtectionSpace::compare(challenge.challenge.protectionSpace(), item.value.challenge.protectionSpace()))
             challengesToCoalesce.append(item.key);
     }
 
@@ -112,14 +112,15 @@
     ASSERT(frame);
     ASSERT(frame->page());
 
-    uint64_t challengeID = addChallengeToChallengeMap({authenticationChallenge
+    auto pageID = frame->page()->pageID();
+    uint64_t challengeID = addChallengeToChallengeMap({pageID, authenticationChallenge
 #if USE(NETWORK_SESSION)
         , ChallengeCompletionHandler()
 #endif
     });
 
-    // Coalesce challenges in the same protection space.
-    if (shouldCoalesceChallenge(challengeID, authenticationChallenge))
+    // Coalesce challenges in the same protection space and in the same page.
+    if (shouldCoalesceChallenge(pageID, challengeID, authenticationChallenge))
         return;
     
     m_process->send(Messages::WebPageProxy::DidReceiveAuthenticationChallenge(frame->frameID(), authenticationChallenge, challengeID), frame->page()->pageID());
@@ -131,8 +132,10 @@
     ASSERT(pageID);
     ASSERT(frameID);
 
-    uint64_t challengeID = addChallengeToChallengeMap({authenticationChallenge, completionHandler});
-    if (shouldCoalesceChallenge(challengeID, authenticationChallenge))
+    uint64_t challengeID = addChallengeToChallengeMap({pageID, authenticationChallenge, completionHandler});
+
+    // Coalesce challenges in the same protection space and in the same page.
+    if (shouldCoalesceChallenge(pageID, challengeID, authenticationChallenge))
         return;
     
     m_process->send(Messages::NetworkProcessProxy::DidReceiveAuthenticationChallenge(pageID, frameID, authenticationChallenge, challengeID));
@@ -143,12 +146,14 @@
     ASSERT(pageID);
     ASSERT(frameID);
 
-    uint64_t challengeID = addChallengeToChallengeMap({authenticationChallenge
+    uint64_t challengeID = addChallengeToChallengeMap({pageID, authenticationChallenge
 #if USE(NETWORK_SESSION)
         , ChallengeCompletionHandler()
 #endif
     });
-    if (shouldCoalesceChallenge(challengeID, authenticationChallenge))
+
+    // Coalesce challenges in the same protection space and in the same page.
+    if (shouldCoalesceChallenge(pageID, challengeID, authenticationChallenge))
         return;
     
     m_process->send(Messages::NetworkProcessProxy::DidReceiveAuthenticationChallenge(pageID, frameID, authenticationChallenge, challengeID));
@@ -157,8 +162,11 @@
 #if !USE(NETWORK_SESSION)
 void AuthenticationManager::didReceiveAuthenticationChallenge(Download* download, const AuthenticationChallenge& authenticationChallenge)
 {
-    uint64_t challengeID = addChallengeToChallengeMap({authenticationChallenge});
-    if (shouldCoalesceChallenge(challengeID, authenticationChallenge))
+    uint64_t dummyPageID = 0;
+    uint64_t challengeID = addChallengeToChallengeMap({dummyPageID, authenticationChallenge});
+
+    // Coalesce challenges in the same protection space and in the same page.
+    if (shouldCoalesceChallenge(dummyPageID, challengeID, authenticationChallenge))
         return;
 
     download->send(Messages::DownloadProxy::DidReceiveAuthenticationChallenge(authenticationChallenge, challengeID));

Modified: trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.h (193653 => 193654)


--- trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.h	2015-12-07 22:32:27 UTC (rev 193653)
+++ trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.h	2015-12-07 22:44:33 UTC (rev 193654)
@@ -74,6 +74,7 @@
 
 private:
     struct Challenge {
+        uint64_t pageID;
         WebCore::AuthenticationChallenge challenge;
 #if USE(NETWORK_SESSION)
         ChallengeCompletionHandler completionHandler;
@@ -86,7 +87,7 @@
     bool tryUseCertificateInfoForChallenge(const WebCore::AuthenticationChallenge&, const WebCore::CertificateInfo&);
 
     uint64_t addChallengeToChallengeMap(const Challenge&);
-    bool shouldCoalesceChallenge(uint64_t challengeID, const WebCore::AuthenticationChallenge&) const;
+    bool shouldCoalesceChallenge(uint64_t pageID, uint64_t challengeID, const WebCore::AuthenticationChallenge&) const;
 
     void useCredentialForSingleChallenge(uint64_t challengeID, const WebCore::Credential&, const WebCore::CertificateInfo&);
     void continueWithoutCredentialForSingleChallenge(uint64_t challengeID);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to