Bug 1347351 - nsMenuBarListener::KeyPress() should wait reply event for handling F10 key r=smaug
☠☠ backed out by 46b12a5d51b8 ☠ ☠
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 14 Jul 2017 23:45:03 +0900
changeset 419177 ec113974cdd9a44fa035a2c69678cad9fc28d35b
parent 419176 57e0c8a166d2b378eed7c0008643ade6b184145f
child 419178 46b12a5d51b89a211ea788909ec7e366f8e6ed0b
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->MaybePostedToRemoteProcessLater()) {
+          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.