Bug 962140 - Log more details in the queue when PeekMessage() fails to remove found char message. r=jimm, a=lsblakk
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 27 Feb 2014 11:14:27 +0900
changeset 176450 6261d982a867b7bdb999db28376ba90a2a5175ab
parent 176449 94ff7bdd6c677f1b001974e01670d9dda8a7225a
child 176451 1f65632180dfc096453d4ad4c47b527eb70ef829
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm, lsblakk
bugs962140
milestone28.0
Bug 962140 - Log more details in the queue when PeekMessage() fails to remove found char message. r=jimm, a=lsblakk
widget/windows/KeyboardLayout.cpp
--- a/widget/windows/KeyboardLayout.cpp
+++ b/widget/windows/KeyboardLayout.cpp
@@ -1286,16 +1286,18 @@ GetMessageName(UINT aMessage)
     case WM_SYSKEYDOWN:  return "WM_SYSKEYDOWN";
     case WM_KEYUP:       return "WM_KEYUP";
     case WM_SYSKEYUP:    return "WM_SYSKEYUP";
     case WM_CHAR:        return "WM_CHAR";
     case WM_DEADCHAR:    return "WM_DEADCHAR";
     case WM_SYSCHAR:     return "WM_SYSCHAR";
     case WM_SYSDEADCHAR: return "WM_SYSDEADCHAR";
     case WM_UNICHAR:     return "WM_UNICHAR";
+    case WM_QUIT:        return "WM_QUIT";
+    case WM_NULL:        return "WM_NULL";
     default:             return "Unknown";
   }
 }
 
 #endif // #ifdef MOZ_CRASHREPORTER
 
 bool
 NativeKey::GetFollowingCharMessage(MSG& aCharMsg) const
@@ -1335,26 +1337,59 @@ NativeKey::GetFollowingCharMessage(MSG& 
   // the following char message it was found above.
   for (uint32_t i = 0; i < 5; i++) {
     MSG removedMsg;
     if (!WinUtils::PeekMessage(&removedMsg, nextKeyMsg.hwnd,
                                nextKeyMsg.message, nextKeyMsg.message,
                                PM_REMOVE | PM_NOYIELD)) {
 #ifdef MOZ_CRASHREPORTER
       nsPrintfCString info("\nHandling message: %s (0x%08X), wParam: 0x%08X, "
-                           "lParam: 0x%08X, InSendMessageEx()=%s, \n"
+                           "lParam: 0x%08X, hwnd=0x%p, InSendMessageEx()=%s, \n"
                            "Found message: %s (0x%08X), wParam: 0x%08X, "
-                           "lParam: 0x%08X",
+                           "lParam: 0x%08X, \nWM_NULL has been removed: %d, ",
                            GetMessageName(mMsg.message),
                            mMsg.message, mMsg.wParam, mMsg.lParam,
+                           nextKeyMsg.hwnd,
                            GetResultOfInSendMessageEx().get(),
                            GetMessageName(nextKeyMsg.message),
                            nextKeyMsg.message, nextKeyMsg.wParam,
-                           nextKeyMsg.lParam);
+                           nextKeyMsg.lParam, i);
       CrashReporter::AppendAppNotesToCrashReport(info);
+      MSG nextKeyMsgInAllWindows;
+      if (WinUtils::PeekMessage(&nextKeyMsgInAllWindows, 0,
+                                WM_KEYFIRST, WM_KEYLAST,
+                                PM_NOREMOVE | PM_NOYIELD)) {
+        nsPrintfCString info("\nNext key message in all windows: %s (0x%08X), "
+                             "wParam: 0x%08X, lParam: 0x%08X, hwnd=0x%p, "
+                             "time=%d, ",
+                             GetMessageName(nextKeyMsgInAllWindows.message),
+                             nextKeyMsgInAllWindows.message,
+                             nextKeyMsgInAllWindows.wParam,
+                             nextKeyMsgInAllWindows.lParam,
+                             nextKeyMsgInAllWindows.hwnd,
+                             nextKeyMsgInAllWindows.time);
+        CrashReporter::AppendAppNotesToCrashReport(info);
+      } else {
+        CrashReporter::AppendAppNotesToCrashReport(
+          NS_LITERAL_CSTRING("\nThere is no key message in any window, "));
+      }
+      MSG nextMsg;
+      if (WinUtils::PeekMessage(&nextMsg, 0, 0, 0,
+                                PM_NOREMOVE | PM_NOYIELD)) {
+        nsPrintfCString info("\nNext message in all windows: %s (0x%08X), "
+                             "wParam: 0x%08X, lParam: 0x%08X, hwnd=0x%p, "
+                             "time=%d",
+                             GetMessageName(nextMsg.message),
+                             nextMsg.message, nextMsg.wParam, nextMsg.lParam,
+                             nextMsg.hwnd, nextMsg.time);
+        CrashReporter::AppendAppNotesToCrashReport(info);
+      } else {
+        CrashReporter::AppendAppNotesToCrashReport(
+          NS_LITERAL_CSTRING("\nThere is no message in any window"));
+      }
 #endif // #ifdef MOZ_CRASHREPORTER
       MOZ_CRASH("We lost the following char message");
     }
 
     // Retry for the strange case.
     if (removedMsg.message == WM_NULL) {
       continue;
     }