bug 530367 - passwords from password manager flash in clear text r=neil
authorBrad Lassey <blassey@mozilla.com>
Wed, 25 Nov 2009 12:41:23 -0500
changeset 35233 2e8553f076f8bfe418eb65e0265e9ec7b6514ad6
parent 35232 d76583175408f2e6fe03ff69408e0831e6a0e7c7
child 35234 da736df98b8c2f48470af8a7e980837334790025
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersneil
bugs530367
milestone1.9.3a1pre
bug 530367 - passwords from password manager flash in clear text r=neil
editor/idl/nsIPlaintextEditor.idl
editor/libeditor/text/nsTextEditRules.cpp
layout/forms/nsTextControlFrame.cpp
--- a/editor/idl/nsIPlaintextEditor.idl
+++ b/editor/idl/nsIPlaintextEditor.idl
@@ -51,16 +51,17 @@ interface nsIPlaintextEditor : nsISuppor
   const long eEditorDisabledMask        = 0x0010; /* all events are disabled (like scrolling).  Editor will not accept focus. */
   const long eEditorFilterInputMask     = 0x0020; /* text input is limited to certain character types, use mFilter */
   const long eEditorMailMask            = 0x0040; /* use mail-compose editing rules */
   const long eEditorUseAsyncUpdatesMask = 0x0080; /* prevent immediate reflows and view refreshes */
   const long eEditorEnableWrapHackMask  = 0x0100; /* allow the editor to set font: monospace on the root node */
   const long eEditorWidgetMask          = 0x0200; /* bit for widgets */
   const long eEditorNoCSSMask           = 0x0400; /* this HTML editor should not create css styles */
   const long eEditorAllowInteraction    = 0x0800; /*  */
+  const long eEditorDontEchoPassword    = 0x1000;
 
   /*
    * The valid values for newlines handling.
    * Can't change the values unless we remove
    * use of the pref.
    */
   const long eNewlinesPasteIntact                = 0;
   const long eNewlinesPasteToFirst               = 1;
--- a/editor/libeditor/text/nsTextEditRules.cpp
+++ b/editor/libeditor/text/nsTextEditRules.cpp
@@ -667,17 +667,18 @@ nsTextEditRules::WillInsertText(PRInt32 
   }
 
   if (mFlags & nsIPlaintextEditor::eEditorPasswordMask)
   {
     // manage the password buffer
     mPasswordText.Insert(*outString, start);
 
     nsCOMPtr<nsILookAndFeel> lookAndFeel = do_GetService(kLookAndFeelCID);
-    if (lookAndFeel->GetEchoPassword()) {
+    if (lookAndFeel->GetEchoPassword() && 
+        !(mFlags & nsIPlaintextEditor::eEditorDontEchoPassword)) {
       if (mPasswordText.Length() > outString->Length()) {
         HideLastPWInput();
       }
       mLastStart = start;
       mLastLength = outString->Length();
       if (mTimer)
       {
         mTimer->Cancel();
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -2670,16 +2670,17 @@ nsTextControlFrame::SetValue(const nsASt
         // get the flags, remove readonly and disabled, set the value,
         // restore flags
         PRUint32 flags, savedFlags;
         editor->GetFlags(&savedFlags);
         flags = savedFlags;
         flags &= ~(nsIPlaintextEditor::eEditorDisabledMask);
         flags &= ~(nsIPlaintextEditor::eEditorReadonlyMask);
         flags |= nsIPlaintextEditor::eEditorUseAsyncUpdatesMask;
+        flags |= nsIPlaintextEditor::eEditorDontEchoPassword;
         editor->SetFlags(flags);
 
         // Also don't enforce max-length here
         PRInt32 savedMaxLength;
         plaintextEditor->GetMaxTextLength(&savedMaxLength);
         plaintextEditor->SetMaxTextLength(-1);
 
         if (currentValue.Length() < 1)