Commit 46daf5f3 authored by Christoph Schwering's avatar Christoph Schwering Committed by Commit Bot

[Autofill] Handle unstable refill identifiers in TriggerRefill().

FormStructure::GetIdentifierForRefill() is not stable across dynamic
changes. If a cache update happens before the refill is executed,
the identifier may change in the meantime and we may thus refer
to the wrong form.

Bug: 1114787
Change-Id: I6792829192414e8e52d239b62899ea45e0465a3a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2404162Reviewed-by: default avatarDominic Battré <battre@chromium.org>
Reviewed-by: default avatarMatthias Körber <koerber@google.com>
Commit-Queue: Christoph Schwering <schwering@google.com>
Cr-Commit-Position: refs/heads/master@{#806148}
parent 66562c2a
...@@ -2518,7 +2518,12 @@ void AutofillManager::TriggerRefill(const FormData& form) { ...@@ -2518,7 +2518,12 @@ void AutofillManager::TriggerRefill(const FormData& form) {
auto itr = auto itr =
filling_contexts_map_.find(form_structure->GetIdentifierForRefill()); filling_contexts_map_.find(form_structure->GetIdentifierForRefill());
DCHECK(itr != filling_contexts_map_.end());
// Since GetIdentifierForRefill() is not stable across dynamic changes,
// |filling_contexts_map_| may not contain the element anymore.
if (itr == filling_contexts_map_.end())
return;
FillingContext* filling_context = itr->second.get(); FillingContext* filling_context = itr->second.get();
// The refill attempt can happen from different paths, some of which happen // The refill attempt can happen from different paths, some of which happen
......
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