Bug 1840307 - Add logging code around secure event input management r=m_kato

We've not put secure event input calls into the log.

Bug 1754683 could be caused by wrong management of it because I couldn't
find any wrong point from the log.  Therefore, I'd like to land this.

Differential Revision: https://phabricator.services.mozilla.com/D181951
This commit is contained in:
Masayuki Nakano 2023-06-28 05:27:19 +00:00
Родитель 0c07916b28
Коммит a556987dbe
1 изменённых файлов: 19 добавлений и 0 удалений

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

@ -3151,11 +3151,26 @@ nsresult IMEInputHandler::NotifyIME(TextEventDispatcher* aTextEventDispatcher,
case NOTIFY_IME_OF_FOCUS:
if (IsFocused()) {
nsIWidget* widget = aTextEventDispatcher->GetWidget();
MOZ_LOG(
gIMELog, LogLevel::Debug,
("%p IMEInputHandler::NotifyIME(), IsFocused()=true, widget=%p, IsPasswordEditor()=%s",
this, widget, TrueOrFalse(widget && widget->GetInputContext().IsPasswordEditor())));
if (widget && widget->GetInputContext().IsPasswordEditor()) {
EnableSecureEventInput();
} else {
EnsureSecureEventInputDisabled();
}
} else if (MOZ_LOG_TEST(gIMELog, LogLevel::Debug)) {
NS_OBJC_BEGIN_TRY_BLOCK_RETURN
NSWindow* window = mView ? [mView window] : nil;
MOZ_LOG(
gIMELog, LogLevel::Debug,
("%p IMEInputHandler::NotifyIME(), IsFocused()=false, Destroyed()=%s, mView=%p, "
"[mView window]=%p, firstResponder=%p, isKeyWindow=%s, isActive=%s",
this, TrueOrFalse(Destroyed()), mView, window, window ? [window firstResponder] : nil,
TrueOrFalse(window && [window isKeyWindow]),
TrueOrFalse([[NSApplication sharedApplication] isActive])));
NS_OBJC_END_TRY_BLOCK_RETURN(NS_ERROR_FAILURE)
}
OnFocusChangeInGecko(true);
return NS_OK;
@ -4954,6 +4969,8 @@ bool TextInputHandlerBase::SetSelection(NSRange& aRange) {
/* static */ void TextInputHandlerBase::EnableSecureEventInput() {
sSecureEventInputCount++;
::EnableSecureEventInput();
MOZ_LOG(gIMELog, LogLevel::Debug,
("EnableSecureEventInput() called (%d)", sSecureEventInputCount));
}
/* static */ void TextInputHandlerBase::DisableSecureEventInput() {
@ -4962,6 +4979,8 @@ bool TextInputHandlerBase::SetSelection(NSRange& aRange) {
}
sSecureEventInputCount--;
::DisableSecureEventInput();
MOZ_LOG(gIMELog, LogLevel::Debug,
("DisableSecureEventInput() called (%d)", sSecureEventInputCount));
}
/* static */ bool TextInputHandlerBase::IsSecureEventInputEnabled() {