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

EXCEPTION_ACCESS_VIOLATION in jfxwebkit.dll when doing JSObject.toString when JSObject is passed through Event.getTarget in EventListener

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 8
    • 7u6
    • javafx
    • None
    • JDK 1.7.0_06, Javafx SDK 2.2 AND Javafx SDK 2.1, windows XP, eclipse-SDK-3.7.2-win32-efx-0.1.0

    • web

      I'm gettings these strange crashes in jfxwebkit.dll when I do a JSObject/Node toString. The strange thing is that some JSObject handle toString without problem, these JSObject are referenced from JSObject doc= (JSObject) WebEngine.getDocument(). Nodes that are accessed from a DOM event listener crash and burn when you touch them, except when you reference the Document object.

      To reproduce create an empty ViewPart (http://efxclipse.org/tut3.html) and place the following snippets in the public void createPartControl(Composite parent) {} method.

      >> Situation 1, content loaded from network..
      public void createPartControl(Composite parent) {
              FXCanvas canvas= new FXCanvas(parent, SWT.NONE);
              WebView view= new WebView();
              canvas.setScene(new Scene(view));
              final EventListener insert_listener= new EventListener() {
                  @Override
                  public void handleEvent(Event event) {
                      Node inserted_node= (Node) event.getTarget();

                      // This prints [object HTMLDocument]
                      System.out.println("inserted_node.getOwnerDocument() - " + inserted_node.getOwnerDocument());
                         
                      // This crashes the JVM
                      System.out.println("inserted_node - " + inserted_node);
                  }
              };
              view.getEngine().documentProperty().addListener(new ChangeListener<Document>() {
                  @Override
                  public void changed(ObservableValue<? extends Document> observable,
                          Document oldValue, Document newValue) {
                      if (oldValue instanceof EventTarget)
                          ((EventTarget) oldValue).removeEventListener("DOMNodeInserted", insert_listener, false);
                      if (newValue instanceof EventTarget)
                          ((EventTarget) newValue).addEventListener("DOMNodeInserted", insert_listener, false);
                  }
              });
              view.getEngine().load("http://google.com");
          }

      >> Situation 2, content loaded from string..
          public void createPartControl(Composite parent) {
              String html= "<html><head></head><body><h1 id=\"foo\">Hello world</h1></body></html>";
              FXCanvas canvas= new FXCanvas(parent, SWT.NONE);
              WebView view= new WebView();
              canvas.setScene(new Scene(view));
              final EventListener click_listener= new EventListener() {
                  @Override
                  public void handleEvent(Event event) {
                      Node clicked_node= (Node) event.getTarget();

                      // This prints [object HTMLDocument]
                      System.out.println("clicked_node.getOwnerDocument() - " + clicked_node.getOwnerDocument());
                         
                      // This crashes the JVM (Click on the <h1> element)
                      System.out.println("clicked_node - " + clicked_node);
                  }
              };
              view.getEngine().documentProperty().addListener(new ChangeListener<Document>() {
                  @Override
                  public void changed(ObservableValue<? extends Document> observable,
                          Document oldValue, Document newValue) {
                      if (oldValue instanceof EventTarget)
                          ((EventTarget) oldValue).removeEventListener("click", click_listener, false);
                      if (newValue instanceof EventTarget)
                          ((EventTarget) newValue).addEventListener("click", click_listener, false);
                  }
              });
              view.getEngine().loadContent(html);
          }

      See attachment for crash reports.

            uta Alexey Utkin (Inactive)
            dklerkjfx DM de Klerk (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: