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

JS2Java Bridge arrays and other parts of JS2Java Bridge do not work on Linux

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 7u6
    • 7u6
    • javafx
    • linux

    • web

      JavaScript2Java Bridge arrays do not work on Linux.
      Try the following example to reproduce that:

      import com.sun.webpane.webkit.JSObject;
      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.web.WebEngine;
      import javafx.scene.web.WebView;
      import javafx.stage.Stage;

      /**
       *
       * @author javafx
       */
      public class JavaFXApplication1 extends Application {

          /**
           * @param args the command line arguments
           */
          public static void main(String[] args) {
              launch(args);
          }
          
          @Override
          public void start(Stage primaryStage) {
              WebView view = new WebView();
              WebEngine e = view.getEngine();
              int []array = new int[3];
              array[0] = 42;
              JSObject window = (JSObject) e.executeScript("window;");
              window.setMember("test", array);
              Object o1 = e.executeScript("test[0];");
              Object o2 = e.executeScript("test.length;");
              System.out.println(o1); // Expecting "42"
              System.out.println(o2); // Expecting "3"
              primaryStage.setScene(new Scene(view));
              primaryStage.show();
          }
      }

      The following output is generated:
      Exception in thread "JavaFX Application Thread" java.lang.NoSuchMethodError: booleanValue
      undefined
      undefined
      at com.sun.webpane.webkit.JSObject.setMemberImpl(Native Method)
      at com.sun.webpane.webkit.JSObject.setMember(JSObject.java:37)
      at javaapplication1.JavaFXApplication1.start(JavaFXApplication1.java:30)
      at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319)
      at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:206)
      at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:173)
      at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:76)
      at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
      at com.sun.glass.ui.gtk.GtkApplication$3$1.run(GtkApplication.java:82)
      at java.lang.Thread.run(Thread.java:722)

      Some other of our JS2Java tests which previously failed due to different reasons also fail with this exception, so the problem might be wider then JS2Java array.

            peterz Peter Zhelezniakov
            ilatyshe Irina Grineva (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: