Bug 1405832 - part 1: ContentCacheInParent::RequestIMEToCommitComposition() should increment mPendingEventsNeedingAck itself if it treat the request handled synchronously without actually requesting IME to commit composition r?m_kato draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Mon, 20 Nov 2017 22:20:02 +0900
changeset 701751 15c3c2dbbd5c7b40936baaf312bccfddb78b676d
parent 701610 b96f009478987d44a68a8d7cad40c6a3d6626235
child 701752 cc30fb895d874bd282a8aa596695292acb6c705d
child 701892 b3640d730d7ac1fbc287887cd3e94967ee9cc55e
push id90266
push usermasayuki@d-toybox.com
push dateWed, 22 Nov 2017 07:21:14 +0000
reviewersm_kato
bugs1405832
milestone59.0a1
Bug 1405832 - part 1: ContentCacheInParent::RequestIMEToCommitComposition() should increment mPendingEventsNeedingAck itself if it treat the request handled synchronously without actually requesting IME to commit composition r?m_kato This is a simple bug of ContentCacheInParent. When ContentCacheInParent::RequestIMEToCommitComposition() returns true, PuppetWidget::RequestIMEToCommitComposition() will send eCompositionCommitRequestHandled pseudo event message back to the main process. This causes counting down mPendingEventsNeedingAck in ContentCacheInParent::OnEventNeedingAckHandled(). Therefore, in the normal path, ContentCacheInParent::OnCompositionEvent() increments it for receiving the pseudo event message. However, if the tab parent has already lost focus, RequestIMEToCommitComposition() returns true without requesting native IME to commit composition. So, ContentCacheInParent::OnCompositionEvent() cannot increment mPendingEventsNeedingAck for coming eCompositionCommitRequestHandled. Therefore, RequestIMEToCommitComposition() needs to increment mPendingEventsNeedingAck by itself when it won't request IME to commit composition but it returns true. MozReview-Commit-ID: 4Alwfy8avB
widget/ContentCache.cpp
--- a/widget/ContentCache.cpp
+++ b/widget/ContentCache.cpp
@@ -1318,16 +1318,21 @@ ContentCacheInParent::RequestIMEToCommit
     // Use the latest composition string which may not be handled in the
     // remote process for avoiding data loss.
 #ifdef MOZ_CRASHREPORTER
     mRequestIMEToCommitCompositionResults.
       AppendElement(RequestIMEToCommitCompositionResult::
                       eReceivedAfterTabParentBlur);
 #endif // #ifdef MOZ_CRASHREPORTER
     aCommittedString = mCompositionString;
+    // After we return true from here, i.e., without actually requesting IME
+    // to commit composition, we will receive eCompositionCommitRequestHandled
+    // pseudo event message from the remote process.  So, we need to increment
+    // mPendingEventsNeedingAck here.
+    mPendingEventsNeedingAck++;
     return true;
   }
 
   RefPtr<TextComposition> composition =
     IMEStateManager::GetTextCompositionFor(aWidget);
   if (NS_WARN_IF(!composition)) {
     MOZ_LOG(sContentCacheLog, LogLevel::Warning,
       ("  0x%p RequestToCommitComposition(), "