Bug 962140 Collect more details of the queue status when we removed unexpected char message from the queue r=jimm, a=sledru
authorMasayuki Nakano <masayuki@d-toybox.com>
Sat, 08 Mar 2014 00:17:17 +0900
changeset 183204 b4d0524265ec46a79a6e958f30b4e45693411edc
parent 183203 0ce4c39b6e831f72034529f3132947ba4b1c237d
child 183205 0414ab954291e005b5bfe2013e2f2e6eba4451ac
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm, sledru
bugs962140
milestone29.0a2
Bug 962140 Collect more details of the queue status when we removed unexpected char message from the queue r=jimm, a=sledru
widget/windows/KeyboardLayout.cpp
--- a/widget/windows/KeyboardLayout.cpp
+++ b/widget/windows/KeyboardLayout.cpp
@@ -1427,30 +1427,65 @@ NativeKey::GetFollowingCharMessage(MSG& 
     //       in lParam may be changed from 0 to something.  The changed value
     //       is different from the scan code of handling keydown message.
     if (removedMsg.message != nextKeyMsg.message ||
         removedMsg.wParam != nextKeyMsg.wParam ||
         (removedMsg.lParam & ~kScanCodeMask) !=
           (nextKeyMsg.lParam & ~kScanCodeMask)) {
 #ifdef MOZ_CRASHREPORTER
       nsPrintfCString info("\nHandling message: %s (0x%08X), wParam: 0x%08X, "
-                           "lParam: 0x%08X, InSendMessageEx()=%s, \n"
-                           "Found message: %s (0x%08X), wParam: 0x%08X, "
-                           "lParam: 0x%08X, \nRemoved message: %s (0x%08X), "
-                           "wParam: 0x%08X, lParam: 0x%08X",
+                           "lParam: 0x%08X, hwnd=0x%p, InSendMessageEx()=%s, "
+                           "\nFound message: %s (0x%08X), wParam: 0x%08X, "
+                           "lParam: 0x%08X, hwnd=0x%p, "
+                           "\nRemoved message: %s (0x%08X), wParam: 0x%08X, "
+                           "lParam: 0x%08X, hwnd=0x%p, ",
                            GetMessageName(mMsg.message),
-                           mMsg.message, mMsg.wParam, mMsg.lParam,
+                           mMsg.message, mMsg.wParam, mMsg.lParam, mMsg.hwnd,
                            GetResultOfInSendMessageEx().get(),
                            GetMessageName(nextKeyMsg.message),
                            nextKeyMsg.message, nextKeyMsg.wParam,
-                           nextKeyMsg.lParam,
+                           nextKeyMsg.lParam, nextKeyMsg.hwnd,
                            GetMessageName(removedMsg.message),
                            removedMsg.message, removedMsg.wParam,
-                           removedMsg.lParam);
+                           removedMsg.lParam, removedMsg.hwnd);
       CrashReporter::AppendAppNotesToCrashReport(info);
+      // What's the next key message?
+      MSG nextKeyMsgAfter;
+      if (WinUtils::PeekMessage(&nextKeyMsgAfter, mMsg.hwnd,
+                                WM_KEYFIRST, WM_KEYLAST,
+                                PM_NOREMOVE | PM_NOYIELD)) {
+        nsPrintfCString info("\nNext key message after unexpected char message "
+                             "removed: %s (0x%08X), wParam: 0x%08X, "
+                             "lParam: 0x%08X, hwnd=0x%p, ",
+                             GetMessageName(nextKeyMsgAfter.message),
+                             nextKeyMsgAfter.message, nextKeyMsgAfter.wParam,
+                             nextKeyMsgAfter.lParam, nextKeyMsgAfter.hwnd);
+        CrashReporter::AppendAppNotesToCrashReport(info);
+      } else {
+        CrashReporter::AppendAppNotesToCrashReport(
+          NS_LITERAL_CSTRING("\nThere is no key message after unexpected char "
+                             "message removed, "));
+      }
+      // Another window has a key message?
+      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.",
+                             GetMessageName(nextKeyMsgInAllWindows.message),
+                             nextKeyMsgInAllWindows.message,
+                             nextKeyMsgInAllWindows.wParam,
+                             nextKeyMsgInAllWindows.lParam,
+                             nextKeyMsgInAllWindows.hwnd);
+        CrashReporter::AppendAppNotesToCrashReport(info);
+      } else {
+        CrashReporter::AppendAppNotesToCrashReport(
+          NS_LITERAL_CSTRING("\nThere is no key message in any windows."));
+      }
 #endif // #ifdef MOZ_CRASHREPORTER
       MOZ_CRASH("PeekMessage() removed unexpected message");
     }
 
     aCharMsg = removedMsg;
     return true;
   }
 #ifdef MOZ_CRASHREPORTER