Bug 893973 Check if the keydown event received view actually has focus and separate the MOZ_CRASH() for each case r=smichaud

This commit is contained in:
Masayuki Nakano 2013-07-17 11:08:44 +09:00
parent 41b1df67ba
commit 659bbecf94
2 changed files with 14 additions and 5 deletions

View File

@ -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<mozView> *aNativeView);
virtual ~IMEInputHandler();
bool IsFocused();
void ResetTimer();
virtual void ExecutePendingMethods();

View File

@ -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)