Bug 1257446 part.0 ContentCacheInParent::HandleQueryContentEvent() should log the cause of failure when it makes the event's input offset absolute r=m_kato
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 12 Jul 2016 17:44:44 +0900
changeset 309239 b66e92eb8ed38f722a7d473bfec21e16aad3e8e1
parent 309238 d8e515832579ac2beee7c53dfb0505c66df25db8
child 309240 eaad665922a58e9d13ab1887f298a91581457dd7
push id80544
push userkwierso@gmail.com
push dateFri, 12 Aug 2016 23:29:38 +0000
treeherdermozilla-inbound@204eae54f875 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersm_kato
bugs1257446
milestone51.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 1257446 part.0 ContentCacheInParent::HandleQueryContentEvent() should log the cause of failure when it makes the event's input offset absolute r=m_kato MozReview-Commit-ID: JVGHPQ5gC3G
widget/ContentCache.cpp
--- a/widget/ContentCache.cpp
+++ b/widget/ContentCache.cpp
@@ -498,37 +498,74 @@ ContentCacheInParent::HandleQueryContent
 
   aEvent.mSucceeded = false;
   aEvent.mReply.mFocusedWidget = aWidget;
 
   // ContentCache doesn't store offset of its start with XP linebreaks.
   // So, we don't support to query contents relative to composition start
   // offset with XP linebreaks.
   if (NS_WARN_IF(!aEvent.mUseNativeLineBreak)) {
+    MOZ_LOG(sContentCacheLog, LogLevel::Error,
+      ("0x%p HandleQueryContentEvent(), FAILED due to query with XP linebreaks",
+       this));
     return false;
   }
 
-  if (NS_WARN_IF(!aEvent.mInput.IsValidOffset()) ||
-      NS_WARN_IF(!aEvent.mInput.IsValidEventMessage(aEvent.mMessage))) {
+  if (NS_WARN_IF(!aEvent.mInput.IsValidOffset())) {
+    MOZ_LOG(sContentCacheLog, LogLevel::Error,
+      ("0x%p HandleQueryContentEvent(), FAILED due to invalid offset",
+       this));
+    return false;
+  }
+
+  if (NS_WARN_IF(!aEvent.mInput.IsValidEventMessage(aEvent.mMessage))) {
+    MOZ_LOG(sContentCacheLog, LogLevel::Error,
+      ("0x%p HandleQueryContentEvent(), FAILED due to invalid event message",
+       this));
     return false;
   }
 
   bool isRelativeToInsertionPoint = aEvent.mInput.mRelativeToInsertionPoint;
   if (isRelativeToInsertionPoint) {
     if (aWidget->PluginHasFocus()) {
       if (NS_WARN_IF(!aEvent.mInput.MakeOffsetAbsolute(0))) {
+        MOZ_LOG(sContentCacheLog, LogLevel::Error,
+          ("0x%p HandleQueryContentEvent(), FAILED due to "
+           "aEvent.mInput.MakeOffsetAbsolute(0) failure, aEvent={ mMessage=%s, "
+           "mInput={ mOffset=%d, mLength=%d } }",
+           this, ToChar(aEvent.mMessage), aEvent.mInput.mOffset,
+           aEvent.mInput.mLength));
         return false;
       }
     } else if (mIsComposing) {
       if (NS_WARN_IF(!aEvent.mInput.MakeOffsetAbsolute(mCompositionStart))) {
+        MOZ_LOG(sContentCacheLog, LogLevel::Error,
+          ("0x%p HandleQueryContentEvent(), FAILED due to "
+           "aEvent.mInput.MakeOffsetAbsolute(mCompositionStart) failure, "
+           "mCompositionStart=%d, aEvent={ mMessage=%s, "
+           "mInput={ mOffset=%d, mLength=%d } }",
+           this, mCompositionStart, ToChar(aEvent.mMessage),
+           aEvent.mInput.mOffset, aEvent.mInput.mLength));
         return false;
       }
-    } else if (NS_WARN_IF(!mSelection.IsValid()) ||
-               NS_WARN_IF(!aEvent.mInput.MakeOffsetAbsolute(
+    } else if (NS_WARN_IF(!mSelection.IsValid())) {
+      MOZ_LOG(sContentCacheLog, LogLevel::Error,
+        ("0x%p HandleQueryContentEvent(), FAILED due to mSelection is invalid",
+         this));
+      return false;
+    } else if (NS_WARN_IF(!aEvent.mInput.MakeOffsetAbsolute(
                                            mSelection.StartOffset()))) {
+      MOZ_LOG(sContentCacheLog, LogLevel::Error,
+        ("0x%p HandleQueryContentEvent(), FAILED due to "
+         "aEvent.mInput.MakeOffsetAbsolute(mSelection.StartOffset()) "
+         "failure, mSelection={ StartOffset()=%d, Length()=%d }, "
+         "aEvent={ mMessage=%s, mInput={ mOffset=%d, mLength=%d } }",
+         this, mSelection.StartOffset(), mSelection.Length(),
+         ToChar(aEvent.mMessage), aEvent.mInput.mOffset,
+         aEvent.mInput.mLength));
       return false;
     }
   }
 
   switch (aEvent.mMessage) {
     case eQuerySelectedText:
       MOZ_LOG(sContentCacheLog, LogLevel::Info,
         ("0x%p HandleQueryContentEvent("