Bug 1347351 - nsMenuBarListener::KeyPress() should wait reply event for handling F10 key r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 20 Jul 2017 17:54:44 +0900
changeset 419190 60566dab0b5931f51e3df92b56554ac7c8cac015
parent 419189 469e3f8d635982cc7c09c2485018f619d9c6a874
child 419191 06e19157c17ef017ac85b7515314499b54b33f32
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1347351
milestone56.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 1347351 - nsMenuBarListener::KeyPress() should wait reply event for handling F10 key r=smaug Currently, nsMenuBarListener::KeyPress() handles F10 key before remote content handles it. However, if a remote process has focus, the keyboard event should be handled in the content first. Then, only when it's not consumed in the remote process, menubar should handle the F10 key press. MozReview-Commit-ID: GDf4POAPsTy
layout/xul/nsMenuBarListener.cpp
--- a/layout/xul/nsMenuBarListener.cpp
+++ b/layout/xul/nsMenuBarListener.cpp
@@ -322,16 +322,27 @@ nsMenuBarListener::KeyPress(nsIDOMEvent*
         aKeyEvent->StopPropagation();
         aKeyEvent->PreventDefault();
       }
     }
 #ifndef XP_MACOSX
     // Also need to handle F10 specially on Non-Mac platform.
     else if (nativeKeyEvent->mMessage == eKeyPress && keyCode == NS_VK_F10) {
       if ((GetModifiersForAccessKey(keyEvent) & ~MODIFIER_CONTROL) == 0) {
+        // If the keyboard event should activate the menubar and will be
+        // sent to a remote process, it should be executed with reply
+        // event from the focused remote process.  Note that if the menubar
+        // is active, the event is already marked as "stop cross
+        // process dispatching".  So, in that case, this won't wait
+        // reply from the remote content.
+        if (nativeKeyEvent->WillBeSentToRemoteProcess()) {
+          nativeKeyEvent->StopImmediatePropagation();
+          nativeKeyEvent->MarkAsWaitingReplyFromRemoteProcess();
+          return NS_OK;
+        }
         // The F10 key just went down by itself or with ctrl pressed.
         // In Windows, both of these activate the menu bar.
         mMenuBarFrame->SetActiveByKeyboard();
         ToggleMenuActiveState();
 
         if (mMenuBarFrame->IsActive()) {
 #ifdef MOZ_WIDGET_GTK
           // In GTK, this also opens the first menu.