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
authorMasayuki Nakano <masayuki@d-toybox.com>
Mon, 20 Nov 2017 22:20:02 +0900
changeset 393064 21522127515146fb7742f4e52c5d4c860bc71562
parent 393063 e55035922259c5449c4004f23b87efe307c2606b
child 393065 e8d7881af680c693612c2ed42d3486c5ad4c8e42
push id55827
push usermasayuki@d-toybox.com
push dateWed, 22 Nov 2017 12:53:08 +0000
treeherderautoland@7a3e5d976499 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersm_kato
bugs1405832
milestone59.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 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(), "