JDK-8216175 : File API and FileReader should be supported in WebView
  • Type: CSR
  • Component: javafx
  • Sub-Component: web
  • Priority: P3
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: openjfx12
  • Submitted: 2019-01-04
  • Updated: 2019-01-23
  • Resolved: 2019-01-23
Related Reports
CSR :  
Description
Summary
-------
Provide FileReader support in JavaFX webview so that application developers can have the ability to read the file contents (as a whole/slice ) via JavaSciript. in an asynchronous manner. This change supports reading multiple files also.

Problem
-------
Currently webkit has support for interfaces like File, FileList, Blob and FileReader. But JavaFX webview does not have the implementation for FileReader, due to which the application developers are not able to read the file contents via JavaScript.

Solution
--------
Since webkit has support for FileReader, we have to implement the missing file related functionality in java webkit port.
From native code , we implemented  methods like openFile, readFromFile, seekFile and closeFile (in FileSystemJava.cpp) and the corresponding JNI calls are implemented like fwkOpenFile, fwkReadFromFile, fwkSeekFile and fwkCloseFile in FileSystem.java. We opted for RandomAccessFile to create file from java.

Currently we don't support reading file contents via drag and drop API.

webrev: https://github.com/javafxports/openjdk-jfx/pull/250

Specification
-------------
We provide support in WebView for the following HTML5  `FileReader` methods, which the application developer can call from JavaScript: 

`FileReader`:

 - `readAsArrayBuffer()`
   
 - `readAsBinaryString()`

   

 - `readAsDataURL()`

   

 - `readAsText()`

   

 - `abort()`

Also refer to the attached FileReader.patch. 
Comments
Moving to Approved.
23-01-2019

Looks good to me.
17-01-2019

Moving to Provisional. Before the request is Finalized for the second phase of CSR review please: * Attached the webrev to the CSR or include some other stand-alone representation of the changes. * Have Kevin review the CSR
09-01-2019

Marking the request as pended until the concerns Kevin raised are addressed.
09-01-2019

You should remove the boilerplate text from the CSR template (e.g., "A concise description of the proposed change. The description should be one to two sentences long and written to be reusable in documents aggregating changes for a release.") Also, the specification section needs to be self-contained (either inline or as an attachment). A webrev can be included as supporting detail, but it isn't sufficient as a spec. In this case, the spec should list the HTML or Javascript functions that an application developer can now make use of in their web page.
08-01-2019

Note that we are creating this CSR "after the fact" to document the HTML functionality that is now implemented in WebView (it was previously unimplemented).
04-01-2019