Skip to content

Commit

Permalink
Bug 1137572 part.9 TextEventDispatcher should not allow WillDispatchK…
Browse files Browse the repository at this point in the history
…eyboardEvent() modifies unexpected members of WidgetKeyboardEvent r=smaug
  • Loading branch information
masayuki-nakano committed Mar 16, 2016
1 parent b708862 commit 9f009a1
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions widget/TextEventDispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,27 @@ TextEventDispatcher::DispatchKeyboardEventInternal(
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);
}
}

Expand Down

0 comments on commit 9f009a1

Please sign in to comment.