Fix for bug 216474 - Browser crashes in password manager. Ensure that we don't crash or overwrite variables used to hold valid password data fields with null. r=bryner

This commit is contained in:
ben%bengoodger.com 2003-08-17 21:06:36 +00:00
Родитель e2b1915ce5
Коммит 1482a2bd46
1 изменённых файлов: 14 добавлений и 9 удалений

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

@ -621,21 +621,26 @@ nsPasswordManager::OnStateChange(nsIWebProgress* aWebProgress,
nsCOMPtr<nsIForm> form = do_QueryInterface(formNode);
SignonDataEntry* firstMatch = nsnull;
nsCOMPtr<nsIDOMHTMLInputElement> userField, passField;
nsCOMPtr<nsIDOMHTMLInputElement> userField, passField;
nsCOMPtr<nsIDOMHTMLInputElement> temp;
for (SignonDataEntry* e = hashEnt->head; e; e = e->next) {
nsCOMPtr<nsISupports> foundNode;
form->ResolveName(e->userField, getter_AddRefs(foundNode));
userField = do_QueryInterface(foundNode);
if (!userField)
form->ResolveName(e->userField, getter_AddRefs(foundNode));
temp = do_QueryInterface(foundNode);
if (temp)
userField = temp;
else
continue;
form->ResolveName(e->passField, getter_AddRefs(foundNode));
passField = do_QueryInterface(foundNode);
if (!passField)
form->ResolveName(e->passField, getter_AddRefs(foundNode));
temp = do_QueryInterface(foundNode);
if (temp)
passField = temp;
else
continue;
if (firstMatch) {