Bug 1438097 - nsXBLWindowKeyHandler::HandleEventOnCaptureInSystemEventGroup() should mark keyboard events which won't be fired on content in the default event group as "wait reply from remote process" r?smaug draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Wed, 14 Feb 2018 15:21:15 +0900
changeset 755362 91e723810c6c6809b721f04ace4479842db765b6
parent 755361 4a96305320aa59fef5994561ec2e0d585de747c4
push id99154
push usermasayuki@d-toybox.com
push dateThu, 15 Feb 2018 06:35:45 +0000
reviewerssmaug
bugs1438097, 1203059, 1433101
milestone60.0a1
Bug 1438097 - nsXBLWindowKeyHandler::HandleEventOnCaptureInSystemEventGroup() should mark keyboard events which won't be fired on content in the default event group as "wait reply from remote process" r?smaug BaseEventFlags::mOnlySystemGroupDispatchInContent was used only when the key combination is reserved by chrome, and used for preventing to fire in web content on non-e10s window (bug 1203059). However, now, this is also used for preventing to fire keypress event for non-printable key combinations on web contents in the default event group (bug 1433101). Therefore, now, we need to send events whose mFlags.mOnlySystemGroupDispatchInContent is true because some event listeners in the system event group in remote process may want to handle specific keyboard events before nsXBLWindowKeyHandler. This patch makes nsXBLWindowKeyHandler::HandleEventOnCaptureInSystemEventGroup() treat KeyboardEvent whose mFlags.mOnlySystemGroupDispatchInContent is true but which will be sent to remote process as usual event. MozReview-Commit-ID: 4x0co9X2QV7
dom/xbl/nsXBLWindowKeyHandler.cpp
--- a/dom/xbl/nsXBLWindowKeyHandler.cpp
+++ b/dom/xbl/nsXBLWindowKeyHandler.cpp
@@ -560,19 +560,22 @@ nsXBLWindowKeyHandler::HandleEventOnCapt
 void
 nsXBLWindowKeyHandler::HandleEventOnCaptureInSystemEventGroup(
                          KeyboardEvent* aEvent)
 {
   WidgetKeyboardEvent* widgetEvent =
     aEvent->WidgetEventPtr()->AsKeyboardEvent();
 
   // If the event won't be sent to remote process, this listener needs to do
-  // nothing.
-  if (widgetEvent->mFlags.mOnlySystemGroupDispatchInContent ||
-      !widgetEvent->WillBeSentToRemoteProcess()) {
+  // nothing.  Note that even if mOnlySystemGroupDispatchInContent is true,
+  // we need to send the event to remote process and check reply event
+  // before matching it with registered shortcut keys because event listeners
+  // in the system event group may want to handle the event before registered
+  // shortcut key handlers.
+  if (!widgetEvent->WillBeSentToRemoteProcess()) {
     return;
   }
 
   if (!HasHandlerForEvent(aEvent)) {
     return;
   }
 
   // If this event wasn't marked as IsCrossProcessForwardingStopped,