diff --git a/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp b/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp
index dacb77846eb..c5cabf89054 100644
--- a/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp
+++ b/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp
@@ -1714,9 +1714,22 @@ nsGfxTextControlFrame2::CreateAnonymousContent(nsIPresContext* aPresContext,
// Now call SetTextControlFrameState() which will make the
// neccessary editor calls to set the default value.
+ // Make sure to turn off undo before setting the default
+ // value, and turn it back on afterwards. This will make
+ // sure we can't undo past the default value.
+
+ rv = mEditor->EnableUndo(PR_FALSE);
+
+ if (NS_FAILED(rv))
+ return rv;
SetTextControlFrameState(defaultValue);
+ rv = mEditor->EnableUndo(PR_TRUE);
+
+ if (NS_FAILED(rv))
+ return rv;
+
// Now restore the original editor flags.
rv = mEditor->SetFlags(editorFlags);