forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change ReplaceStringPlaceholders() to allow only up to 9 placeholders.
Initially ReplaceStringPlaceholder() was written to allow not more than 9 placeholders, which means it would only parse a single digit after $. For example $11 was treated as a placeholder followed by a digit. The behavior of that function was changed in crrev.com/88190. After that change it allows more than 9 placeholders, but no longer supports placeholders followed by a digit. Documentation for that function in the header wasn't updated as part of that change, so it still states that there can be no more than 9 placeholders. ReplaceStringPlaceholder() is never used with more than 9 place holder. Extension localization API and Chrome's internal localization library both limit number of placeholders, see I18NCustomBindings::GetL10nMessage() and l10n_util::GetStringFUTF16(). So it's safe to revert to the old behavior. Also fixed the code to handle invalid placeholders explicitly and added a unittest for that case. BUG=168720 Review URL: https://codereview.chromium.org/1887713005 Cr-Commit-Position: refs/heads/master@{#387534}
- Loading branch information
1 parent
62ae3bb
commit 064d2a2
Showing
3 changed files
with
24 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters