Bug 676361 Plugin hangs when content's script accesses plugin at mouse wheel event which wasn't consumed by the plugin r=jimm
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 09 Aug 2011 10:12:03 +0900
changeset 74008 87e3ea12ed5d1dbf2dedc6c9a73ab25fac29ee47
parent 74007 a690d8fbcc48a4602a75caf1330ad635de3ecb2b
child 74055 08327218cb8bd31bd4b91993a63bde497a5f7842
child 74094 cee834f57d427629d61c8bf0d975a368e945309c
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
reviewersjimm
bugs676361
milestone8.0a1
Bug 676361 Plugin hangs when content's script accesses plugin at mouse wheel event which wasn't consumed by the plugin r=jimm
widget/src/windows/nsWindow.cpp
--- a/widget/src/windows/nsWindow.cpp
+++ b/widget/src/windows/nsWindow.cpp
@@ -7672,45 +7672,49 @@ nsWindow::OnMouseWheel(UINT aMsg, WPARAM
       if (!wnd) {
         return;
       }
     }
 
     NS_ASSERTION(destWindow, "destWindow must not be NULL");
     // If the found window is our plugin window, it means that the message
     // has been handled by the plugin but not consumed.  We should handle the
-    // message on its parent window.
+    // message on its parent window.  However, note that the DOM event may
+    // cause accessing the plugin.  Therefore, we should unlock the plugin
+    // process by using PostMessage().
     if (destWindow->mWindowType == eWindowType_plugin) {
       destWindow = destWindow->GetParentWindow(PR_FALSE);
       NS_ENSURE_TRUE(destWindow, );
     }
     UINT internalMessage = GetInternalMessage(aMsg);
-    destWindow->ProcessMessage(internalMessage, aWParam, aLParam, aRetValue);
+    ::PostMessage(destWindow->mWnd, internalMessage, aWParam, aLParam);
     return;
   }
 
   // If the window under cursor is not in our process, it means:
   // 1. The window may be a plugin window (GeckoPluginWindow or its descendant).
   // 2. The window may be another application's window.
   HWND pluginWnd = FindOurProcessWindow(underCursorWnd);
   if (!pluginWnd) {
     // If there is no plugin window in ancestors of the window under cursor,
     // the window is for another applications (case 2).
     // We don't need to handle this message.
     return;
   }
 
   // If we're a plugin window (MozillaWindowClass) and cursor in this window,
   // the message shouldn't go to plugin's wndproc again.  So, we should handle
-  // it on parent window.
+  // it on parent window.  However, note that the DOM event may cause accessing
+  // the plugin.  Therefore, we should unlock the plugin process by using
+  // PostMessage().
   if (mWindowType == eWindowType_plugin && pluginWnd == mWnd) {
     nsWindow* destWindow = GetParentWindow(PR_FALSE);
     NS_ENSURE_TRUE(destWindow, );
     UINT internalMessage = GetInternalMessage(aMsg);
-    destWindow->ProcessMessage(internalMessage, aWParam, aLParam, aRetValue);
+    ::PostMessage(destWindow->mWnd, internalMessage, aWParam, aLParam);
     return;
   }
 
   // If the window is a part of plugin, we should post the message to it.
   ::PostMessage(underCursorWnd, aMsg, aWParam, aLParam);
 }
 
 /**