Bug 451123. Make sure to not call SetValueInternal on file inputs. r+sr=sicking

This commit is contained in:
Boris Zbarsky 2008-08-25 13:21:28 -04:00
Родитель d8f5af72d4
Коммит 280f377f6d
3 изменённых файлов: 26 добавлений и 17 удалений

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

@ -0,0 +1,7 @@
<html>
<head>
</head>
<body>
<input type="file" type="file">
</body>
</html>

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

@ -4,4 +4,4 @@ load 338649-1.xhtml
load 339501-1.xhtml
load 339501-2.xhtml
load 423371-1.html
load 451123-1.html

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

@ -1997,23 +1997,25 @@ nsHTMLInputElement::ParseAttribute(PRInt32 aNamespaceID,
newType = NS_FORM_INPUT_TEXT;
}
// Make sure to do the check for newType being NS_FORM_INPUT_FILE and the
// corresponding SetValueInternal() call _before_ we set mType. That way
// the logic in SetValueInternal() will work right (that logic makes
// assumptions about our frame based on mType, but we won't have had time
// to recreate frames yet -- that happens later in the SetAttr()
// process).
if (newType == NS_FORM_INPUT_FILE) {
// These calls aren't strictly needed any more since we'll never
// confuse values and filenames. However they're there for backwards
// compat.
SetFileName(EmptyString());
SetValueInternal(EmptyString(), nsnull, PR_FALSE);
} else if (mType == NS_FORM_INPUT_FILE) {
SetFileName(EmptyString());
}
if (newType != mType) {
// Make sure to do the check for newType being NS_FORM_INPUT_FILE and
// the corresponding SetValueInternal() call _before_ we set mType.
// That way the logic in SetValueInternal() will work right (that logic
// makes assumptions about our frame based on mType, but we won't have
// had time to recreate frames yet -- that happens later in the
// SetAttr() process).
if (newType == NS_FORM_INPUT_FILE) {
// These calls aren't strictly needed any more since we'll never
// confuse values and filenames. However they're there for backwards
// compat.
SetFileName(EmptyString());
SetValueInternal(EmptyString(), nsnull, PR_FALSE);
} else if (mType == NS_FORM_INPUT_FILE) {
SetFileName(EmptyString());
}
mType = newType;
mType = newType;
}
return success;
}