Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7128437

In IE9 Applet showDocument call results in focus being applied to IE window

XMLWordPrintable

    • x86
    • windows_7

      FULL PRODUCT VERSION :
      JDK used - 1.6.0_23
      JRE used - 1.7.0_01

      ADDITIONAL OS VERSION INFORMATION :
      Windows 7 Ultimate, 64-bit, running 32-bit JRE

      A DESCRIPTION OF THE PROBLEM :
      This bug *only* happens in IE, and only happens using Java JRE 6 update 27 or later (current JRE exhibits the issue.) Chrome does not exhibit this issue with the JRE, FireFox does not exhibit this issue either.

      Discovered because an applet of ours makes a calls to JavaScript functions in the hosting HTML page rapidly, we could not give the focus to other windows in the operating system, it would return immediately to the applet window. Minimizing the IE window resulted in the IE window being immediately restored. Commenting out our call to showDocument eliminates the problem. Replacing the showDocument call with JSObject.eval() eliminates the problem as well; however, we need to support older JDKs such as 1.1.

      Again, prior to JRE 6 updated 27 the problem does not exist. Bug fix list for update 27 mentions a Vista/IE7 showDocument focus fix of some sort; although the bug may just be one of the many 'IE' does weird stuff issues...

      Luckily it only happens on versions of the JRE that support JSObject so we have simply created a dynamically loaded class that provides an interface to a function that calls the proper method for the proper JRE.

      REGRESSION. Last worked in version 6u29

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create an applet. After the applet has started up and initialized, have a thread in the applet repeatedly call a javascript function in the hosting HTML document and while this is running, try to give another window (even windows in other processes) input focus. Focus will snap back to the host document each time the showDocument call is executed. Comment out the showDocument call and focus will work as expected.

      Must be using IE (tested on IE9 but reported to happen by co-workers in IE8 and IE7) and a JRE >= JRE 6 update 27.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I was expecting focus to be unaffected by the showDocument call.
      ACTUAL -
      Focus is grabbed by the hosting HTML document (or possibly the plugin but I am unsure.)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      Sorry, I don't have time to do this right now, I will try to create a tiny test case and update the bug later.
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Avoid using showDocument to trigger JavaScript functions, instead use JSObject calls. For JREs that do not support JSObject it is safe to use the showDocument calls since the bug appears to only exist in JRE 6 update 27 and later.

            ccheung Calvin Cheung
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: