Bug 1372369 - Part 1: Update input element's value when all fields are available and let DOM HTMLInputElement sanitize it. r=smaug

In this patch, we change it so that we always set the input element's value
once all fields are available and let DOM HTMLInputElement sanitize it. The
value after sanitization is not updated in the displayed input box, but may
display an error message (this will be done in Part 2) if needed.
Also, when any of the field's value is deleted, we will set input element's
value back to the empty string, so that a value is not accidentally submitted.

MozReview-Commit-ID: 9NAL8UlkoBK
This commit is contained in:
Jessica Jong
2017-06-16 02:09:00 -04:00
parent 97a8252f78
commit 4c8f007035
2 changed files with 17 additions and 61 deletions

View File

@@ -3089,7 +3089,8 @@ HTMLInputElement::SetValueInternal(const nsAString& aValue,
}
} else if ((mType == NS_FORM_INPUT_TIME ||
mType == NS_FORM_INPUT_DATE) &&
!IsExperimentalMobileType(mType)) {
!IsExperimentalMobileType(mType) &&
!(aFlags & nsTextEditorState::eSetValue_BySetUserInput)) {
nsDateTimeControlFrame* frame = do_QueryFrame(GetPrimaryFrame());
if (frame) {
frame->UpdateInputBoxValue();