Commit 2c8708cc authored by noms's avatar noms Committed by Commit bot

Don't allow creating a profile with an empty name in chrome://settings

This is something I missed in https://codereview.chromium.org/532023003

BUG=413116
TEST=Go to chrome://settings and create a new profile. You should not be
able to save a name that's all spaces.

Review URL: https://codereview.chromium.org/562233002

Cr-Commit-Position: refs/heads/master@{#295064}
parent c71361c6
......@@ -86,7 +86,7 @@
<span id="create-profile-name-label" for="create-profile-name"
i18n-content="manageProfilesNameLabel">
</span>
<input id="create-profile-name" type="text" required>
<input id="create-profile-name" type="text" pattern=".*\S.*" required>
</label>
</div>
</div>
......
......@@ -82,6 +82,7 @@ void CreateProfileHandler::CreateProfile(const base::ListValue* args) {
bool supervised_user = false;
if (args->GetString(0, &name) && args->GetString(1, &icon)) {
base::TrimWhitespace(name, base::TRIM_ALL, &name);
CHECK(!name.empty());
if (args->GetBoolean(2, &create_shortcut)) {
bool success = args->GetBoolean(3, &supervised_user);
DCHECK(success);
......
......@@ -383,6 +383,7 @@ void ManageProfileHandler::SetProfileIconAndName(const base::ListValue* args) {
return;
base::TrimWhitespace(new_profile_name, base::TRIM_ALL, &new_profile_name);
CHECK(!new_profile_name.empty());
profiles::UpdateProfileName(profile, new_profile_name);
}
......
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