Bug 551242 - [OOPP] Hang (caught by hang detector) with flash and alt key. r=bent.
authorJim Mathies <jmathies@mozilla.com>
Wed, 10 Mar 2010 19:16:44 -0600
changeset 39241 5295a7cfd05c
parent 39240 7d80d8881cbd
child 39243 d901e666af87
child 46712 eef101881cce
push id12099
push userjmathies@mozilla.com
push dateThu, 11 Mar 2010 01:25:46 +0000
treeherdermozilla-central@5295a7cfd05c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent
bugs551242
milestone1.9.3a3pre
Bug 551242 - [OOPP] Hang (caught by hang detector) with flash and alt key. r=bent.
ipc/glue/WindowsMessageLoop.cpp
widget/src/windows/nsWindow.cpp
--- a/ipc/glue/WindowsMessageLoop.cpp
+++ b/ipc/glue/WindowsMessageLoop.cpp
@@ -212,16 +212,17 @@ ProcessOrDeferMessage(HWND hwnd,
     case WM_ENABLE:
     case WM_IME_NOTIFY:
     case WM_IME_SETCONTEXT:
     case WM_KILLFOCUS:
     case WM_MOUSEWHEEL:
     case WM_NCDESTROY:
     case WM_PARENTNOTIFY:
     case WM_SETFOCUS:
+    case WM_SYSCOMMAND:
     case WM_SHOWWINDOW: // Intentional fall-through.
     case WM_XP_THEMECHANGED: {
       deferred = new DeferredSendMessage(hwnd, uMsg, wParam, lParam);
       break;
     }
 
     case WM_DEVICECHANGE:
     case WM_NCACTIVATE: // Intentional fall-through.
--- a/widget/src/windows/nsWindow.cpp
+++ b/widget/src/windows/nsWindow.cpp
@@ -3676,38 +3676,50 @@ nsWindow::IsAsyncResponseEvent(UINT aMsg
 }
 
 void
 nsWindow::IPCWindowProcHandler(UINT& msg, WPARAM& wParam, LPARAM& lParam)
 {
   NS_ASSERTION(!mozilla::ipc::SyncChannel::IsPumpingMessages(),
                "Failed to prevent a nonqueued message from running!");
 
-  // Windowed plugins receiving focus triggering WM_ACTIVATE app messages.
-  if (mWindowType == eWindowType_plugin && msg == WM_SETFOCUS &&
-      ::GetPropW(mWnd, L"PluginInstanceParentProperty")) {
-      ::ReplyMessage(0);
-      return;
-  }
-
   // Modal UI being displayed in windowless plugins.
   if (mozilla::ipc::RPCChannel::IsSpinLoopActive() &&
-      (::InSendMessageEx(NULL)&(ISMEX_REPLIED|ISMEX_SEND)) == ISMEX_SEND) {
+      (InSendMessageEx(NULL)&(ISMEX_REPLIED|ISMEX_SEND)) == ISMEX_SEND) {
     LRESULT res;
     if (IsAsyncResponseEvent(msg, res)) {
-      ::ReplyMessage(res);
-    }
-  }
-
-  // Windowless flash plugins sending WM_ACTIVATE events to the main window
-  // via child calls to ShowWindow. Unblock the child to prevent lock ups.
+      ReplyMessage(res);
+    }
+    return;
+  }
+
+  // Handle certain sync plugin events sent to the parent which
+  // trigger ipc calls that result in deadlocks.
+
+  // Windowed plugins receiving focus triggering WM_ACTIVATE app messages.
+  if (mWindowType == eWindowType_plugin && msg == WM_SETFOCUS &&
+    GetPropW(mWnd, L"PluginInstanceParentProperty")) {
+    ReplyMessage(0);
+    return;
+  }
+
+  // Windowless flash sending WM_ACTIVATE events to the main window
+  // via calls to ShowWindow.
   if (msg == WM_ACTIVATE && lParam != 0 &&
       LOWORD(wParam) == WA_ACTIVE && IsWindow((HWND)lParam) &&
-      (::InSendMessageEx(NULL)&(ISMEX_REPLIED|ISMEX_SEND)) == ISMEX_SEND) {
-    ::ReplyMessage(0);
+      (InSendMessageEx(NULL)&(ISMEX_REPLIED|ISMEX_SEND)) == ISMEX_SEND) {
+    ReplyMessage(0);
+    return;
+  }
+
+  // Windowed plugins that pass sys key events to defwndproc generate
+  // WM_SYSCOMMAND events to the main window.
+  if (msg == WM_SYSCOMMAND &&
+      (InSendMessageEx(NULL)&(ISMEX_REPLIED|ISMEX_SEND)) == ISMEX_SEND) {
+    ReplyMessage(0);
     return;
   }
 }
 
 #endif // MOZ_IPC
 
 /**************************************************************
  **************************************************************