Skip to content

Commit

Permalink
Bug 1800404 - Make IMEStateManager::OnChangeFocusInternal stop warn…
Browse files Browse the repository at this point in the history
…ing in the case that `aPresContext` is `nullptr` r=m_kato

It may be called with `nullptr` for both `aPresContent` and `aElement`.
Therefore, it should not warn it when `aPresContext` is `nullptr`.

Differential Revision: https://phabricator.services.mozilla.com/D161979
  • Loading branch information
masayuki-nakano committed Nov 14, 2022
1 parent e5f90c3 commit 3c70f05
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dom/events/IMEStateManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,12 +497,15 @@ nsresult IMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext,

// If new aPresShell has been destroyed, this should handle the focus change
// as nobody is getting focus.
if (NS_WARN_IF(!CanHandleWith(aPresContext))) {
MOZ_ASSERT_IF(!aPresContext, !aElement);
if (NS_WARN_IF(aPresContext && !CanHandleWith(aPresContext))) {
MOZ_LOG(sISMLog, LogLevel::Warning,
(" OnChangeFocusInternal(), called with destroyed PresShell, "
"handling this call as nobody getting focus"));
aPresContext = nullptr;
aElement = nullptr;
} else if (!aPresContext) {
aElement = nullptr;
}

const nsCOMPtr<nsIWidget> oldWidget = sTextInputHandlingWidget;
Expand Down

0 comments on commit 3c70f05

Please sign in to comment.