Plugin focus: hang at PPluginInstanceParent::CallSetPluginFocus against child _NtUserSetFocus

RESOLVED FIXED

Status

()

Core
Plug-ins
RESOLVED FIXED
8 years ago
8 years ago

People

(Reporter: Benjamin Smedberg, Assigned: jimm)

Tracking

Trunk
x86
Windows 7
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

888 bytes, patch
Benjamin Smedberg
: review+
Details | Diff | Splinter Review
(Reporter)

Description

8 years ago
Got a hang while I was debugging... I don't think it's particular to the debugging environment, but it's hard to tell!

Parent:

 	xul.dll!mozilla::ipc::SyncChannel::WaitForNotify()  Line 506 + 0x13 bytes	C++
 	xul.dll!mozilla::ipc::RPCChannel::Call(IPC::Message * msg=0x06de2080, IPC::Message * reply=0x0019c25c)  Line 119	C++
 	xul.dll!mozilla::plugins::PPluginInstanceParent::CallSetPluginFocus()  Line 625 + 0x16 bytes	C++
>	xul.dll!mozilla::plugins::PluginInstanceParent::PluginWindowHookProc(HWND__ * hWnd=0x0017092e, unsigned int message=0x00000007, unsigned int wParam=0x005908d8, long lParam=0x00000000)  Line 903	C++
 	user32.dll!_InternalCallWinProc@20()  + 0x23 bytes	
 	user32.dll!_UserCallWinProcCheckWow@32()  + 0xb7 bytes	
 	user32.dll!_CallWindowProcAorW@24()  + 0x5e bytes	
 	user32.dll!_CallWindowProcW@20()  + 0x1b bytes	
 	xul.dll!PluginWndProc(HWND__ * hWnd=0x0017092e, unsigned int msg=0x00000007, unsigned int wParam=0x005908d8, long lParam=0x00000000)  Line 369 + 0x68 bytes	C++
 	user32.dll!_InternalCallWinProc@20()  + 0x23 bytes	
 	user32.dll!_UserCallWinProcCheckWow@32()  + 0xb7 bytes	
 	user32.dll!_DispatchClientMessage@24()  + 0x51 bytes	
 	user32.dll!___fnDWORD@4()  + 0x2b bytes	
 	ntdll.dll!_KiUserCallbackDispatcher@12()  + 0x2e bytes	
 	user32.dll!_NtUserSetFocus@4()  + 0x15 bytes	
 	xul.dll!nsWindow::SetFocus(int aRaise=0x00000000)  Line 1661	C++
 	xul.dll!nsFocusManager::Focus(nsPIDOMWindow * aWindow=0x04855b20, nsIContent * aContent=0x079378c0, unsigned int aFlags=0x00000000, int aIsNewDocument=0x00000001, int aFocusChanged=0x00000000, int aWindowRaised=0x00000001)  Line 1616	C++
 	xul.dll!nsFocusManager::WindowRaised(nsIDOMWindow * aWindow=0x04a9d698)  Line 685	C++
 	xul.dll!nsWebShellWindow::HandleEvent(nsGUIEvent * aEvent=0x0019c894)  Line 431	C++
 	xul.dll!nsWindow::DispatchEvent(nsGUIEvent * event=0x0019c894, nsEventStatus & aStatus=nsEventStatus_eIgnore)  Line 3013 + 0xc bytes	C++
 	xul.dll!nsWindow::DispatchWindowEvent(nsGUIEvent * event=0x0019c894)  Line 3037	C++
 	xul.dll!nsWindow::DispatchFocus(unsigned int aEventType=0x0000006b)  Line 3527 + 0x14 bytes	C++
 	xul.dll!nsWindow::DispatchFocusToTopLevelWindow(unsigned int aEventType=0x0000006b)  Line 3490 + 0xc bytes	C++
 	xul.dll!nsWindow::ProcessMessage(unsigned int msg=0x00000007, unsigned int & wParam=0x00000000, long & lParam=0x00000000, long * aRetValue=0x0019cf24)  Line 4301 + 0xd bytes	C++
 	xul.dll!nsWindow::WindowProc(HWND__ * hWnd=0x001004e8, unsigned int msg=0x00000007, unsigned int wParam=0x00000000, long lParam=0x00000000)  Line 3650 + 0x20 bytes	C++

Child:
 	user32.dll!_NtUserSetFocus@4()  + 0x15 bytes	
 	user32.dll!_NtUserSetFocus@4()  + 0x15 bytes	
 	user32.dll!_GetPropA@8()  + 0x41 bytes	
>	nptest.dll!PluginWndProc(HWND__ * hWnd=0x002407ae, unsigned int uMsg=0x00000021, unsigned int wParam=0x001004e8, long lParam=0x02010001)  Line 473 + 0x11 bytes	C++
 	user32.dll!_InternalCallWinProc@20()  + 0x23 bytes	
 	user32.dll!_UserCallWinProcCheckWow@32()  + 0xb7 bytes	
 	user32.dll!_CallWindowProcAorW@24()  + 0x5e bytes	
 	user32.dll!_CallWindowProcW@20()  + 0x1b bytes	
 	xul.dll!mozilla::plugins::PluginInstanceChild::PluginWindowProc(HWND__ * hWnd=0x002407ae, unsigned int message=0x00000021, unsigned int wParam=0x001004e8, long lParam=0x02010001)  Line 707 + 0x1d bytes	C++
 	user32.dll!_InternalCallWinProc@20()  + 0x23 bytes	
 	user32.dll!_UserCallWinProcCheckWow@32()  + 0xb7 bytes	
 	user32.dll!_DispatchClientMessage@24()  + 0x51 bytes	
 	user32.dll!___fnDWORD@4()  + 0x2b bytes	
 	ntdll.dll!_KiUserCallbackDispatcher@12()  + 0x2e bytes	
 	user32.dll!_NtUserPeekMessage@20()  + 0x15 bytes	
 	user32.dll!__PeekMessage@24()  + 0x2d bytes	
 	user32.dll!_PeekMessageW@20()  + 0x197 bytes	
 	xul.dll!base::MessagePumpForUI::ProcessNextWindowsMessage()  Line 335 + 0x12 bytes	C++
 	xul.dll!base::MessagePumpForUI::DoRunLoop()  Line 205 + 0x8 bytes	C++
 	xul.dll!base::MessagePumpWin::RunWithDispatcher(base::MessagePump::Delegate * delegate=0x02bcfda4, base::MessagePumpWin::Dispatcher * dispatcher=0x00000000)  Line 54	C++
 	xul.dll!base::MessagePumpWin::Run(base::MessagePump::Delegate * delegate=0x02bcfda4)  Line 78 + 0x15 bytes	C++

In the parent PluginInstanceParent::PluginWindowHookProc right above the call to CallSetPluginFocus, there's a fun little comment:

        case WM_SETFOCUS:
        // Widget may be calling us back from AnswerPluginGotFocus(), make
        // sure we don't end up sending this back over. If we're not in
        // SendMessage, this is coming from the dom / focus manager.
        if ((::InSendMessageEx(NULL) & ISMEX_SEND|ISMEX_REPLIED) != ISMEX_SEND)
            self->CallSetPluginFocus();
(Assignee)

Updated

8 years ago
OS: Linux → Windows 7
(Assignee)

Comment 1

8 years ago
I think ReplyMessage for focus events is going to have to be part of the standard path for plugin windows in parent. If InSendMessage can't pick this up, we're sort of screwed here.
(Reporter)

Comment 2

8 years ago
Created attachment 426309 [details] [diff] [review]
ReplyMessage, rev. 1

Like this?
Assignee: nobody → benjamin
Status: NEW → ASSIGNED
Attachment #426309 - Flags: review?(jmathies)
Comment on attachment 426309 [details] [diff] [review]
ReplyMessage, rev. 1

Hm. If InSendMessage is returning false then ReplyMessage won't do anything.
(Assignee)

Comment 4

8 years ago
(In reply to comment #3)
> (From update of attachment 426309 [details] [diff] [review])
> Hm. If InSendMessage is returning false then ReplyMessage won't do anything.

I was thinking of doing it down in widget, in between the dispatch focus to top level window call and the wm_focus event that's received from the child.
(Reporter)

Comment 5

8 years ago
->jmathies
Assignee: benjamin → jmathies
(Assignee)

Updated

8 years ago
Attachment #426309 - Attachment is obsolete: true
Attachment #426309 - Flags: review?(jmathies)
(Assignee)

Comment 6

8 years ago
Created attachment 427597 [details] [diff] [review]
patch

dumb dumb
Attachment #427597 - Flags: review?(benjamin)
(Reporter)

Comment 7

8 years ago
Comment on attachment 427597 [details] [diff] [review]
patch

heh!
Attachment #427597 - Flags: review?(benjamin) → review+
(Assignee)

Comment 8

8 years ago
http://hg.mozilla.org/mozilla-central/rev/c4d326d51866
Status: ASSIGNED → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.