summaryrefslogtreecommitdiff
path: root/chromium/content/common/unique_name_helper.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/content/common/unique_name_helper.cc')
-rw-r--r--chromium/content/common/unique_name_helper.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/chromium/content/common/unique_name_helper.cc b/chromium/content/common/unique_name_helper.cc
index 8aed7052e21..676e4412ded 100644
--- a/chromium/content/common/unique_name_helper.cc
+++ b/chromium/content/common/unique_name_helper.cc
@@ -248,15 +248,16 @@ std::string UniqueNameHelper::UpdateLegacyNameFromV24(
// tree and go down from there, it is impossible for a frame path to contain
// a unique name (which needs a replacement) that has not already been seen
// and inserted into |replacements|.
- size_t index = 0;
for (const auto& replacement : *replacements) {
+ // Note: this find() call should only start searching from immediately
+ // after the most recent replacement, to guarantee each section of the
+ // name is only replaced once. But it was accidentally omitted from the
+ // initial version of the migration code.
size_t next_index = legacy_name.find(replacement.old_name);
if (next_index == std::string::npos)
continue;
legacy_name.replace(next_index, replacement.old_name.size(),
replacement.new_name);
- index = next_index -
- (replacement.old_name.size() - replacement.new_name.size());
}
return legacy_name;
}