JDK-8173250 : WebView displays garbled character on some websites.
  • Type: Bug
  • Component: javafx
  • Sub-Component: web
  • Affected Version: 8u121
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: os_x
  • CPU: x86
  • Submitted: 2017-01-22
  • Updated: 2017-01-24
  • Resolved: 2017-01-24
Related Reports
Duplicate :  
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
macOS Siera ver 10.12.1 (16B2555)

A DESCRIPTION OF THE PROBLEM :
Some websites such as blogs from http://www.wordpress.com will attempt to render web page, but many of the characters aren't readable. I believe the webkit crashes and doesn't finish rendering html.

Go to any blog from wordpress such as mine below:
https://carlfx.wordpress.com

When rendered in any browser the html renders fine.


REGRESSION.  Last worked in version 8u112

ADDITIONAL REGRESSION INFORMATION: 
This can be reproduced in update 112 also.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a JavaFX application with a WebView control to load a WordPress blog such as http://fxexperience.com or http://carlfx.wordpress.com

I've attached code to test this issue.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The WordPress blog website's html pages render incorrectly and the text is readable.
ACTUAL -
The WebKit crashes, and the html page renders incorrectly and the text is unreadable. 

ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.StringIndexOutOfBoundsException: String index out of range: 4
	at java.lang.String.substring(String.java:1963)
	at com.sun.javafx.webkit.prism.WCGraphicsPrismContext.drawString(WCGraphicsPrismContext.java:960)
	at com.sun.webkit.graphics.GraphicsDecoder.decode(GraphicsDecoder.java:290)
	at com.sun.webkit.graphics.WCRenderQueue.decode(WCRenderQueue.java:91)
	at com.sun.webkit.graphics.WCRenderQueue.decode(WCRenderQueue.java:102)
	at com.sun.webkit.graphics.WCImage.flushRQ(WCImage.java:52)
	at com.sun.javafx.webkit.prism.RTImage.lambda$getPixelBuffer$77(RTImage.java:163)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
	at com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
	at java.lang.Thread.run(Thread.java:745)

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
public class Main extends Application{

    public static void main(String[] args) {
        //System.setProperty("jsse.enableSNIExtension", "false");
        Application.launch(args);
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        // Create the root pane and scene
        primaryStage.setTitle("WebView Test");
        BorderPane root = new BorderPane();
        Scene scene = new Scene(root, 551, 400, Color.WHITE);
        primaryStage.setScene(scene);
        WebView browser = new WebView();
        WebEngine webEngine = browser.getEngine();
        
        webEngine.getLoadWorker()
                .stateProperty()
                .addListener( (obsValue, oldState, newState) -> {
                    if (newState == Worker.State.SUCCEEDED) {
                        System.out.println("finished loading");
                    }
                });


        TextField urlAddressField = new TextField();
        urlAddressField.setPromptText("Enter URL of a page to print");
        urlAddressField.setOnAction( actionEvent -> webEngine.load(urlAddressField.getText()));
        
        root.setTop(urlAddressField);
        root.setCenter(browser);
        primaryStage.show();
    }
}
---------- END SOURCE ----------


Comments
[~arajkumar] Most Probably..I will make this issue duplicate of JDK-8088205 and JDK-8165909
24-01-2017

[~mbilla], Looks like a duplicate of JDK-8088205.
24-01-2017

I checked https://carlfx.wordpress.com/ on HelloWebView with latest 9-dev and no font issues observed. Also this exception is fixed as part of JDK-8165909.
24-01-2017