diff --git a/widget/cocoa/TextInputHandler.h b/widget/cocoa/TextInputHandler.h index 5f224212c53a..2b242b0ecf69 100644 --- a/widget/cocoa/TextInputHandler.h +++ b/widget/cocoa/TextInputHandler.h @@ -951,6 +951,8 @@ public: void SetIMEOpenState(bool aOpen); void SetASCIICapableOnly(bool aASCIICapableOnly); + bool IsFocused(); + static CFArrayRef CreateAllIMEModeList(); static void DebugPrintAllIMEModes(); @@ -973,7 +975,6 @@ protected: IMEInputHandler(nsChildView* aWidget, NSView *aNativeView); virtual ~IMEInputHandler(); - bool IsFocused(); void ResetTimer(); virtual void ExecutePendingMethods(); diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index d632b2516229..ab3a15d2dbe2 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -5207,10 +5207,18 @@ static int32_t RoundUp(double aDouble) NS_OBJC_BEGIN_TRY_ABORT_BLOCK; #if !defined(RELEASE_BUILD) || defined(DEBUG) - if (mGeckoChild && - mGeckoChild->GetInputContext().IsPasswordEditor() != - TextInputHandler::IsSecureEventInputEnabled()) { - MOZ_CRASH("in wrong secure input mode"); + if (mGeckoChild && mTextInputHandler && mTextInputHandler->IsFocused()) { + if (mIsPluginView) { + if (TextInputHandler::IsSecureEventInputEnabled()) { + MOZ_CRASH("While a plugin has focus, we must not be in secure mode"); + } + } else if (mGeckoChild->GetInputContext().IsPasswordEditor() && + !TextInputHandler::IsSecureEventInputEnabled()) { + MOZ_CRASH("A password editor has focus, but not in secure input mode"); + } else if (!mGeckoChild->GetInputContext().IsPasswordEditor() && + TextInputHandler::IsSecureEventInputEnabled()) { + MOZ_CRASH("A non-password editor has focus, but in secure input mode"); + } } #endif // #if !defined(RELEASE_BUILD) || defined(DEBUG)