Bug 1496288 - part 2: Stop dispatching non-printable "keypress" events, set keyCode or charCode value to the other value when it's zero, start to dispatch "keydown" and "keyup" events during composition, and enable window.event by default r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 29 Nov 2018 15:18:17 +0000
changeset 508100 2f92fd614d56a6c6b68041f4cdf70c358c01e7c8
parent 508099 f854c2a5429c4fbf93359a24fcd89b34fed6e541
child 508101 6562c2392ac9127ff2deeed7276e2c44cd36669b
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1496288, 968056, 1479964, 354358, 218415
milestone65.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 1496288 - part 2: Stop dispatching non-printable "keypress" events, set keyCode or charCode value to the other value when it's zero, start to dispatch "keydown" and "keyup" events during composition, and enable window.event by default r=smaug First one is for bug 968056. UI Events declares that "keypress" events should be dispatched only when a key press produces one or more characters (and also discussing about Enter key press for backward compatibility). Therefore, we should stop dispatching "keypress" events for non-printable keys (like arrow keys, Ctrl + A, etc) in the default group on content for conforming to UI Events, but keep dispatching them in chrome and in the system group on content. Next one is for bug 1479964. No spec declares that what value should be set to keyCode and charCode value of "keypress" events because declaring that would break existing web apps which handle them with UA string. However, some web apps assume that if window.event is available, keyCode value of "keypress" event is set to a Unicode code point of inputting character. We set only charCode to it, but the other browsers sets both keyCode and charCode to a Unicode code point of inputting character. Therefore, we need to follow the other browsers' behavior for this because changing value from zero to non-zero is safer than non-zero to non-zero or zero. And also next one is for bug 354358. UI Events declares that "keydown" and "keyup" events represent physical key state and should be fired even during composition. As far as the reported issues, this behavior is expected mainly by Korean web developers and some web apps depend on the behavior. Therefore, we need to start to dispatch them during composition. Finally, for bug 218415, we should enable window.event. This is declared by the Living DOM Standard. A lot of web apps depend on window.event and the last blocker, bug 1479964 was fixed so that it is the time to enable this. Differential Revision: https://phabricator.services.mozilla.com/D13376
modules/libpref/init/StaticPrefList.h
modules/libpref/init/all.js
--- a/modules/libpref/init/StaticPrefList.h
+++ b/modules/libpref/init/StaticPrefList.h
@@ -200,27 +200,21 @@ VARCACHE_PREF(
   "dom.ipc.tabs.shutdownTimeoutSecs",
    dom_ipc_tabs_shutdownTimeoutSecs,
   RelaxedAtomicUint32, PREF_VALUE
 )
 #undef PREF_VALUE
 
 // If this is true, "keypress" event's keyCode value and charCode value always
 // become same if the event is not created/initialized by JS.
-#ifdef NIGHTLY_BUILD
-# define PREF_VALUE  true
-#else
-# define PREF_VALUE  false
-#endif
 VARCACHE_PREF(
   "dom.keyboardevent.keypress.set_keycode_and_charcode_to_same_value",
    dom_keyboardevent_keypress_set_keycode_and_charcode_to_same_value,
-  bool, PREF_VALUE
+  bool, true
 )
-#undef PREF_VALUE
 
 // NOTE: This preference is used in unit tests. If it is removed or its default
 // value changes, please update test_sharedMap_var_caches.js accordingly.
 VARCACHE_PREF(
   "dom.webcomponents.shadowdom.report_usage",
    dom_webcomponents_shadowdom_report_usage,
   bool, false
 )
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -206,30 +206,22 @@ pref("dom.gamepad.non_standard_events.en
 pref("dom.gamepad.non_standard_events.enabled", true);
 #endif
 pref("dom.gamepad.extensions.enabled", true);
 pref("dom.gamepad.haptic_feedback.enabled", true);
 
 // If this is true, TextEventDispatcher dispatches keydown and keyup events
 // even during composition (keypress events are never fired during composition
 // even if this is true).
-#ifdef EARLY_BETA_OR_EARLIER
 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 NIGHTLY_BUILD
 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
 
 // Blacklist of domains of web apps which are not aware of strict keypress
 // dispatching behavior.  This is comma separated list.  If you need to match
 // all sub-domains, you can specify it as "*.example.com".  Additionally, you
 // can limit the path.  E.g., "example.com/foo" means "example.com/foo*".  So,
 // if you need to limit under a directory, the path should end with "/" like
 // "example.com/foo/".  Note that this cannot limit port number for now.
 pref("dom.keyboardevent.keypress.hack.dispatch_non_printable_keys", "");
@@ -267,21 +259,17 @@ pref("dom.script_loader.bytecode_cache.e
 // look at: ScriptLoader::ShouldCacheBytecode function.
 pref("dom.script_loader.bytecode_cache.strategy", 0);
 
 #ifdef JS_BUILD_BINAST
 pref("dom.script_loader.binast_encoding.enabled", false);
 #endif
 
 // Whether window.event is enabled
-#ifdef NIGHTLY_BUILD
 pref("dom.window.event.enabled", true);
-#else
-pref("dom.window.event.enabled", false);
-#endif
 
 // Fastback caching - if this pref is negative, then we calculate the number
 // of content viewers to cache based on the amount of available memory.
 pref("browser.sessionhistory.max_total_viewers", -1);
 
 pref("ui.use_native_colors", true);
 pref("ui.click_hold_context_menus", false);