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

JSException: ReferenceError: Can't find variable: IntersectionObserver

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • jfx18
    • jfx11, 8, jfx18
    • javafx
    • None
    • web

        If a web page uses the Intersection Observer web API, when loading it from the JavaFX WebView the page load but such functionality doesn't work. As expected, it works when opening the page from Safari, Chrome and other browsers.

        Also, trying to run a script that invokes such functionality, like the one in the attached sample, fails with:

        Exception in thread "JavaFX Application Thread" netscape.javascript.JSException: ReferenceError: Can't find variable: IntersectionObserver
                at javafx.web@18-ea/com.sun.webkit.dom.JSObject.fwkMakeException(JSObject.java:160)
                at javafx.web@18-ea/com.sun.webkit.WebPage.twkExecuteScript(Native Method)
                at javafx.web@18-ea/com.sun.webkit.WebPage.executeScript(WebPage.java:1562)
                at javafx.web@18-ea/javafx.scene.web.WebEngine.executeScript(WebEngine.java:985)
                at WebTestApp.lambda$start$0(WebTestApp.java:19)
         
        This can be reproduced with any JavaFX version (11 to head).

        In WebKit, the Intersection Observer feature is marked as experimental and not enabled for WebKitLegacy:

        https://github.com/openjdk/jfx/blob/master/modules/javafx.web/src/main/native/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml#L434

        with a comment that says:

        # FIXME: This is on by default in WebKit2. Perhaps we should consider turning it on for WebKitLegacy as well.

        In fact, enabling such feature works, so maybe what could be already done?

              jpereda Jose Pereda
              jpereda Jose Pereda
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: