Bug 962140 Log more details in the queue when PeekMessage() fails to remove found char message r=jimm
authorMasayuki Nakano <masayuki@d-toybox.com>
Wed, 26 Feb 2014 09:43:45 +0900
changeset 170938 8335da20a00e7dc8c4c74e848f5bb8fbfdd61e6b
parent 170937 72cfab2a3dcb67895851d805d8c52c29d35b3853
child 170939 1289de3c12fec0d4150c7294b49eec9cdfeacec7
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersjimm
bugs962140
milestone30.0a1
Bug 962140 Log more details in the queue when PeekMessage() fails to remove found char message r=jimm
widget/windows/KeyboardLayout.cpp
--- a/widget/windows/KeyboardLayout.cpp
+++ b/widget/windows/KeyboardLayout.cpp
@@ -1294,16 +1294,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
@@ -1343,26 +1345,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;
     }