diff --git a/dom/html/nsTextEditorState.cpp b/dom/html/nsTextEditorState.cpp
index 2e1f1f986b2..9b19b9b6d45 100644
--- a/dom/html/nsTextEditorState.cpp
+++ b/dom/html/nsTextEditorState.cpp
@@ -1298,6 +1298,13 @@ nsTextEditorState::PrepareEditor(const nsAString *aValue)
}
newEditor = mEditor; // just pretend that we have a new editor!
+
+ // Don't lose application flags in the process.
+ uint32_t originalFlags = 0;
+ newEditor->GetFlags(&originalFlags);
+ if (originalFlags & nsIPlaintextEditor::eEditorMailMask) {
+ editorFlags |= nsIPlaintextEditor::eEditorMailMask;
+ }
}
// Get the current value of the textfield from the content.