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

Browser crashes on invoking a native awt GetDrawingSurface call from applet

    • 2d
    • 02
    • x86
    • windows_nt, windows_2000

        Tested_Java_Release : Mantis 1.4.2
        Tested_Build : build 8/9/10
        Tested_Build_Location : /net/koori.sfbay/p/jdk01/jdk/1.4.2/beta/b10/bundles/windows-i586
        /net/koori.sfbay/p/jdk01/jdk/1.4.2/beta/b11/bundles/windows-i586
        /net/koori.sfbay/p/jdk01/jdk/1.4.2/beta/b12/bundles/windows-i586
        Test_Location :
          http://gladius.sfbay/tests/crasher/pluginhtml-default/test1Frame.html
        Tested_Machine_Name : namrata
        Tested O/S : Win32
        Tested_ Browsers : IE6/NS4.x/NS6.x
          
        Problem Description:

         For interaction with native browser windows/dialogs SQE uses NWQE (native windowing query extension).
         Using NWQE Java API's we can pass a particular window title to NWQE and
         can retrieve the window object (along with its sub-components).
         Once in focus, using Robot we can send in Tab key event or mouse click to
         buttons or type in TextField.
         
         The test http://gladius.sfbay/tests/crasher/pluginhtml-default/test1Frame.html
         invokes an applet from an Authenticated Web-Server.
         On invokation, browser displays the authenticated popup.
         The Driver class displayed on the left frame on the HTML page, invokes
        NWQE api's, waits for the popup to be displayed and once displayed, it will send in robot key event to enter username and password.

         This interaction works fine with 1.4.1 but with 1.4.2 browser crashes.
         The crash is in the native call, when trying to retrieve the NativeComponentTree.
         To be specific it fails when NWQE tries to use
           GetDrawingSurface call.


        This is a stopper bug as many of our automation suites which depend on NWQE
        will crash or fail.


         NWQE master workspace: /net/sqesvr.sfbay/export/jfc/dherron/nwqe
         My child workspace: /net/sqesvr.sfbay/deployment2/rpallath/nwqe
         Related Files: wintree.c
                        NativeTree.h
                        classes/nwqe/WinComponentData.java
                        classes/nwqe/NativeTree.java
                        classes/nwqe/NativeComponentData.java

           
        Steps to Reproduce :
        --------------------
         1) Install JRE
         2) Copy /net/sqesvr.sfbay/deployment2/rpallath/nwqe/myproject/tree.dll to
            <jre>/bin dir.
         3) Copy http://gladius.sfbay/tests/crasher/lib/authenticate_nativedialog.txt
            to <jre>/lib/ext dir.
         4) Set .java.policy in your home dir.
             grant {
              permission java.security.AllPermission;
             };

            Or you could also copy fine grained poilicy from
             http://gladius.sfbay/tests/crasher/lib/java.policy
           to your home dir
            <home>/.java.policy

         5) Invoke Internet explorer
         6) Load URL http://gladius.sfbay/tests/crasher/pluginhtml-default/test1Frame.html
          Leave your mouse.
         
         It will invoke an HTML page with 2 frames.
         Left frame has the driver program (a Java applet) which reads the .txt file from <lib>/ext and send in key events for
         username: authtester
         password: authtester

        and also will click on "Ok" button.

        Source: http://gladius.sfbay/tests/crasher/src/AuthenticateDriver.java
         
        But browser crashes way before while trying to retrieve the native
        windw objects.
        It crashes in method getWindow()
        NativeComponentData[] nobjects = nt.getNativeComponentTree(this, windowTitle);

        The above method calls into tree.dll.
        If you look at win32tree.c, it fails at function
        JNICALL Java_NativeTree_getNativeComponentTree()

        and at call
          ds = awt.GetDrawingSurface(env, canvas);

        The canvas being passed is actually the applet reference.


        The same test works fine with 1.4.1
        It is a regression.


        ------------------------------------------------------------------------------
        ###@###.### 2002-12-21

        I was baffled at why I could not reproduce it with the build when working with developer.
        I then spend some time trying out all the combination, and I finally got it
        to crash.
        The culprit .java.policy file.

        With 1.4.2
        If I execute with policy set to
        grant {
          permission java.security.AllPermission;
        };
        everything works fine.

        However as soon as I set it to
        grant {
          permission java.awt.AWTPermission "createRobot";
          permission java.awt.AWTPermission "replaceKeyboardFocusManager";
          permission java.util.PropertyPermission "*", "read,write";
          permission java.lang.RuntimePermission "modifyThread";
          permission java.io.FilePermission "${java.home}${/}-", "read,write,execute,del
        ete";
          permission java.lang.RuntimePermission "modifyThreadGroup";
          permission java.lang.RuntimePermission "loadLibrary.tree";
        };

        I start seeing the crash.
        When trying with the developer, I was always using AllPermission and hence we never saw the crash.


        With 1.4.1 however, both the policy works.


        I have made a copy of the whole dir at
        /net/sqesvr.sfbay/deployment2/rpallath/crasher


        NOTE: If using XP machine, then instead of step (3) do the following
         3) Copy http://gladius.sfbay/tests/crasher/lib/authenticate_nativedialog_xp.txt
            to <jre>/lib/ext/authenticate_nativedialog.txt.


              chaasesunw Chet Haase (Inactive)
              rpallathsunw Rajendra Pallath (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: