Commit a8bf8fe8 authored by avi's avatar avi Committed by Commit bot

In case of an error in AutofillCounter's queries, do not crash.

Before OnWebDataServiceRequestDone is called for a request, the request is marked as being complete by being removed from the WebDataRequestManager's pending_requests_ map.

When a query from AutofillCounter fails, it is handled inside OnWebDataServiceRequestDone. By that time, it has been removed from the pending_requests_ map and is no longer allowed to be canceled. Therefore, make sure that AutofillCounter marks it as being complete so that it doesn't try to cancel it.

BUG=672823

Review-Url: https://codereview.chromium.org/2555373007
Cr-Commit-Position: refs/heads/master@{#437885}
parent 16cf6923
......@@ -81,7 +81,20 @@ void AutofillCounter::OnWebDataServiceRequestDone(
WebDataServiceBase::Handle handle,
std::unique_ptr<WDTypedResult> result) {
DCHECK(thread_checker_.CalledOnValidThread());
if (!result) {
// CancelAllRequests will cancel all queries that are active; the query that
// just failed is complete and cannot be canceled so zero it out.
if (handle == suggestions_query_) {
suggestions_query_ = 0;
} else if (handle == credit_cards_query_) {
credit_cards_query_ = 0;
} else if (handle == addresses_query_) {
addresses_query_ = 0;
} else {
NOTREACHED();
}
CancelAllRequests();
return;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment