JDK-8180825 : Javafx WebView fails to render pdf.js
  • Type: Bug
  • Component: javafx
  • Sub-Component: web
  • Affected Version: 8u131,9
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2017-05-23
  • Updated: 2017-09-08
  • Resolved: 2017-06-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u151Fixed 9Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [version 6.3.9600]

A DESCRIPTION OF THE PROBLEM :
Webview of javafx v1.8.0_131 isn't able to display demo page of pdf.js ("https://mozilla.github.io/pdf.js/web/viewer.html").

This works in previous versions of java.

REGRESSION.  Last worked in version 8u112


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
//import com.mohamnag.fxwebview_debugger.DevToolsDebuggerServer;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;

public class WebView131Test extends Application
{
	public static void main(String[] args)
	{
		launch(args);
	}

	@Override
	public void start(Stage primaryStage) throws Exception
	{
		WebView browser = new WebView();
		WebEngine webEngine = browser.getEngine();
		webEngine.setOnError(event -> System.err.println(event.getMessage()));
		webEngine.setOnAlert(event -> System.err.println(event.getData()));

		webEngine.setJavaScriptEnabled(true);
		webEngine.load("https://mozilla.github.io/pdf.js/web/viewer.html");

		Scene scene = new Scene(browser);
		primaryStage.setScene(scene);

		primaryStage.show();

		//		try{
		//			DevToolsDebuggerServer.startDebugServer(webEngine.impl_getDebugger(), 51742);
		//		}
		//		catch(Exception e){			
		//			e.printStackTrace();
		//		}
		//		primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>(){
		//			@Override
		//			public void handle(WindowEvent event){
		//				try{					
		//					DevToolsDebuggerServer.stopDebugServer();
		//				}
		//				catch(Exception e){
		//					e.printStackTrace();
		//				}
		//			}
		//		});

	}

}

---------- END SOURCE ----------


Comments
changeset: c458f0ceb559 user: arajkumar date: Mon Jun 12 22:58:51 2017 +0530 description: 8180825: Javafx WebView fails to render pdf.js Reviewed-by: kcr, ghb, mbilla URL: http://hg.openjdk.java.net/openjfx/9-dev/rt/rev/c458f0ceb559
14-06-2017

Fix request approved Approved to push to FX 9-dev for JDK 9.
14-06-2017

Tested the fix..Looks fine.. +1
14-06-2017

Looks good to me. +1
14-06-2017

Fix Request a) Why it's important to fix this bug: This bug is a regression after new WebKit upgrade (JDK-8166999), it breaks few customer applications. b) Explain the nature of fix: Existing font-face API in our WebKit port is incomplete and it supports webfont resource as URL only, but pdf.js uses font-face API with ArrayBuffer/ArrayBufferView which is supported only after r200921. It is a direct merge from upstream WebKit. c) Estimate its risk: This is low risk fix, it just enables applications to pass ArrayBuffer/ArrayBufferView as an argument to FontFace API d) Describe its test coverage: Unit test case added under MiscellaneousTest based on DRT test case present in r200921, it loads ttf file and converts it to ArrayBuffer. Once the ttf font is loaded using FontFace API, various states are tested including it's text rendering. e) Reviewer: [~kcr], [~ghb] and [~mbilla]
14-06-2017

Thanks [~kcr] , [~ghb]. Incorporated [~kcr]'s review comment in http://cr.openjdk.java.net/~arajkumar/8180825/webrev.01 (Added an automated test based on DRT test case found in https://trac.webkit.org/changeset/200921/webkit) Please take a look.
14-06-2017

+1
14-06-2017

The fix looks fine to me, and I tested it on Mac. I recommend that a test be provided (automated if possible).
13-06-2017

Problem is introduced after changeset r196954[1] which has partial implementation(only accepts URI) for FontFace loading API. pdf.js uses font face APIs with ArrayBuffer to load embedded fonts with in a PDF document. ArrayBuffer based font-face is supported after r200921[2]. I have cheery-picked r200921[2] and tested with our WebKit port, I could load https://mozilla.github.io/pdf.js/web/viewer.html. webrev: http://cr.openjdk.java.net/~arajkumar/8180825/webrev [1] https://trac.webkit.org/changeset/196954/webkit [2] https://trac.webkit.org/changeset/200921/webkit
13-06-2017

This seems a serious regression, so raising the priority to P2.
23-05-2017

I can reproduce this in jdk-9+170 and 8u131 using HelloWebView: $ java -cp apps/toys/Hello/dist/Hello.jar hello.HelloWebView https://mozilla.github.io/pdf.js/web/viewer.html As noted above it works fine in 8u121.
23-05-2017

Seems duplicate of JDK-8143604, which was closed as Closed as Cannot Reproduce
23-05-2017

Issue reproducible in both windows 10 and Ubuntu 16.04.2 LTS. 8u131, 8u152, 9-ea+170 => Fail Working fine in 8GA, 8u60, 8u121. Regression introduced in 8u131-b11.
23-05-2017