Bug 1135451 - fillForm() cleanup part H: rename isFormDisabled to be obvious as to purpose. r=MattN

This commit is contained in:
Justin Dolske 2015-02-27 15:47:37 -08:00
Родитель 07aed12389
Коммит 18afdcff7a
1 изменённых файлов: 10 добавлений и 17 удалений

Просмотреть файл

@ -637,6 +637,13 @@ var LoginManagerContent = {
return; return;
} }
var isAutocompleteOff = false;
if (this._isAutocompleteDisabled(form) ||
this._isAutocompleteDisabled(usernameField) ||
this._isAutocompleteDisabled(passwordField)) {
isAutocompleteOff = true;
}
// Discard logins which have username/password values that don't // Discard logins which have username/password values that don't
// fit into the fields (as specified by the maxlength attribute). // fit into the fields (as specified by the maxlength attribute).
// The user couldn't enter these values anyway, and it helps // The user couldn't enter these values anyway, and it helps
@ -678,20 +685,6 @@ var LoginManagerContent = {
return; return;
} }
// If the form has an autocomplete=off attribute in play, don't
// fill in the login automatically. We check this after attaching
// the autocomplete stuff to the username field, so the user can
// still manually select a login to be filled in.
var isFormDisabled = false;
if (!ignoreAutocomplete &&
(this._isAutocompleteDisabled(form) ||
this._isAutocompleteDisabled(usernameField) ||
this._isAutocompleteDisabled(passwordField))) {
isFormDisabled = true;
log("form not filled, has autocomplete=off");
}
// Select a login to use for filling in the form. // Select a login to use for filling in the form.
var selectedLogin; var selectedLogin;
if (usernameField && (usernameField.value || usernameField.disabled || usernameField.readOnly)) { if (usernameField && (usernameField.value || usernameField.disabled || usernameField.readOnly)) {
@ -742,13 +735,13 @@ var LoginManagerContent = {
// We will always have a selectedLogin at this point. // We will always have a selectedLogin at this point.
if (!autofillForm) { if (!autofillForm) {
log("autofillForms=false but form can be filled; notified observers"); log("autofillForms=false but form can be filled");
recordAutofillResult(AUTOFILL_RESULT.NO_AUTOFILL_FORMS); recordAutofillResult(AUTOFILL_RESULT.NO_AUTOFILL_FORMS);
return; return;
} }
if (isFormDisabled) { if (isAutocompleteOff && !ignoreAutocomplete) {
log("autocomplete=off but form can be filled; notified observers"); log("Not filling the login because we're respecting autocomplete=off");
recordAutofillResult(AUTOFILL_RESULT.AUTOCOMPLETE_OFF); recordAutofillResult(AUTOFILL_RESULT.AUTOCOMPLETE_OFF);
return; return;
} }