Bug 1496288 - part 1: Make blacklist prefs for keypress event behavior changes ride the train r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 29 Nov 2018 15:04:18 +0000
changeset 508099 f854c2a5429c4fbf93359a24fcd89b34fed6e541
parent 508098 49b56d4d7fafc0a8bdabc00ce6b956564d9690a9
child 508100 2f92fd614d56a6c6b68041f4cdf70c358c01e7c8
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
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 1: Make blacklist prefs for keypress event behavior changes ride the train r=smaug Basically, we shouldn't have blacklist to disable web API. However, the keypress event behavior changes are not standardized things. Therefore, if some web developers realize that they need to change their apps when it's too late for them, Firefox users need to use another browser for such web apps for several weeks or more, and such things may make the users switch their default browser. For avoiding such worst scenario, we should take the blacklists and if we get such compatibility reports, we should add the domains into the blacklist even in release channel. Differential Revision: https://phabricator.services.mozilla.com/D13374
layout/base/PresShell.cpp
layout/base/PresShell.h
modules/libpref/init/all.js
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -817,21 +817,19 @@ PresShell::PresShell()
   , mApproximateFrameVisibilityVisited(false)
   , mNextPaintCompressed(false)
   , mHasCSSBackgroundColor(false)
   , mScaleToResolution(false)
   , mIsLastChromeOnlyEscapeKeyConsumed(false)
   , mHasReceivedPaintMessage(false)
   , mIsLastKeyDownCanceled(false)
   , mHasHandledUserInput(false)
-#ifdef NIGHTLY_BUILD
   , mForceDispatchKeyPressEventsForNonPrintableKeys(false)
   , mForceUseLegacyKeyCodeAndCharCodeValues(false)
   , mInitializedWithKeyPressEventDispatchingBlacklist(false)
-#endif // #ifdef NIGHTLY_BUILD
 {
   MOZ_LOG(gLog, LogLevel::Debug, ("PresShell::PresShell this=%p", this));
 
 #ifdef MOZ_REFLOW_PERF
   mReflowCountMgr = MakeUnique<ReflowCountMgr>();
   mReflowCountMgr->SetPresContext(mPresContext);
   mReflowCountMgr->SetPresShell(this);
 #endif
@@ -7900,17 +7898,16 @@ PresShell::HandleEventInternal(WidgetEve
       sLastInputCreated = aEvent->mTimeStamp;
     }
     sLastInputProcessed = now;
   }
 
   return rv;
 }
 
-#ifdef NIGHTLY_BUILD
 static already_AddRefed<nsIURI>
 GetDocumentURIToCompareWithBlacklist(PresShell& aPresShell)
 {
   nsPresContext* presContext = aPresShell.GetPresContext();
   if (NS_WARN_IF(!presContext)) {
     return nullptr;
   }
   // If the document is sandboxed document or data: document, we should
@@ -7925,17 +7922,16 @@ GetDocumentURIToCompareWithBlacklist(Pre
       continue;
     }
     nsCOMPtr<nsIURI> uri;
     principal->GetURI(getter_AddRefs(uri));
     return uri.forget();
   }
   return nullptr;
 }
-#endif // #ifdef NIGHTLY_BUILD
 
 nsresult
 PresShell::DispatchEventToDOM(WidgetEvent* aEvent,
                               nsEventStatus* aStatus,
                               nsPresShellEventCB* aEventCB)
 {
   nsresult rv = NS_OK;
   nsCOMPtr<nsINode> eventTarget = mCurrentEventContent.get();
@@ -7953,17 +7949,16 @@ PresShell::DispatchEventToDOM(WidgetEven
       // If we don't have any content, the callback wouldn't probably
       // do nothing.
       eventCBPtr = nullptr;
     }
   }
   if (eventTarget) {
     if (aEvent->IsBlockedForFingerprintingResistance()) {
       aEvent->mFlags.mOnlySystemGroupDispatchInContent = true;
-#ifdef NIGHTLY_BUILD
     } else if (aEvent->mMessage == eKeyPress) {
       // If eKeyPress event is marked as not dispatched in the default event
       // group in web content, it's caused by non-printable key or key
       // combination.  In this case, UI Events declares that browsers
       // shouldn't dispatch keypress event.  However, some web apps may be
       // broken with this strict behavior due to historical issue.
       // Therefore, we need to keep dispatching keypress event for such keys
       // even with breaking the standard.
@@ -7982,17 +7977,16 @@ PresShell::DispatchEventToDOM(WidgetEven
             "dom.keyboardevent.keypress.hack.use_legacy_keycode_and_charcode");
       }
       if (mForceDispatchKeyPressEventsForNonPrintableKeys) {
         aEvent->mFlags.mOnlySystemGroupDispatchInContent = false;
       }
       if (mForceUseLegacyKeyCodeAndCharCodeValues) {
         aEvent->AsKeyboardEvent()->mUseLegacyKeyCodeAndCharCodeValues = true;
       }
-#endif // #ifdef NIGHTLY_BUILD
     }
 
     if (aEvent->mClass == eCompositionEventClass) {
       IMEStateManager::DispatchCompositionEvent(eventTarget, mPresContext,
                                                 aEvent->AsCompositionEvent(),
                                                 aStatus, eventCBPtr);
     } else {
       EventDispatcher::Dispatch(eventTarget, mPresContext,
--- a/layout/base/PresShell.h
+++ b/layout/base/PresShell.h
@@ -861,29 +861,27 @@ private:
   // Whether the widget has received a paint message yet.
   bool mHasReceivedPaintMessage : 1;
 
   bool mIsLastKeyDownCanceled : 1;
 
   // Whether we have ever handled a user input event
   bool mHasHandledUserInput : 1;
 
-#ifdef NIGHTLY_BUILD
   // Whether we should dispatch keypress events even for non-printable keys
   // for keeping backward compatibility.
   bool mForceDispatchKeyPressEventsForNonPrintableKeys : 1;
   // Whether we should set keyCode or charCode value of keypress events whose
   // value is zero to the other value or not.  When this is set to true, we
   // should keep using legacy keyCode and charCode values (i.e., one of them
   // is always 0).
   bool mForceUseLegacyKeyCodeAndCharCodeValues : 1;
   // Whether mForceDispatchKeyPressEventsForNonPrintableKeys and
   // mForceUseLegacyKeyCodeAndCharCodeValues are initialized.
   bool mInitializedWithKeyPressEventDispatchingBlacklist : 1;
-#endif // #ifdef NIGHTLY_BUILD
 
   static bool sDisableNonTestMouseEvents;
 
   TimeStamp mLastOSWake;
 
   static TimeStamp sLastInputCreated;
   static TimeStamp sLastInputProcessed;
 
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -217,35 +217,34 @@ pref("dom.keyboardevent.dispatch_during_
 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", "");
-#else
-pref("dom.keyboardevent.keypress.dispatch_non_printable_keys_only_system_group_in_content", false);
-#endif
-
-#ifdef NIGHTLY_BUILD
+
 // Blacklist of domains of web apps which handle keyCode and charCode of
 // keypress events with a path only for Firefox (i.e., broken if we set
 // non-zero keyCode or charCode value to the other).  The format is exactly
 // same as "dom.keyboardevent.keypress.hack.dispatch_non_printable_keys". So,
 // check its explanation for the detail.
 pref("dom.keyboardevent.keypress.hack.use_legacy_keycode_and_charcode", "");
-#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.