зеркало из https://github.com/mozilla/pjs.git
Bug 350785: Form Manager stores data even if autocomplete is off, r=bsmedberg,mano
This commit is contained in:
Родитель
72a83d9143
Коммит
0e6946f837
|
@ -564,15 +564,15 @@ nsFormFillController::Focus(nsIDOMEvent* aEvent)
|
|||
|
||||
nsAutoString autocomplete;
|
||||
input->GetAttribute(NS_LITERAL_STRING("autocomplete"), autocomplete);
|
||||
if (type.Equals(NS_LITERAL_STRING("text")) && !isReadOnly &&
|
||||
!autocomplete.EqualsIgnoreCase("off")) {
|
||||
if (type.LowerCaseEqualsLiteral("text") && !isReadOnly &&
|
||||
!autocomplete.LowerCaseEqualsLiteral("off")) {
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLFormElement> form;
|
||||
input->GetForm(getter_AddRefs(form));
|
||||
if (form)
|
||||
form->GetAttribute(NS_LITERAL_STRING("autocomplete"), autocomplete);
|
||||
|
||||
if (!form || !autocomplete.EqualsIgnoreCase("off"))
|
||||
if (!form || !autocomplete.LowerCaseEqualsLiteral("off"))
|
||||
StartControllingInput(input);
|
||||
}
|
||||
|
||||
|
|
|
@ -342,11 +342,15 @@ nsFormHistory::Notify(nsIContent* aFormNode, nsIDOMWindowInternal* aWindow, nsIU
|
|||
nsCOMPtr<nsIDOMHTMLFormElement> formElt = do_QueryInterface(aFormNode);
|
||||
NS_ENSURE_TRUE(formElt, NS_ERROR_FAILURE);
|
||||
|
||||
NS_NAMED_LITERAL_STRING(kAutoComplete, "autocomplete");
|
||||
nsAutoString autocomplete;
|
||||
formElt->GetAttribute(kAutoComplete, autocomplete);
|
||||
if (autocomplete.LowerCaseEqualsLiteral("off"))
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLCollection> elts;
|
||||
formElt->GetElements(getter_AddRefs(elts));
|
||||
|
||||
const char *textString = "text";
|
||||
|
||||
|
||||
PRUint32 length;
|
||||
elts->GetLength(&length);
|
||||
for (PRUint32 i = 0; i < length; ++i) {
|
||||
|
@ -354,10 +358,13 @@ nsFormHistory::Notify(nsIContent* aFormNode, nsIDOMWindowInternal* aWindow, nsIU
|
|||
elts->Item(i, getter_AddRefs(node));
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> inputElt = do_QueryInterface(node);
|
||||
if (inputElt) {
|
||||
// Filter only inputs that are of type "text"
|
||||
// Filter only inputs that are of type "text" without autocomplete="off"
|
||||
nsAutoString type;
|
||||
inputElt->GetType(type);
|
||||
if (type.EqualsIgnoreCase(textString)) {
|
||||
nsAutoString autocomplete;
|
||||
inputElt->GetAttribute(kAutoComplete, autocomplete);
|
||||
if (type.LowerCaseEqualsLiteral("text") &&
|
||||
!autocomplete.LowerCaseEqualsLiteral("off")) {
|
||||
// If this input has a name/id and value, add it to the database
|
||||
nsAutoString value;
|
||||
inputElt->GetValue(value);
|
||||
|
@ -366,7 +373,6 @@ nsFormHistory::Notify(nsIContent* aFormNode, nsIDOMWindowInternal* aWindow, nsIU
|
|||
inputElt->GetName(name);
|
||||
if (name.IsEmpty())
|
||||
inputElt->GetId(name);
|
||||
|
||||
if (!name.IsEmpty())
|
||||
AddEntry(name, value);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче