Closed Bug 1384584 Opened 7 years ago Closed 7 years ago

[e10s] ContentCacheInParent::OnCompositionEvent() crashes in debug build if composition in remote process is committed asynchronously

Categories

(Core :: DOM: UI Events & Focus Handling, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

Details

(Keywords: inputmethod)

Attachments

(1 file)

STR:

1. Use IME which commits composition asynchronously. (I tested on Ubuntu 17.04 with iBus + Mozc.)
2. Start composition in remote process.
3. Click search bar.

AR:
ContentCacheInParent::OnCompositionEvent() crashed if it's debug build.

ER:
The composition is committed in the remote process and can start typing cleanly in the search bar.

I hit this assertion:

https://searchfox.org/mozilla-central/rev/8a61c71153a79cda2e1ae7d477564347c607cc5f/widget/ContentCache.cpp#1101,1116,1129
> ContentCacheInParent::OnCompositionEvent(const WidgetCompositionEvent& aEvent)
> {
>   // We must be able to simulate the selection because
>   // we might not receive selection updates in time
>   if (!mWidgetHasComposition) {
>     MOZ_ASSERT(aEvent.mMessage == eCompositionStart);

The reason of this is, when TextComposition::RequestIMEToCommitComposition() is called but the request is handled by native IME asynchronously, TextComposition synthesizes eCompositionCommit(AsIs) event to commit composition *synchronously* in the editor. (This behavior helps web apps which tries to commit composition from JS.) Then, TextComposition::DispatchCompositionEvent() should ignore following composition events which are actually sent from native IME.

However, if composition is in a remote process, TextComposition::DispatchCompositionEvent() doesn't discard the unnecessary events.  Therefore, ContentCacheInParent is consued by this unexpected events.  So, TextComposition::DispatchCompositionEvent() shouldn't send the following unnecessary composition events to TabParent.

Note that in remote process, composition is committed synchronously with the hack mentioned above and synthesized eCompositionCommit(AsIs) event of TextComposition::RequestIMEToCommitComposition() in the parent process looks like coming from native IME.  Therefore, actual composition events are not necessary for the remote process.
Comment on attachment 8890455 [details]
Bug 1384584 - TextComposition::DispatchCompositionEvent() shouldn't send composition events to focused TabParent after its RequestIMEToCommitComposition() synthesizes eCompositionCommit(AsIs) event synchronously

https://reviewboard.mozilla.org/r/161514/#review167216
Attachment #8890455 - Flags: review?(m_kato) → review+
Pushed by masayuki@d-toybox.com:
https://hg.mozilla.org/integration/autoland/rev/fad5412d0735
TextComposition::DispatchCompositionEvent() shouldn't send composition events to focused TabParent after its RequestIMEToCommitComposition() synthesizes eCompositionCommit(AsIs) event synchronously r=m_kato
https://hg.mozilla.org/mozilla-central/rev/fad5412d0735
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.