Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-4263

The FileReader readyState is not working as expected (value in onload for readAsText)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.9.0
    • None
    • cordova-plugin-file
    • None
    • Gingerbread emulator

    Description

      onload is called when readAsText was successful, so the readyState should be FileReader.DONE. See http://www.w3.org/TR/FileAPI/#blobreader-state

      But it is still set as FileReader.LOADING.

      Looking at the v2.9.0 cordova.js code you can see that the setting of the readyState for readAsText is inconsistent with all the other read methods.

      i.e.

      // If onload callback
      if (typeof me.onload === "function") {
      	me.onload(new ProgressEvent("load", {target:me}));
      }
      
      // DONE state
      me._readyState = FileReader.DONE;
      

      It looks like that DONE state should be set before the onload invocation.

      Attachments

        Activity

          People

            purplecabbage Jesse MacFadyen
            dinglemouse Peter
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: