United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6869937 New Plugin - Vista&XP Focus never returned to browser
JDK-6869937 : New Plugin - Vista&XP Focus never returned to browser

Details
Type:
Bug
Submit Date:
2009-08-10
Status:
Closed
Updated Date:
2011-02-16
Project Name:
JDK
Resolved Date:
2010-07-26
Component:
deploy
OS:
windows_vista,generic
Sub-Component:
plugin
CPU:
generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
6u15,6-pool
Fixed Versions:
6u21-rev (b08)

Related Reports
Backport:
Backport:

Sub Tasks

Description
Ephox sent the test case to us at /net/cores.central.sun.com/cores/71413024

Here is the reproducible steps

- Open dist/testPage.html and click the button to raise a liveconnect call to the applet.
- A dialog should appear for a few seconds then be disposed.
- From this point on, clicking in the textbox on the page will not place the caret in this field.

I can replicate the problem with JRE 6 update 10, 11, 12, 13, 14 and 15. I can also replicate the problem on JRE 1.5.0_19 and JRE 1.5.0_17. I cannot replicate the problem with JRE 6 update 7.

If I switch to classic plugin on vista and XP issue goes away.

In the customer's code, I noticed

public void setVisible(boolean visible, Runnable runner) {
        if (visible && !isVisible()) {
            new Thread(runner).start();
        }
       
        super.setVisible(visible);
    }

The new thread spins another thread so the drawing code is not on the EDT anymore when cu calls _dialog.dispose();

I ran jstack against Firefox and java when the problem happens. Please see attached

                                    

Comments
EVALUATION

Code change in WindowsHelper.c :

HWND hWnd = (HWND)wParam;
     BOOL bWindowBlocked = FALSE;
     if (*IsWindow(hWnd)* && (GetProp(hWnd, ModalBlockerProp) != NULL)) {  <-----
         bWindowBlocked = TRUE;
     }      if (((code == HCBT_ACTIVATE) ||
         (code == HCBT_SETFOCUS)) &&
         bWindowBlocked) {
         // Veto this event
         reactivateCurrentModalDialog();
         return 1;   //this would consume the message and not let it go to the Applet's frame.
     }

It should be like this:

HWND hWnd = (HWND)wParam;
HWND blocker = GetProp(hWnd, ModalBlockerProp);
if (*IsWindow(blocker)* &&
    ((code == HCBT_ACTIVATE) ||
    (code == HCBT_SETFOCUS)))
{
    ...
}
                                     
2010-02-10



Hardware and Software, Engineered to Work Together