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

NullPointerException when scrolling not-yet-displayed WebView

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 8u66
    • Fix Version/s: None
    • Component/s: javafx
    • Subcomponent:
      web
    • CPU:
      x86
    • OS:
      windows_8

      Description

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

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 10.0.10240]

      A DESCRIPTION OF THE PROBLEM :
      This report is providing additional information to the bug JDK-8144162.

      Here's how to reproduce: https://gist.github.com/micheljung/ff146e904ef02b89d14f


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the program

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      No exception
      ACTUAL -
      An exception

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      java.lang.NullPointerException
      at com.sun.javafx.webkit.theme.ScrollBarThemeImpl.getThumb(ScrollBarThemeImpl.java:409)
      at com.sun.javafx.webkit.theme.ScrollBarThemeImpl.thumbPosition(ScrollBarThemeImpl.java:293)
      at com.sun.javafx.webkit.theme.ScrollBarThemeImpl.getThumbPosition(ScrollBarThemeImpl.java:389)
      at com.sun.webkit.WebPage.twkExecuteScript(Native Method)
      at com.sun.webkit.WebPage.executeScript(WebPage.java:1439)
      at javafx.scene.web.WebEngine.executeScript(WebEngine.java:982)
      at sample.JDK8144162.lambda$null$0(JDK8144162.java:18)
      at com.sun.javafx.application.PlatformImpl.lambda$null$174(PlatformImpl.java:295)
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.javafx.application.PlatformImpl.lambda$runLater$175(PlatformImpl.java:294)
      at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
      at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
      at com.sun.glass.ui.win.WinApplication.lambda$null$149(WinApplication.java:191)
      at java.lang.Thread.run(Thread.java:745)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.application.Platform;
      import javafx.concurrent.Worker;
      import javafx.scene.web.WebEngine;
      import javafx.scene.web.WebView;
      import javafx.stage.Stage;

      public class JDK8144162 extends Application {


        @Override
        public void start(Stage primaryStage) throws Exception {
          WebEngine engine = new WebView().getEngine();
          engine.getLoadWorker().stateProperty().addListener((observable, oldValue, newValue) -> {
            if (Worker.State.SUCCEEDED.equals(newValue)) {
              Platform.runLater(() -> engine.executeScript("window.scrollTo(0, document.documentElement.scrollHeight);"));
            }
          });
          engine.load("http://www.google.com");
        }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Make sure the WebView is added to the scene graph, otherwise don't call executeScript()

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              ghb Guru Hb (Inactive)
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: