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

Windows opened through the JSObject pop-up behind the main applet window.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 6
    • client-libs
    • x86
    • windows_2003

      FULL PRODUCT VERSION :
      Since 1.6.0_10

      Latest tested-

      java version "1.6.0_21"
      Java(TM) SE Runtime Environment (build 1.6.0_21-b06)
      Java HotSpot(TM) Client VM (build 17.0-b16, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Server Platform: Windows 2003+ and IIS 6+
      Client Platform: Windows XP+ and IE 6+

      A DESCRIPTION OF THE PROBLEM :
      A window with a JSObject object pops up behind the main applet window. The applet using the 1.5 plug-in works properly, popping the window up in front of the applet window. But running the same applet under the 1.6 plug-in pops the window up behind the applet window.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Define the following class:

        BugTestApplet.java-------------------------------------------------------------

      import java.awt.event.ActionEvent;
      import java.awt.event.ActionListener;
      import javax.swing.JApplet;
      import javax.swing.JButton;
      import netscape.javascript.JSObject;

      public class BugTestApplet extends JApplet implements ActionListener {
         public BugTestApplet() { super(); }

         public void init() {
             JButton button = new JButton("Test");

             this.add(button);

             button.setVisible(true);
             button.addActionListener(this);
         }

         public void actionPerformed(ActionEvent e) {
             String jsCall = "window.open('helloWorld.html');";
             JSObject.getWindow(this).eval(jsCall);
         }
      }

      -------------------------------------------------------------------------------

      Compile this class with a target of 1.5 (or use a 1.5 JDK and compile)

      Create the following 2 html files:

      helloWorld.html----------------------------------------------------------------

      <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
      <html>
      <head></head>
      <body>
        <h1>Hello World!</h1>
      </body>
      </html>

      bug.html-----------------------------------------------------------------------

      <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
      <html>
      <head><title>Bug Demo Validation Applet</title></head>
      <body>
          <h1>Bug Demo</h1>
          <object name="Bug_Demo"
               classid="clsid:CAFEEFAC-0015-0000-0012-ABCDEFFEDCBA"
                 width="60"
                height="30">
              <param name="code"
                    value="BugTestApplet.class">
              <param name="type"
                    value="application/x-java-applet;jpi-version=1.6.0.21">
              <param name="scriptable"
                    value="true">
          </object>
      </body>
      </html>

      -------------------------------------------------------------------------------

      Put bug.html and helloWorld.html in the root of the IIS web server.

        To see the problem, perform the following steps:

       1. Install a 1.5.0_12 plugin on the web client machine.

       2. Make a "classes" sub-folder in the JRE home folder for the plug-in.

       3. Drop the compiled BugTestApplet.class file into the "classes" sub-folder.

       4. Use IE on the web client and browse to http://webserver/bugTest.html.

       5. Click the button that says "Test"

       6. Note that "Hello World!" opens in a new window in front of the applet
          window.

       7. Uninstall 1.5.0_12

       8. Install 1.6.0_21.

       9. Repeat steps 2-5.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      10. "Hello World!" page should open in a new window in front of the applet window.
      ACTUAL -
      10. Note that "Hello World!" page opens in a new window behind the applet
          window.

      So, running the applet using the 1.5 plug-in works properly, popping the
      window up in front of the applet window, but running the same applet under
      the 1.6 plug-in pops the window up behind the applet window.

      This is, therefore, a regression.

      Changes that make no difference:

      A. Deploying the applet by traditional means, i.e. by building an applet jar
         file (signed or unsigned) and altering bug.html to use the jar.

         Obviously,we first observed the bug when we were using a traditional
         deployment scheme. The use of the "classes" sub-folder in the JRE is meant
         to get to the demonstration of the bug as quickly as possible.

      B. Re-compiling the Java code with a target of 1.6

         Of course, this breaks the applet for the 1.5 plug-in, but to no avail. The
         new window still opens behind the applet window.

      C. Invoking .focus() on the window that the JSObject opens.

      D. Using the applet tag.

      E. Running the code to open the new window in a separate thread.

      F. Using a different version of the 1.6 plug-in.

         We have been seeing this problem since 1.6.0_10.

      G. Using a different version of IE.

         This problem occurs on IE 6, IE 7 and IE 8. (It doesn't occur for Chrome,
         but that's no workaround, since our customers won't use Chromw, nor does
         it show that this is an IE problem, since the window pops up corrctly in IE
         for Java 1.5)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      Please see "Steps to Reproduce"
      ---------- END SOURCE ----------

      SUPPORT :
      YES

            dav Andrei Dmitriev (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: