Bug 1440189 - Stop dispatching keypress event to the default event group in web content (only Nightly and early Beta) r?smaug draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 23 Mar 2018 12:06:55 +0900
changeset 777691 cd6c768886cfcb8846cbb59a18c59444ffe9d48e
parent 777562 071ee904485e21e19ca08456d32bce6825b77a26
child 777692 c224c4ec6ecb394eddd1a68791e5fffd8c117256
push id105264
push usermasayuki@d-toybox.com
push dateThu, 05 Apr 2018 05:23:22 +0000
reviewerssmaug
bugs1440189
milestone61.0a1
Bug 1440189 - Stop dispatching keypress event to the default event group in web content (only Nightly and early Beta) r?smaug UI Events declares that keypress event should be fired only when the keydown sequence produces some characters. For conforming to UI Events and compatibility with the other browsers, we should stop dispatching keypress events for non-printable keys. For getting regression reports, we should enable this new behavior only on Nightly and early Beta.
modules/libpref/init/all.js
widget/TextEventDispatcher.cpp
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -222,17 +222,21 @@ pref("dom.gamepad.haptic_feedback.enable
 pref("dom.keyboardevent.dispatch_during_composition", true);
 #else
 pref("dom.keyboardevent.dispatch_during_composition", false);
 #endif
 
 // If this is true, TextEventDispatcher dispatches keypress event with setting
 // WidgetEvent::mFlags::mOnlySystemGroupDispatchInContent to true if it won't
 // cause inputting printable character.
+#ifdef EARLY_BETA_OR_EARLIER
+pref("dom.keyboardevent.keypress.dispatch_non_printable_keys_only_system_group_in_content", true);
+#else
 pref("dom.keyboardevent.keypress.dispatch_non_printable_keys_only_system_group_in_content", false);
+#endif
 
 // Whether the WebMIDI API is enabled
 pref("dom.webmidi.enabled", false);
 
 // Whether to enable the JavaScript start-up cache. This causes one of the first
 // execution to record the bytecode of the JavaScript function used, and save it
 // in the existing cache entry. On the following loads of the same script, the
 // bytecode would be loaded from the cache instead of being generated once more.
--- a/widget/TextEventDispatcher.cpp
+++ b/widget/TextEventDispatcher.cpp
@@ -40,17 +40,17 @@ TextEventDispatcher::TextEventDispatcher
     Preferences::AddBoolVarCache(
       &sDispatchKeyEventsDuringComposition,
       "dom.keyboardevent.dispatch_during_composition",
       true);
     Preferences::AddBoolVarCache(
       &sDispatchKeyPressEventsOnlySystemGroupInContent,
       "dom.keyboardevent.keypress."
         "dispatch_non_printable_keys_only_system_group_in_content",
-      false);
+      true);
     sInitialized = true;
   }
 
   ClearNotificationRequests();
 }
 
 nsresult
 TextEventDispatcher::BeginInputTransaction(