Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(695)

Unified Diff: ios/web/net/cert_verifier_block_adapter.cc

Issue 1392143003: Allways call didReceiveAuthenticationChallenge: completion handler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a unittest; Updated comments; Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ios/web/net/cert_verifier_block_adapter.cc
diff --git a/ios/web/net/cert_verifier_block_adapter.cc b/ios/web/net/cert_verifier_block_adapter.cc
index b56b414351dc19d806f198c60b9c004866c99831..baba2cccdc122abc99c7b9180d83b4a19673ebff 100644
--- a/ios/web/net/cert_verifier_block_adapter.cc
+++ b/ios/web/net/cert_verifier_block_adapter.cc
@@ -26,8 +26,8 @@ struct VerificationContext
net_log(net::BoundNetLog::Make(
net_log,
net::NetLog::SOURCE_IOS_WEB_VIEW_CERT_VERIFIER)) {}
- // Unowned verification request.
- net::CertVerifier::Request* request;
+ // Verification request must be alive until verification is completed.
Ryan Sleevi 2015/10/28 18:32:27 I find this comment a bit confusing. You're making
Eugene But (OOO till 7-30) 2015/10/29 15:43:38 Done.
+ scoped_ptr<net::CertVerifier::Request> request;
// The result of certificate verification.
net::CertVerifyResult result;
// Certificate being verified.
@@ -74,12 +74,6 @@ void CertVerifierBlockAdapter::Verify(
scoped_refptr<VerificationContext> context(
new VerificationContext(params.cert, net_log_));
net::CompletionCallback callback = base::BindBlock(^(int error) {
- // Remove pending request.
- auto request_iterator = std::find(
- pending_requests_.begin(), pending_requests_.end(), context->request);
- DCHECK(pending_requests_.end() != request_iterator);
- pending_requests_.erase(request_iterator);
-
completion_handler(context->result, error);
});
scoped_ptr<net::CertVerifier::Request> request;
@@ -88,10 +82,11 @@ void CertVerifierBlockAdapter::Verify(
params.crl_set.get(), &(context->result),
callback, &request, context->net_log);
if (error == net::ERR_IO_PENDING) {
- // Make sure that |net::CertVerifier::Request| is alive until either
- // verification is completed or CertVerifierBlockAdapter is destroyed.
- pending_requests_.push_back(request.Pass());
- context->request = pending_requests_.back();
+ // Make sure that |net::CertVerifier::Request| is alive until verification
+ // is completed. It means that cert verification request will not be
+ // cancellable but it will guarantee that |completion_handler| callback is
+ // always called by this method, which is a part of API contract.
Ryan Sleevi 2015/10/28 18:32:27 This still reads a bit... weird. // Keep the |net
Eugene But (OOO till 7-30) 2015/10/29 15:43:38 Done.
+ context->request = request.Pass();
// Completion handler will be called from |callback| when verification
// request is completed.
return;

Powered by Google App Engine
This is Rietveld 408576698