Introduce a new CompletionHandler type and use it for NetworkDataTaskClient's complet...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Aug 2017 00:09:40 +0000 (00:09 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Aug 2017 00:09:40 +0000 (00:09 +0000)
commit08e659a75136765b3b1f173f792575bbb78fc056
tree244eff5bfbc9921efd484be20fc53bab350f62bc
parent6aef3531466f05b986bf171874a68a418ef076e2
Introduce a new CompletionHandler type and use it for NetworkDataTaskClient's completion handlers to help catch bugs
https://bugs.webkit.org/show_bug.cgi?id=175832

Reviewed by Alex Christensen.

Source/WebKit:

Use new CompletionHandler type for NetworkDataTaskClient's completion handlers to help catch bugs.
It actually already found a bug in our HTTP 0.9 error handling which is fixed in this patch
as well.

* NetworkProcess/NetworkDataTask.cpp:
(WebKit::NetworkDataTask::didReceiveResponse):
* NetworkProcess/NetworkDataTask.h:
* NetworkProcess/cocoa/NetworkDataTaskCocoa.h:
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::tryPasswordBasedAuthentication):
* Shared/Authentication/AuthenticationManager.cpp:
(WebKit::AuthenticationManager::tryUseCertificateInfoForChallenge):
* Shared/Authentication/AuthenticationManager.h:
* Shared/Authentication/mac/AuthenticationManager.mac.mm:
(WebKit::AuthenticationManager::tryUseCertificateInfoForChallenge):

Source/WTF:

Introduce a new CompletionHandler type which wraps a WTF::Function and ensures via assertions
that the function is always called once and only once.

* WTF.xcodeproj/project.pbxproj:
* wtf/CompletionHandler.h: Added.
(WTF::CompletionHandler<Out):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221059 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WTF/ChangeLog
Source/WTF/WTF.xcodeproj/project.pbxproj
Source/WTF/wtf/CompletionHandler.h [new file with mode: 0644]
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkDataTask.cpp
Source/WebKit/NetworkProcess/NetworkDataTask.h
Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.h
Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm
Source/WebKit/Shared/Authentication/AuthenticationManager.cpp
Source/WebKit/Shared/Authentication/AuthenticationManager.h
Source/WebKit/Shared/Authentication/mac/AuthenticationManager.mac.mm