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.
- csr of
-
JDK-8207772 File API and FileReader should be supported in WebView
- Resolved