Changeset 221059 in webkit
- Timestamp:
- Aug 22, 2017 5:09:40 PM (7 years ago)
- Location:
- trunk/Source
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r221037 r221059 1 2017-08-22 Chris Dumez <cdumez@apple.com> 2 3 Introduce a new CompletionHandler type and use it for NetworkDataTaskClient's completion handlers to help catch bugs 4 https://bugs.webkit.org/show_bug.cgi?id=175832 5 6 Reviewed by Alex Christensen. 7 8 Introduce a new CompletionHandler type which wraps a WTF::Function and ensures via assertions 9 that the function is always called once and only once. 10 11 * WTF.xcodeproj/project.pbxproj: 12 * wtf/CompletionHandler.h: Added. 13 (WTF::CompletionHandler<Out): 14 1 15 2017-08-22 Alex Christensen <achristensen@webkit.org> 2 16 -
trunk/Source/WTF/WTF.xcodeproj/project.pbxproj
r220712 r221059 299 299 37C7CC291EA40A73007BD956 /* WeakLinking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakLinking.h; sourceTree = "<group>"; }; 300 300 430B47871AAAAC1A001223DA /* StringCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringCommon.h; sourceTree = "<group>"; }; 301 46BA9EAB1F4CD61E009A2BBC /* CompletionHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CompletionHandler.h; sourceTree = "<group>"; }; 301 302 513E170A1CD7D5BF00E3650B /* LoggingAccumulator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoggingAccumulator.h; sourceTree = "<group>"; }; 302 303 515F794B1CFC9F4A00CCED93 /* CrossThreadCopier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CrossThreadCopier.cpp; sourceTree = "<group>"; }; … … 760 761 0F8F2B90172E00F0007DBDA5 /* CompilationThread.h */, 761 762 A8A47270151A825A004123FF /* Compiler.h */, 763 46BA9EAB1F4CD61E009A2BBC /* CompletionHandler.h */, 762 764 0FDB698D1B7C643A000C1078 /* Condition.h */, 763 765 E38C41261EB4E0680042957D /* CPUTime.cpp */, … … 842 844 0FE164681B6FFC9600400E7C /* Lock.cpp */, 843 845 0FE164691B6FFC9600400E7C /* Lock.h */, 846 0F0FCDDD1DD167F900CCAB53 /* LockAlgorithm.h */, 844 847 0F31DD701F1308BC0072EB4A /* LockAlgorithmInlines.h */, 845 0F0FCDDD1DD167F900CCAB53 /* LockAlgorithm.h */,846 848 0F60F32D1DFCBD1B00416D6C /* LockedPrintStream.cpp */, 847 849 0F60F32E1DFCBD1B00416D6C /* LockedPrintStream.h */, … … 1317 1319 A8A473AA151A825B004123FF /* bignum.cc in Sources */, 1318 1320 A8A47451151A825B004123FF /* BinarySemaphore.cpp in Sources */, 1319 51F1752D1F3D486000C74950 /* PersistentEncoder.cpp in Sources */,1320 1321 A8A4738B151A825B004123FF /* BitVector.cpp in Sources */, 1321 A3E4DD931F3A803400DED0B4 /* TextStream.cpp in Sources */,1322 1322 DCEE22011CEA7551000C2396 /* BlockObjCExceptions.mm in Sources */, 1323 1323 A8A473AC151A825B004123FF /* cached-powers.cc in Sources */, … … 1326 1326 A8A47463151A825B004123FF /* CollatorICU.cpp in Sources */, 1327 1327 0F8F2B92172E0103007DBDA5 /* CompilationThread.cpp in Sources */, 1328 51F1752C1F3D486000C74950 /* PersistentDecoder.cpp in Sources */,1329 1328 E38C41281EB4E0680042957D /* CPUTime.cpp in Sources */, 1330 1329 E38C41251EB4E04C0042957D /* CPUTimeCocoa.mm in Sources */, … … 1341 1340 A8A473B0151A825B004123FF /* double-conversion.cc in Sources */, 1342 1341 A8A473BA151A825B004123FF /* dtoa.cpp in Sources */, 1343 51F1752B1F3D486000C74950 /* PersistentCoders.cpp in Sources */,1344 1342 A8A473B3151A825B004123FF /* fast-dtoa.cc in Sources */, 1345 1343 0F7C5FB61D885CF20044F5E2 /* FastBitVector.cpp in Sources */, … … 1348 1346 A8A473B5151A825B004123FF /* fixed-dtoa.cc in Sources */, 1349 1347 1A1D8B9E1731879800141DA4 /* FunctionDispatcher.cpp in Sources */, 1348 0F5BF1761F23D49A0029D91D /* Gigacage.cpp in Sources */, 1350 1349 0F30BA901E78708E002CA847 /* GlobalVersion.cpp in Sources */, 1351 1350 2CCD892A15C0390200285083 /* GregorianDateTime.cpp in Sources */, … … 1353 1352 0FE1646A1B6FFC9600400E7C /* Lock.cpp in Sources */, 1354 1353 0F60F32F1DFCBD1B00416D6C /* LockedPrintStream.cpp in Sources */, 1355 0FEC3C5E1F368A9700F59B6C /* ReadWriteLock.cpp in Sources */,1356 1354 53534F2A1EC0E10E00141B2F /* MachExceptions.defs in Sources */, 1357 1355 A8A473E5151A825B004123FF /* MainThread.cpp in Sources */, … … 1370 1368 0FFF19DC1BB334EB00886D91 /* ParallelHelperPool.cpp in Sources */, 1371 1369 0F824A681B7443A0002E345D /* ParkingLot.cpp in Sources */, 1370 51F1752B1F3D486000C74950 /* PersistentCoders.cpp in Sources */, 1371 51F1752C1F3D486000C74950 /* PersistentDecoder.cpp in Sources */, 1372 51F1752D1F3D486000C74950 /* PersistentEncoder.cpp in Sources */, 1372 1373 DCEE22031CEA7551000C2396 /* PlatformUserPreferredLanguagesMac.mm in Sources */, 1373 1374 0F9D3362165DBA73005AD387 /* PrintStream.cpp in Sources */, … … 1375 1376 A3B725EC987446AD93F1A440 /* RandomDevice.cpp in Sources */, 1376 1377 A8A47414151A825B004123FF /* RandomNumber.cpp in Sources */, 1378 0FEC3C5E1F368A9700F59B6C /* ReadWriteLock.cpp in Sources */, 1377 1379 A8A4741A151A825B004123FF /* RefCountedLeakCounter.cpp in Sources */, 1378 1380 2CDED0F318115C85004DBA70 /* RunLoop.cpp in Sources */, … … 1394 1396 A5BA15FC182435A600A82E69 /* StringImplCF.cpp in Sources */, 1395 1397 A5BA15F51824348000A82E69 /* StringImplMac.mm in Sources */, 1396 0F5BF1761F23D49A0029D91D /* Gigacage.cpp in Sources */,1397 1398 A5BA15F3182433A900A82E69 /* StringMac.mm in Sources */, 1398 1399 0FDDBFA71666DFA300C55FEF /* StringPrintStream.cpp in Sources */, … … 1405 1406 1C181C7F1D3078DA00F5FA16 /* TextBreakIterator.cpp in Sources */, 1406 1407 1C181C961D30800A00F5FA16 /* TextBreakIteratorInternalICUMac.mm in Sources */, 1408 A3E4DD931F3A803400DED0B4 /* TextStream.cpp in Sources */, 1409 E311FB171F0A568B003C08DE /* ThreadGroup.cpp in Sources */, 1407 1410 A8A4744A151A825B004123FF /* Threading.cpp in Sources */, 1408 1411 A8A4744E151A825B004123FF /* ThreadingPthreads.cpp in Sources */, 1409 E311FB171F0A568B003C08DE /* ThreadGroup.cpp in Sources */,1410 1412 5311BD5C1EA822F900525281 /* ThreadMessage.cpp in Sources */, 1411 1413 0F66B2901DC97BAB004A1D3F /* TimeWithDynamicClockType.cpp in Sources */, -
trunk/Source/WebKit/ChangeLog
r221055 r221059 1 2017-08-22 Chris Dumez <cdumez@apple.com> 2 3 Introduce a new CompletionHandler type and use it for NetworkDataTaskClient's completion handlers to help catch bugs 4 https://bugs.webkit.org/show_bug.cgi?id=175832 5 6 Reviewed by Alex Christensen. 7 8 Use new CompletionHandler type for NetworkDataTaskClient's completion handlers to help catch bugs. 9 It actually already found a bug in our HTTP 0.9 error handling which is fixed in this patch 10 as well. 11 12 * NetworkProcess/NetworkDataTask.cpp: 13 (WebKit::NetworkDataTask::didReceiveResponse): 14 * NetworkProcess/NetworkDataTask.h: 15 * NetworkProcess/cocoa/NetworkDataTaskCocoa.h: 16 * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm: 17 (WebKit::NetworkDataTaskCocoa::tryPasswordBasedAuthentication): 18 * Shared/Authentication/AuthenticationManager.cpp: 19 (WebKit::AuthenticationManager::tryUseCertificateInfoForChallenge): 20 * Shared/Authentication/AuthenticationManager.h: 21 * Shared/Authentication/mac/AuthenticationManager.mac.mm: 22 (WebKit::AuthenticationManager::tryUseCertificateInfoForChallenge): 23 1 24 2017-08-22 Alex Christensen <achristensen@webkit.org> 2 25 -
trunk/Source/WebKit/NetworkProcess/NetworkDataTask.cpp
r218765 r221059 104 104 std::optional<uint16_t> port = url.port(); 105 105 if (port && !isDefaultPortForProtocol(port.value(), url.protocol())) { 106 completionHandler({ }); 106 107 cancel(); 107 108 m_client->didCompleteWithError({ String(), 0, url, "Cancelled load from '" + url.stringCenterEllipsizedToLength() + "' because it is using HTTP/0.9." }); -
trunk/Source/WebKit/NetworkProcess/NetworkDataTask.h
r215065 r221059 37 37 #include <WebCore/ResourceRequest.h> 38 38 #include <WebCore/Timer.h> 39 #include <wtf/ Function.h>39 #include <wtf/CompletionHandler.h> 40 40 #include <wtf/text/WTFString.h> 41 41 … … 55 55 enum class AuthenticationChallengeDisposition; 56 56 57 typedef Function<void(const WebCore::ResourceRequest&)> RedirectCompletionHandler;58 typedef Function<void(AuthenticationChallengeDisposition, const WebCore::Credential&)> ChallengeCompletionHandler;59 typedef Function<void(WebCore::PolicyAction)> ResponseCompletionHandler;57 using RedirectCompletionHandler = CompletionHandler<void(const WebCore::ResourceRequest&)>; 58 using ChallengeCompletionHandler = CompletionHandler<void(AuthenticationChallengeDisposition, const WebCore::Credential&)>; 59 using ResponseCompletionHandler = CompletionHandler<void(WebCore::PolicyAction)>; 60 60 61 61 class NetworkDataTaskClient { -
trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.h
r212993 r221059 74 74 NetworkDataTaskCocoa(NetworkSession&, NetworkDataTaskClient&, const WebCore::ResourceRequest&, WebCore::StoredCredentials, WebCore::ContentSniffingPolicy, bool shouldClearReferrerOnHTTPSToHTTPRedirect); 75 75 76 bool tryPasswordBasedAuthentication(const WebCore::AuthenticationChallenge&, constChallengeCompletionHandler&);76 bool tryPasswordBasedAuthentication(const WebCore::AuthenticationChallenge&, ChallengeCompletionHandler&); 77 77 78 78 RefPtr<SandboxExtension> m_sandboxExtension; -
trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm
r220243 r221059 255 255 } 256 256 257 bool NetworkDataTaskCocoa::tryPasswordBasedAuthentication(const WebCore::AuthenticationChallenge& challenge, constChallengeCompletionHandler& completionHandler)257 bool NetworkDataTaskCocoa::tryPasswordBasedAuthentication(const WebCore::AuthenticationChallenge& challenge, ChallengeCompletionHandler& completionHandler) 258 258 { 259 259 if (!challenge.protectionSpace().isPasswordBased()) -
trunk/Source/WebKit/Shared/Authentication/AuthenticationManager.cpp
r219587 r221059 190 190 // Currently, only Mac knows how to respond to authentication challenges with certificate info. 191 191 #if !HAVE(SEC_IDENTITY) 192 bool AuthenticationManager::tryUseCertificateInfoForChallenge(const WebCore::AuthenticationChallenge&, const CertificateInfo&, constChallengeCompletionHandler&)192 bool AuthenticationManager::tryUseCertificateInfoForChallenge(const WebCore::AuthenticationChallenge&, const CertificateInfo&, ChallengeCompletionHandler&) 193 193 { 194 194 return false; -
trunk/Source/WebKit/Shared/Authentication/AuthenticationManager.h
r219587 r221059 31 31 #include "WebProcessSupplement.h" 32 32 #include <WebCore/AuthenticationChallenge.h> 33 #include <wtf/CompletionHandler.h> 33 34 #include <wtf/Forward.h> 34 #include <wtf/Function.h>35 35 #include <wtf/HashMap.h> 36 36 … … 55 55 RejectProtectionSpace 56 56 }; 57 typedef Function<void(AuthenticationChallengeDisposition, const WebCore::Credential&)> ChallengeCompletionHandler;57 using ChallengeCompletionHandler = CompletionHandler<void(AuthenticationChallengeDisposition, const WebCore::Credential&)>; 58 58 59 59 class AuthenticationManager : public WebProcessSupplement, public NetworkProcessSupplement, public IPC::MessageReceiver { … … 106 106 void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override; 107 107 108 bool tryUseCertificateInfoForChallenge(const WebCore::AuthenticationChallenge&, const WebCore::CertificateInfo&, constChallengeCompletionHandler&);108 bool tryUseCertificateInfoForChallenge(const WebCore::AuthenticationChallenge&, const WebCore::CertificateInfo&, ChallengeCompletionHandler&); 109 109 110 110 uint64_t addChallengeToChallengeMap(Challenge&&); -
trunk/Source/WebKit/Shared/Authentication/mac/AuthenticationManager.mac.mm
r210890 r221059 70 70 71 71 // FIXME: This function creates an identity from a certificate, which should not be needed. We should pass an identity over IPC (as we do on iOS). 72 bool AuthenticationManager::tryUseCertificateInfoForChallenge(const AuthenticationChallenge& challenge, const CertificateInfo& certificateInfo, constChallengeCompletionHandler& completionHandler)72 bool AuthenticationManager::tryUseCertificateInfoForChallenge(const AuthenticationChallenge& challenge, const CertificateInfo& certificateInfo, ChallengeCompletionHandler& completionHandler) 73 73 { 74 74 if (certificateInfo.isEmpty())
Note: See TracChangeset
for help on using the changeset viewer.