Bug 677883 - Bypass deferred message processing for accessible tab windows. Fixes occasional wm_getobject query failures, which must be responded to. r=davidb

This commit is contained in:
Jim Mathies 2011-10-11 11:11:35 -05:00
parent 19d2a8abdf
commit fce2e8b202
3 changed files with 29 additions and 8 deletions

View File

@ -743,6 +743,10 @@ nsRefPtrHashtable<nsVoidPtrHashKey, nsDocAccessible> nsAccessNodeWrap::sHWNDCach
LRESULT CALLBACK
nsAccessNodeWrap::WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
// Note, this window's message handling should not invoke any call that
// may result in a cross-process ipc call. Doing so may violate RPC
// message semantics.
switch (msg) {
case WM_GETOBJECT:
{

View File

@ -46,6 +46,10 @@
#include "nsArrayUtils.h"
#include "nsIDocShellTreeItem.h"
// Window property used by ipc related code in identifying accessible
// tab windows.
const PRUnichar* kPropNameTabContent = L"AccessibleTabWindow";
HRESULT
nsWinUtils::ConvertToIA2Array(nsIArray *aGeckoArray, IUnknown ***aIA2Array,
long *aIA2ArrayLen)
@ -149,7 +153,7 @@ nsWinUtils::CreateNativeWindow(LPCWSTR aWindowClass, HWND aParentWnd,
int aX, int aY, int aWidth, int aHeight,
bool aIsActive)
{
return ::CreateWindowExW(WS_EX_TRANSPARENT, aWindowClass,
HWND hwnd = ::CreateWindowExW(WS_EX_TRANSPARENT, aWindowClass,
L"NetscapeDispatchWnd",
WS_CHILD | (aIsActive ? WS_VISIBLE : 0),
aX, aY, aWidth, aHeight,
@ -157,6 +161,11 @@ nsWinUtils::CreateNativeWindow(LPCWSTR aWindowClass, HWND aParentWnd,
NULL,
GetModuleHandle(NULL),
NULL);
if (hwnd) {
// Mark this window so that ipc related code can identify it.
::SetPropW(hwnd, kPropNameTabContent, (HANDLE)1);
}
return hwnd;
}
void

View File

@ -101,6 +101,8 @@ using namespace mozilla::ipc::windows;
// pulled from widget's nsAppShell
extern const PRUnichar* kAppShellEventId;
// pulled from accessibility's win utils
extern const PRUnichar* kPropNameTabContent;
namespace {
@ -379,6 +381,12 @@ WindowIsDeferredWindow(HWND hWnd)
return false;
}
// Tab content creates a window that responds to accessible WM_GETOBJECT
// calls. This window can safely be ignored.
if (::GetPropW(hWnd, kPropNameTabContent)) {
return false;
}
// Common mozilla windows we must defer messages to.
nsDependentString className(buffer, length);
if (StringBeginsWith(className, NS_LITERAL_STRING("Mozilla")) ||