If validator always stops submitting the form, I think that it seems that the suggested approach is reasonable to me. On the other hand, some web apps may depend on `maxlength` behavior at setting value or something. So, the new behavior should be used only for user input. Perhaps, when [`EditorBase::GetEditAction()`](https://searchfox.org/mozilla-central/rev/b7f3977978922d44c7d92ae01c0d4cc2baca7bc2/editor/libeditor/EditorBase.h#1238) returns [`EditAction::ePaste`, `EditAction::ePasteAsQuotation`, `EditAction::eDrop` or `EditAction::eReplaceText`](https://searchfox.org/mozilla-central/rev/b7f3977978922d44c7d92ae01c0d4cc2baca7bc2/editor/libeditor/EditAction.h#105,108,111,122) and [`EditorBase::GetEditActionPrincipal()`](https://searchfox.org/mozilla-central/rev/b7f3977978922d44c7d92ae01c0d4cc2baca7bc2/editor/libeditor/EditorBase.h#1229) returns `nullptr` or [principal of addons](https://searchfox.org/mozilla-central/rev/b7f3977978922d44c7d92ae01c0d4cc2baca7bc2/editor/libeditor/EditorBase.cpp#6176). But be aware about these points: * this won't work with `<input>.value` setting case from addon because the [`EditAction` is `EditAction::eSetText`](https://searchfox.org/mozilla-central/rev/b7f3977978922d44c7d92ae01c0d4cc2baca7bc2/editor/libeditor/TextEditor.cpp#1002), and [`TextControlState::SetValueWithTextEditor()` does not set proper principal](https://searchfox.org/mozilla-central/rev/b7f3977978922d44c7d92ae01c0d4cc2baca7bc2/dom/html/TextControlState.cpp#2826-2829). If you need to support this case, you need to change all its and its ancestor callers take the principal. * you **might** need to change `TextControlState::SetValueWithoutTextEditor()` for `EditAction::eReplaceText` case because we won't create `TextEditor` instance until it's actually required because of performance reason. But I don't find the truncating code of this case. Investigate this case. * you shouldn't run validation while IME composition for avoiding flickering the validate result. * for risk management, please make the new path can be enabled/disabled by pref.
Bug 1320229 Comment 12 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
If validator always stops submitting the form, I think that it seems that the suggested approach is reasonable to me. On the other hand, some web apps may depend on `maxlength` behavior at setting value or something. So, the new behavior should be used only for user input. Perhaps, when [`EditorBase::GetEditAction()`](https://searchfox.org/mozilla-central/rev/b7f3977978922d44c7d92ae01c0d4cc2baca7bc2/editor/libeditor/EditorBase.h#1238) returns [`EditAction::ePaste`, `EditAction::ePasteAsQuotation`, `EditAction::eDrop` or `EditAction::eReplaceText`](https://searchfox.org/mozilla-central/rev/b7f3977978922d44c7d92ae01c0d4cc2baca7bc2/editor/libeditor/EditAction.h#105,108,111,122) and [`EditorBase::GetEditActionPrincipal()`](https://searchfox.org/mozilla-central/rev/b7f3977978922d44c7d92ae01c0d4cc2baca7bc2/editor/libeditor/EditorBase.h#1229) returns `nullptr` or [principal of addons](https://searchfox.org/mozilla-central/rev/b7f3977978922d44c7d92ae01c0d4cc2baca7bc2/editor/libeditor/EditorBase.cpp#6176). But be aware about these points: * this won't work with `<input>.value` setting case from addon because the [`EditAction` is `EditAction::eSetText`](https://searchfox.org/mozilla-central/rev/b7f3977978922d44c7d92ae01c0d4cc2baca7bc2/editor/libeditor/TextEditor.cpp#1002), and [`TextControlState::SetValueWithTextEditor()` does not set proper principal](https://searchfox.org/mozilla-central/rev/b7f3977978922d44c7d92ae01c0d4cc2baca7bc2/dom/html/TextControlState.cpp#2826-2829). If you need to support this case, you need to change all its and its ancestor callers take the principal. * you **might** need to change [`TextControlState::SetValueWithoutTextEditor()`](https://searchfox.org/mozilla-central/rev/b7f3977978922d44c7d92ae01c0d4cc2baca7bc2/dom/html/TextControlState.cpp#2941) for `EditAction::eReplaceText` case because we won't create `TextEditor` instance until it's actually required because of performance reason. But I don't find the truncating code of this case. Investigate this case. * you shouldn't run validation while IME composition for avoiding flickering the validate result. * for risk management, please make the new path can be enabled/disabled by pref.