Bug 541362 - [OOPP] hang closing tab with Yahoo web messenger loaded. r=bent.
authorJim Mathies <jmathies@mozilla.com>
Tue, 26 Jan 2010 15:40:43 -0600
changeset 37551 5207354fa2fe66fcd3c44765555662bb8801f4cf
parent 37550 6a942d99ce1e3c78a19c877b4622be47eb4bfb8b
child 37552 c6616d33ecb655a7ee7ec7fc3da0a4a9b2b5edc1
push id11371
push userbsmedberg@mozilla.com
push dateWed, 27 Jan 2010 16:56:23 +0000
treeherdermozilla-central@ae8c17be0129 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent
bugs541362
milestone1.9.3a1pre
Bug 541362 - [OOPP] hang closing tab with Yahoo web messenger loaded. r=bent.
dom/plugins/PluginInstanceChild.cpp
--- a/dom/plugins/PluginInstanceChild.cpp
+++ b/dom/plugins/PluginInstanceChild.cpp
@@ -683,16 +683,24 @@ PluginInstanceChild::PluginWindowProc(HW
     }
 
     NS_ASSERTION(self->mPluginWindowHWND == hWnd, "Wrong window!");
 
     // The plugin received keyboard focus, let the parent know so the dom is up to date.
     if (message == WM_MOUSEACTIVATE)
         self->CallPluginGotFocus();
 
+    // Prevent lockups due to plugins making rpc calls when the parent
+    // is making a synchronous SetFocus api call. (bug 541362) Add more
+    // windowing events as needed for other api.
+    if (message == WM_KILLFOCUS && 
+        ((InSendMessageEx(NULL) & (ISMEX_REPLIED|ISMEX_SEND)) == ISMEX_SEND)) {
+        ReplyMessage(0); // Unblock the caller
+    }
+
     LRESULT res = CallWindowProc(self->mPluginWndProc, hWnd, message, wParam,
                                  lParam);
 
     if (message == WM_CLOSE)
         self->DestroyPluginWindow();
 
     if (message == WM_NCDESTROY)
         RemoveProp(hWnd, kPluginInstanceChildProperty);