Bug 1138678 - Ignore NOTIFY_IME_OF_BLUR when establishing secure input mode. r=masayuki
authorDavid Parks <davidp99@gmail.com>
Wed, 18 Mar 2015 19:08:22 -0700
changeset 263595 e8438b5f3d4617eec12554de8e9b6331bf9cabf8
parent 263594 af2ce13b4a6bcee51a31c4f855ef5080ccb29a1e
child 263596 1d901261795745509c9e9e3eefdff222ee7f756e
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1138678
milestone39.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1138678 - Ignore NOTIFY_IME_OF_BLUR when establishing secure input mode. r=masayuki SetInputContext keeps proper tabs on the secure input setting. This code could result in improper IME configuration.
widget/cocoa/nsChildView.mm
widget/cocoa/nsCocoaWindow.mm
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -1596,20 +1596,16 @@ nsChildView::NotifyIMEInternal(const IME
       } else {
         TextInputHandler::EnsureSecureEventInputDisabled();
       }
 
       NS_ENSURE_TRUE(mTextInputHandler, NS_ERROR_NOT_AVAILABLE);
       mTextInputHandler->OnFocusChangeInGecko(true);
       return NS_OK;
     case NOTIFY_IME_OF_BLUR:
-      // When we're going to be deactive, we must disable the secure event input
-      // mode, see the Carbon Event Manager Reference.
-      TextInputHandler::EnsureSecureEventInputDisabled();
-
       NS_ENSURE_TRUE(mTextInputHandler, NS_ERROR_NOT_AVAILABLE);
       mTextInputHandler->OnFocusChangeInGecko(false);
       return NS_OK;
     case NOTIFY_IME_OF_SELECTION_CHANGE:
       NS_ENSURE_TRUE(mTextInputHandler, NS_ERROR_NOT_AVAILABLE);
       mTextInputHandler->OnSelectionChange();
     default:
       return NS_ERROR_NOT_IMPLEMENTED;
@@ -5498,16 +5494,18 @@ static int32_t RoundUp(double aDouble)
   if (!mGeckoChild)
     return;
 
   nsAutoRetainCocoaObject kungFuDeathGrip(self);
 
   nsIWidgetListener* listener = mGeckoChild->GetWidgetListener();
   if (listener)
     listener->WindowDeactivated();
+
+  TextInputHandler::EnsureSecureEventInputDisabled();
 }
 
 // If the call to removeFromSuperview isn't delayed from nsChildView::
 // TearDownView(), the NSView hierarchy might get changed during calls to
 // [ChildView drawRect:], which leads to "beyond bounds" exceptions in
 // NSCFArray.  For more info see bmo bug 373122.  Apple's docs claim that
 // removeFromSuperviewWithoutNeedingDisplay "can be safely invoked during
 // display" (whatever "display" means).  But it's _not_ true that it can be
--- a/widget/cocoa/nsCocoaWindow.mm
+++ b/widget/cocoa/nsCocoaWindow.mm
@@ -2119,19 +2119,16 @@ nsCocoaWindow::NotifyIMEInternal(const I
     case NOTIFY_IME_OF_FOCUS:
       if (mInputContext.IsPasswordEditor()) {
         TextInputHandler::EnableSecureEventInput();
       } else {
         TextInputHandler::EnsureSecureEventInputDisabled();
       }
       return NS_OK;
     case NOTIFY_IME_OF_BLUR:
-      // When we're going to be deactive, we must disable the secure event input
-      // mode, see the Carbon Event Manager Reference.
-      TextInputHandler::EnsureSecureEventInputDisabled();
       return NS_OK;
     default:
       return NS_ERROR_NOT_IMPLEMENTED;
   }
 }
 
 NS_IMETHODIMP_(void)
 nsCocoaWindow::SetInputContext(const InputContext& aContext,
@@ -2396,16 +2393,18 @@ nsCocoaWindow::ExecuteNativeKeyBinding(N
   ChildViewMouseTracker::ReEvaluateMouseEnterState();
 
   // If a sheet just resigned key then we should paint the menu bar
   // for whatever window is now main.
   NSWindow* window = [aNotification object];
   if ([window isSheet])
     [WindowDelegate paintMenubarForWindow:[NSApp mainWindow]];
 
+  TextInputHandler::EnsureSecureEventInputDisabled();
+
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 - (void)windowWillMove:(NSNotification *)aNotification
 {
   RollUpPopups();
 }