Bug 1501376 - Part 1. Pasting into GeckoView briefly displays text content in password field. r=masayuki

When inputting any character in password field, character isn't masked
immediately since echo password is turned on Android. But when pasting text,
the text is masked immediately on Blink and Android OS.

So we should adopt this behaviour on Gecko too.

Differential Revision: https://phabricator.services.mozilla.com/D10530

--HG--
extra : rebase_source : b4bc026569e61fee697cb538719216fb258a11ae
This commit is contained in:
Makoto Kato 2018-11-02 16:33:58 +09:00
Родитель 379404ac50
Коммит ad68faeb0f
1 изменённых файлов: 15 добавлений и 4 удалений

Просмотреть файл

@ -768,7 +768,7 @@ TextEditRules::WillInsertText(EditSubAction aEditSubAction,
// manage the password buffer
mPasswordText.Insert(*outString, start);
if (LookAndFeel::GetEchoPassword() && !DontEchoPassword()) {
if (!DontEchoPassword()) {
nsresult rv = HideLastPasswordInputInternal();
mLastStart = start;
mLastLength = outString->Length();
@ -901,8 +901,7 @@ TextEditRules::WillSetText(bool* aCancel,
return NS_OK;
}
if (IsPasswordEditor() && LookAndFeel::GetEchoPassword() &&
!DontEchoPassword()) {
if (IsPasswordEditor() && !DontEchoPassword()) {
// Echo password timer will implement on InsertText.
return NS_OK;
}
@ -1865,7 +1864,19 @@ TextEditRules::IsMailEditor() const
bool
TextEditRules::DontEchoPassword() const
{
return mTextEditor ? mTextEditor->DontEchoPassword() : false;
if (!mTextEditor) {
// XXX Why do we use echo password if editor is null?
return false;
}
if (!LookAndFeel::GetEchoPassword() || mTextEditor->DontEchoPassword()) {
return true;
}
if (mTextEditor->GetEditAction() != EditAction::eDrop &&
mTextEditor->GetEditAction() != EditAction::ePaste) {
return false;
}
return true;
}
} // namespace mozilla