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

File API and FileReader should be supported in WebView

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P3
    • Resolution: Approved
    • Fix Version/s: openjfx12
    • Component/s: javafx
    • Labels:
      None
    • Subcomponent:
      web
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      This implements existing HTML functionality with no new API and poses no compatibility risk.
    • Interface Kind:
      File or wire format
    • Scope:
      JDK

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mbilla Murali Billa
                Reporter:
                shadowbug Shadow Bug
                Reviewed By:
                Kevin Rushforth
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: