Closed Bug 1568753 Opened 5 years ago Closed 5 years ago

nsIEditor.mask() can throw NS_ERROR_ILLEGAL_VALUE on empty fields when autoMaskingEnabled=false

Categories

(Core :: DOM: Editor, defect, P1)

68 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox69 --- unaffected
firefox70 --- fixed

People

(Reporter: MattN, Assigned: masayuki)

References

Details

(Whiteboard: [passwords:generation] [skyline])

Attachments

(1 file)

I may have found a bug with the new password masking APIs but I'm not sure if an empty field is supposed to behave in a special way:
STR:

  1. Have an empty type=password field
  2. field.editor.autoMaskingEnabled => true
  3. field.editor.unmask(0)
  4. field.editor.autoMaskingEnabled => false
  5. field.editor.mask()

Expected result:

  • Field should be masked again for future input
  • field.editor.autoMaskingEnabled should be true

Actual result:

  • Field is masked for future input
  • NS_ERROR_ILLEGAL_VALUE thrown from nsIEditor.mask
  • field.editor.autoMaskingEnabled is true (changed from false to true despite the error)
Flags: needinfo?(masayuki)
Assignee: nobody → masayuki
Status: NEW → ASSIGNED
Flags: needinfo?(masayuki)
Priority: -- → P1

aStart of TextEditor::SetUnmaskRangeInternal() may be UINT32_MAX if
it's called for stopping unmasking. However, it returns NS_ERROR_INVALID_ARG
if there is no text node and aStart is not 0, but this is unexpected behavior.

Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/a54fcf822e11
Make `TextEditor::SetUnmaskRangeInternal()` return NS_OK if there is no text node and `aStart` is `UINT32_MAX` r=m_kato
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: