JDK-6869937 : New Plugin - Vista&XP Focus never returned to browser
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 6u15,6-pool
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic,windows_vista
  • CPU: generic
  • Submitted: 2009-08-10
  • Updated: 2011-02-16
  • Resolved: 2010-07-26
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7
6u21-rev b08Fixed 7-poolResolved
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))) { ... }
10-02-2010