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

Regression: JavaScript-to-Java call following object tag sometimes occurs exception.

    Details

    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_xp

      Backports

        Description

        JRE version: JRE 6u11
        OS: IE 6 SP1 and Windows XP SP1

        When a JavaScript-to-Java call is described just after object tag in html, the JavaScript call
        is sometimes invoked before Server-side Java plugin attempts to start Client-side Java plugin
        process, and the call causes an exception.

          <body>
          <object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" width="100" height="100">
            <param name="code" value="example/Test" >
            <param name="archive" value="Test.class" >
            <param name="scriptable" value="true">
          </object>
          <script>
          var obj = document.applets[0];
          try {
            obj.fromJavaScript();
          }
          catch(e){
            alert("error was occured " + e.message)
          }
          </script>
          </body>


        According to the following document, A JavaScript-to-Java call should be blocked until
        Applet.init() returns.

          http://java.sun.com/javase/6/webnotes/6u10/plugin2/liveconnect/index.html#INITIAL_JS_J_CALL

        In Classic plugins (including plugins before 6u10), the code never causes an exception
        and the JavaScript-to-Java call is always invoked after Applet.init(). It is a regression.


          Customer's reproducible program:

            /net/cores.central/cores/dir24/72440542/
              test.zip
              test_source.zip

          Reproduction procedure:

          (1) Extract test.zip.

          (2) Open test.html using IE 6.

          (3) When Test applet in test.html starts, you can see the following messages
          in Java Console.

            init start
            init continue
            init continue
            init continue
            init continue
            init continue
            init continue
            init continue
            init continue
            init continue
            init continue
            init end
            basic: Applet initialized
            basic: Removed progress listener: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@578ceb
            basic: Applet made visible
            basic: Starting applet
            basic: Applet started
            basic: Told clients applet is started
            fromJavaScript start
            fromJavaScript end

            Where the pair of "init start" and "init end" shows that Applet.init()
            was called and the pair of "fromJavaScript start" and "fromJavaScript end"
            shows that the method was called by a JavaScript-to-Java call.
            The JavaScript-to-Java call is normally blocked until Applet.init() finishes
            at the first loading.

          (4) Refresh the same page by pressing F5 key.

            The JavaScript-to-Java call is not blocked until Applet.init() and
            immediately return with an exception at the first and later refresh operations.
            If an error dialog appears, it means the exception occurs (See the following
            code in test.html) and the JavaScript-to-Java call is not blocked.

              var obj = document.applets[0];
              try {
                obj.fromJavaScript();
              }
              catch(e){
                alert("error was occured " + e.message)
              }

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  masayosh Masato Yoshida (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: