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

JavaFX WebView fails to track URL changes for PJAX websites

    Details

    • Subcomponent:
      web
    • CPU:
      x86
    • OS:
      generic

      Backports

        Description

        FULL PRODUCT VERSION :
        java version "1.8.0_92"
        Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
        Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        Microsoft Windows [Version 10.0.10586]

        Darwin deju-mbpro.local 15.4.0 Darwin Kernel Version 15.4.0: Fri Feb 26 22:08:05 PST 2016; root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64

        A DESCRIPTION OF THE PROBLEM :
        JavaFX's WebView component fails to detect URL location changes for websites using PJAX.

        For example, I found these two webpages that use PJAX: ghosttunes.com and thesimplefact.org. If you inspect the requests as you browse these websites, you'll see they're using PJAX as you navigate from page to page. WebView successfully loads and renders these pages, but WebEngine's location property fails to fire events to any attached change listeners.


        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        1) Create a JavaFX WebView
        2) Add a ChangeListener to WebEngine's location property and print the URL location changes
        3) Navigate to a site using PJAX like https://ghosttunes.com/ or http://thesimplefact.org/
        4) Navigate to other pages within the site.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        The location property ChangeListener should fire.
        ACTUAL -
        The location property ChangeListener did not fire.

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        import javafx.application.Application;
        import javafx.scene.Group;
        import javafx.scene.Scene;
        import javafx.scene.web.WebEngine;
        import javafx.scene.web.WebView;
        import javafx.stage.Stage;

        /**
         * @author Dennis Ju
         */
        public class TestWebView2 extends Application {

        @Override
        public void start(Stage stage) {
        stage.setWidth(800);
        stage.setHeight(600);

        WebView webView = new WebView();
        WebEngine webEngine = webView.getEngine();
        Scene scene = new Scene(new Group());
        scene.setRoot(webView);
        stage.setScene(scene);
        stage.show();

        webEngine.locationProperty().addListener(
        (observableValue, oldValue, newValue) -> {
        // This listener does not fire for requests using PJAX

        System.out.println(newValue);
        });

        webEngine.load("https://ghosttunes.com");
        }

        public static void main(String[] args) {
        launch(args);
        }
        }
        ---------- END SOURCE ----------

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  ghb Guru Hb
                  Reporter:
                  webbuggrp Webbug Group
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  7 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: