Bug 1447866 - GeckoEditableSupport::SendIMEDummyKeyEvent() should set native key bindings to none before dispatching keyboard events which are marked as "processed by IME" r?esawin
When EditorEventListener receives keyboard events, it tries to execute
native key bindings which are stored by each keyboard event. For performance
reason in e10s, TabParent initializes native key binding information of every
keyboard event before sending it to the remote process. Therefore,
PuppetWidget checks if every keyboard event has native key binding information.
However, the native key binding information of dummy keyboard events marked as
"processed by IME" on Android are never initialized before sending PuppetWidget.
Therefore, we hit MOZ_ASSERT in PuppetWidget.
This patch makes GeckoEditableSuppor::SendIMEDummyKeyEvent() set native key
binding information to "none" before dispatching every keyboard event since
keyboard events during composition shouldn't cause any edit actions.
MozReview-Commit-ID: Bk532ahCQP6
--- a/widget/android/GeckoEditableSupport.cpp
+++ b/widget/android/GeckoEditableSupport.cpp
@@ -695,16 +695,21 @@ GeckoEditableSupport::SendIMEDummyKeyEve
WidgetKeyboardEvent event(true, msg, aWidget);
event.mTime = PR_Now() / 1000;
// TODO: If we can know scan code of the key event which caused replacing
// composition string, we should set mCodeNameIndex here. Then,
// we should rename this method because it becomes not a "dummy"
// keyboard event.
event.mKeyCode = NS_VK_PROCESSKEY;
event.mKeyNameIndex = KEY_NAME_INDEX_Process;
+ // KeyboardEvents marked as "processed by IME" shouldn't cause any edit
+ // actions. So, we should set their native key binding to none before
+ // dispatch to avoid crash on PuppetWidget and avoid running redundant
+ // path to look for native key bindings.
+ event.PreventNativeKeyBindings();
NS_ENSURE_SUCCESS_VOID(BeginInputTransaction(mDispatcher));
mDispatcher->DispatchKeyboardEvent(msg, event, status);
}
void
GeckoEditableSupport::AddIMETextChange(const IMETextChange& aChange)
{
mIMETextChanges.AppendElement(aChange);