diff --git a/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp b/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp index 6ab790fb370..12e72883373 100644 --- a/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp +++ b/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp @@ -2906,7 +2906,10 @@ nsGfxTextControlFrame2::SetTextControlFrameState(const nsAReadableString& aValue flags &= ~(nsIHTMLEditor::eEditorDisabledMask); flags &= ~(nsIHTMLEditor::eEditorReadonlyMask); mEditor->SetFlags(flags); - htmlEditor->InsertText(currentValue); + if (currentValue.Length() < 1) + mEditor->DeleteSelection(nsIEditor::eNone); + else + htmlEditor->InsertText(currentValue); mEditor->SetFlags(savedFlags); if (domSel) domSel->EndBatchChanges();