Bug 1137572 part.9 TextEventDispatcher should not allow WillDispatchKeyboardEvent() modifies unexpected members of WidgetKeyboardEvent r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Wed, 16 Mar 2016 13:47:48 +0900
changeset 328763 fc409d9244ce5b34fd484f52b2d81ceb300cbd9c
parent 328762 782cc1725295b36e34a854a4d64159da3b16f4e9
child 328764 807b3c1dfc4799e019a04f2739c8e0f56bd0b6f1
push id1146
push userCallek@gmail.com
push dateMon, 25 Jul 2016 16:35:44 +0000
treeherdermozilla-release@a55778f9cd5a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1137572
milestone48.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 1137572 part.9 TextEventDispatcher should not allow WillDispatchKeyboardEvent() modifies unexpected members of WidgetKeyboardEvent r=smaug
widget/TextEventDispatcher.cpp
--- a/widget/TextEventDispatcher.cpp
+++ b/widget/TextEventDispatcher.cpp
@@ -480,18 +480,37 @@ TextEventDispatcher::DispatchKeyboardEve
   // XXX Currently, they are necessary only when the event is eKeyPress.
   keyEvent.alternativeCharCodes.Clear();
   if (aMessage == eKeyPress &&
       (keyEvent.IsControl() || keyEvent.IsAlt() ||
        keyEvent.IsMeta() || keyEvent.IsOS())) {
     nsCOMPtr<TextEventDispatcherListener> listener =
       do_QueryReferent(mListener);
     if (listener) {
+      DebugOnly<WidgetKeyboardEvent> original(keyEvent);
       listener->WillDispatchKeyboardEvent(this, keyEvent, aIndexOfKeypress,
                                           aData);
+      MOZ_ASSERT(keyEvent.mMessage ==
+                   static_cast<WidgetKeyboardEvent&>(original).mMessage);
+      MOZ_ASSERT(keyEvent.keyCode ==
+                   static_cast<WidgetKeyboardEvent&>(original).keyCode);
+      MOZ_ASSERT(keyEvent.location ==
+                   static_cast<WidgetKeyboardEvent&>(original).location);
+      MOZ_ASSERT(keyEvent.mIsRepeat ==
+                   static_cast<WidgetKeyboardEvent&>(original).mIsRepeat);
+      MOZ_ASSERT(keyEvent.mIsComposing ==
+                   static_cast<WidgetKeyboardEvent&>(original).mIsComposing);
+      MOZ_ASSERT(keyEvent.mKeyNameIndex ==
+                   static_cast<WidgetKeyboardEvent&>(original).mKeyNameIndex);
+      MOZ_ASSERT(keyEvent.mCodeNameIndex ==
+                   static_cast<WidgetKeyboardEvent&>(original).mCodeNameIndex);
+      MOZ_ASSERT(keyEvent.mKeyValue ==
+                   static_cast<WidgetKeyboardEvent&>(original).mKeyValue);
+      MOZ_ASSERT(keyEvent.mCodeValue ==
+                   static_cast<WidgetKeyboardEvent&>(original).mCodeValue);
     }
   }
 
   DispatchInputEvent(mWidget, keyEvent, aStatus);
   return true;
 }
 
 bool