Changeset 187691 in webkit
- Timestamp:
- Jul 31, 2015 4:56:00 PM (9 years ago)
- Location:
- trunk/Source
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r187688 r187691 1 2015-07-31 Chris Dumez <cdumez@apple.com> 2 3 Coalesce authentication credential requests 4 https://bugs.webkit.org/show_bug.cgi?id=128006 5 <rdar://problem/16839069> 6 7 Reviewed by Alexey Proskuryakov. 8 9 Export symbol for ProtectionSpace::compare() so it can be called from 10 WebKit2. 11 12 * platform/network/ProtectionSpaceBase.h: 13 1 14 2015-07-31 Eric Carlson <eric.carlson@apple.com> 2 15 -
trunk/Source/WebCore/platform/network/ProtectionSpaceBase.h
r187367 r187691 73 73 bool encodingRequiresPlatformData() const { return false; } 74 74 75 static bool compare(const ProtectionSpace& a, const ProtectionSpace& b);75 WEBCORE_EXPORT static bool compare(const ProtectionSpace&, const ProtectionSpace&); 76 76 77 77 protected: -
trunk/Source/WebKit2/ChangeLog
r187682 r187691 1 2015-07-31 Chris Dumez <cdumez@apple.com> 2 3 Coalesce concurrent authentication challenges for the same ProtectionSpace 4 https://bugs.webkit.org/show_bug.cgi?id=147496 5 <rdar://problem/16839069> 6 7 Reviewed by Alexey Proskuryakov. 8 9 Coalesce concurrent authentication challenges for the same ProtectionSpace. 10 Ideally, this would be done in the network layer but short term, this will 11 make sure the user no longer gets repeating authentication dialogs for the 12 same protection space. 13 14 This gets rid of a long-standing bug in WebKit / Safari where visiting a 15 site using HTTP authentication would pop up one authentication dialog for 16 each subresource being loaded from the network (especially when the main 17 resource is loaded from the cache). 18 19 * Shared/Authentication/AuthenticationManager.cpp: 20 (WebKit::canCoalesceChallenge): 21 (WebKit::AuthenticationManager::addChallengeToChallengeMap): 22 (WebKit::AuthenticationManager::shouldCoalesceChallenge): 23 (WebKit::AuthenticationManager::coalesceChallengesMatching): 24 (WebKit::AuthenticationManager::didReceiveAuthenticationChallenge): 25 (WebKit::AuthenticationManager::useCredentialForChallenge): 26 (WebKit::AuthenticationManager::useCredentialForSingleChallenge): 27 (WebKit::AuthenticationManager::continueWithoutCredentialForChallenge): 28 (WebKit::AuthenticationManager::continueWithoutCredentialForSingleChallenge): 29 (WebKit::AuthenticationManager::cancelChallenge): 30 (WebKit::AuthenticationManager::cancelSingleChallenge): 31 (WebKit::AuthenticationManager::performDefaultHandling): 32 (WebKit::AuthenticationManager::performDefaultHandlingForSingleChallenge): 33 (WebKit::AuthenticationManager::rejectProtectionSpaceAndContinue): 34 (WebKit::AuthenticationManager::rejectProtectionSpaceAndContinueForSingleChallenge): 35 (WebKit::AuthenticationManager::AuthenticationManager): Deleted. 36 * Shared/Authentication/AuthenticationManager.h: 37 1 38 2015-07-31 Joseph Pecoraro <pecoraro@apple.com> 2 39 -
trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.cpp
r183861 r187691 54 54 } 55 55 56 static bool canCoalesceChallenge(const WebCore::AuthenticationChallenge& challenge) 57 { 58 // Do not coalesce server trust evaluation requests because ProtectionSpace comparison does not evaluate server trust (e.g. certificate). 59 return challenge.protectionSpace().authenticationScheme() != ProtectionSpaceAuthenticationSchemeServerTrustEvaluationRequested; 60 } 61 56 62 const char* AuthenticationManager::supplementName() 57 63 { … … 65 71 } 66 72 67 uint64_t AuthenticationManager:: establishIdentifierForChallenge(const WebCore::AuthenticationChallenge& authenticationChallenge)73 uint64_t AuthenticationManager::addChallengeToChallengeMap(const WebCore::AuthenticationChallenge& authenticationChallenge) 68 74 { 69 75 ASSERT(RunLoop::isMain()); … … 74 80 } 75 81 82 bool AuthenticationManager::shouldCoalesceChallenge(uint64_t challengeID, const AuthenticationChallenge& challenge) const 83 { 84 if (!canCoalesceChallenge(challenge)) 85 return false; 86 87 auto end = m_challenges.end(); 88 for (auto it = m_challenges.begin(); it != end; ++it) { 89 if (it->key != challengeID && ProtectionSpace::compare(challenge.protectionSpace(), it->value.protectionSpace())) 90 return true; 91 } 92 return false; 93 } 94 95 Vector<uint64_t> AuthenticationManager::coalesceChallengesMatching(uint64_t challengeID) const 96 { 97 AuthenticationChallenge challenge = m_challenges.get(challengeID); 98 ASSERT(!challenge.isNull()); 99 100 Vector<uint64_t> challengesToCoalesce; 101 challengesToCoalesce.append(challengeID); 102 103 if (!canCoalesceChallenge(challenge)) 104 return challengesToCoalesce; 105 106 auto end = m_challenges.end(); 107 for (auto it = m_challenges.begin(); it != end; ++it) { 108 if (it->key != challengeID && ProtectionSpace::compare(challenge.protectionSpace(), it->value.protectionSpace())) 109 challengesToCoalesce.append(it->key); 110 } 111 112 return challengesToCoalesce; 113 } 114 76 115 void AuthenticationManager::didReceiveAuthenticationChallenge(WebFrame* frame, const AuthenticationChallenge& authenticationChallenge) 77 116 { 78 117 ASSERT(frame); 79 118 ASSERT(frame->page()); 80 81 m_process->send(Messages::WebPageProxy::DidReceiveAuthenticationChallenge(frame->frameID(), authenticationChallenge, establishIdentifierForChallenge(authenticationChallenge)), frame->page()->pageID()); 119 120 uint64_t challengeID = addChallengeToChallengeMap(authenticationChallenge); 121 122 // Coalesce challenges in the same protection space. 123 if (shouldCoalesceChallenge(challengeID, authenticationChallenge)) 124 return; 125 126 m_process->send(Messages::WebPageProxy::DidReceiveAuthenticationChallenge(frame->frameID(), authenticationChallenge, challengeID), frame->page()->pageID()); 82 127 } 83 128 … … 87 132 ASSERT(pageID); 88 133 ASSERT(frameID); 89 90 m_process->send(Messages::NetworkProcessProxy::DidReceiveAuthenticationChallenge(pageID, frameID, authenticationChallenge, establishIdentifierForChallenge(authenticationChallenge))); 134 135 uint64_t challengeID = addChallengeToChallengeMap(authenticationChallenge); 136 if (shouldCoalesceChallenge(challengeID, authenticationChallenge)) 137 return; 138 139 m_process->send(Messages::NetworkProcessProxy::DidReceiveAuthenticationChallenge(pageID, frameID, authenticationChallenge, addChallengeToChallengeMap(authenticationChallenge))); 91 140 } 92 141 #endif … … 94 143 void AuthenticationManager::didReceiveAuthenticationChallenge(Download* download, const AuthenticationChallenge& authenticationChallenge) 95 144 { 96 download->send(Messages::DownloadProxy::DidReceiveAuthenticationChallenge(authenticationChallenge, establishIdentifierForChallenge(authenticationChallenge))); 145 uint64_t challengeID = addChallengeToChallengeMap(authenticationChallenge); 146 if (shouldCoalesceChallenge(challengeID, authenticationChallenge)) 147 return; 148 149 download->send(Messages::DownloadProxy::DidReceiveAuthenticationChallenge(authenticationChallenge, addChallengeToChallengeMap(authenticationChallenge))); 97 150 } 98 151 … … 109 162 ASSERT(RunLoop::isMain()); 110 163 164 for (auto& coalescedChallengeID : coalesceChallengesMatching(challengeID)) 165 useCredentialForSingleChallenge(coalescedChallengeID, credential, certificateInfo); 166 } 167 168 void AuthenticationManager::useCredentialForSingleChallenge(uint64_t challengeID, const Credential& credential, const CertificateInfo& certificateInfo) 169 { 111 170 AuthenticationChallenge challenge = m_challenges.take(challengeID); 112 171 ASSERT(!challenge.isNull()); … … 130 189 ASSERT(RunLoop::isMain()); 131 190 191 for (auto& coalescedChallengeID : coalesceChallengesMatching(challengeID)) 192 continueWithoutCredentialForSingleChallenge(coalescedChallengeID); 193 } 194 195 void AuthenticationManager::continueWithoutCredentialForSingleChallenge(uint64_t challengeID) 196 { 132 197 AuthenticationChallenge challenge = m_challenges.take(challengeID); 133 198 ASSERT(!challenge.isNull()); … … 147 212 ASSERT(RunLoop::isMain()); 148 213 214 for (auto& coalescedChallengeID : coalesceChallengesMatching(challengeID)) 215 cancelSingleChallenge(coalescedChallengeID); 216 } 217 218 void AuthenticationManager::cancelSingleChallenge(uint64_t challengeID) 219 { 149 220 AuthenticationChallenge challenge = m_challenges.take(challengeID); 150 221 ASSERT(!challenge.isNull()); … … 164 235 ASSERT(RunLoop::isMain()); 165 236 237 for (auto& coalescedChallengeID : coalesceChallengesMatching(challengeID)) 238 performDefaultHandlingForSingleChallenge(coalescedChallengeID); 239 } 240 241 void AuthenticationManager::performDefaultHandlingForSingleChallenge(uint64_t challengeID) 242 { 166 243 AuthenticationChallenge challenge = m_challenges.take(challengeID); 167 244 ASSERT(!challenge.isNull()); … … 181 258 ASSERT(RunLoop::isMain()); 182 259 260 for (auto& coalescedChallengeID : coalesceChallengesMatching(challengeID)) 261 rejectProtectionSpaceAndContinueForSingleChallenge(coalescedChallengeID); 262 } 263 264 void AuthenticationManager::rejectProtectionSpaceAndContinueForSingleChallenge(uint64_t challengeID) 265 { 183 266 AuthenticationChallenge challenge = m_challenges.take(challengeID); 184 267 ASSERT(!challenge.isNull()); -
trunk/Source/WebKit2/Shared/Authentication/AuthenticationManager.h
r177917 r187691 74 74 bool tryUseCertificateInfoForChallenge(const WebCore::AuthenticationChallenge&, const WebCore::CertificateInfo&); 75 75 76 uint64_t establishIdentifierForChallenge(const WebCore::AuthenticationChallenge&); 76 uint64_t addChallengeToChallengeMap(const WebCore::AuthenticationChallenge&); 77 bool shouldCoalesceChallenge(uint64_t challengeID, const WebCore::AuthenticationChallenge&) const; 78 79 void useCredentialForSingleChallenge(uint64_t challengeID, const WebCore::Credential&, const WebCore::CertificateInfo&); 80 void continueWithoutCredentialForSingleChallenge(uint64_t challengeID); 81 void cancelSingleChallenge(uint64_t challengeID); 82 void performDefaultHandlingForSingleChallenge(uint64_t challengeID); 83 void rejectProtectionSpaceAndContinueForSingleChallenge(uint64_t challengeID); 84 85 Vector<uint64_t> coalesceChallengesMatching(uint64_t challengeID) const; 77 86 78 87 ChildProcess* m_process;
Note: See TracChangeset
for help on using the changeset viewer.